Gameplay improvement
This commit is contained in:
@@ -33,6 +33,7 @@ public class PlayerController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
@@ -48,11 +49,20 @@ public class PlayerController : MonoBehaviour
|
||||
aiInput = this.aiController.GetInputs();
|
||||
rotationDirection = aiInput[AiInputs.HORIZONTAL];
|
||||
movementDirection = aiInput[AiInputs.VERTICAL];
|
||||
|
||||
}
|
||||
|
||||
if (this.useController) {
|
||||
//Debug.Log(Input.GetAxis("VerticalBack" + this.playerNumber));
|
||||
movementDirection = Input.GetAxis("VerticalBack" + this.playerNumber) > 0 ? -1 : movementDirection;
|
||||
movementDirection = Input.GetAxis("Horizontal" + this.playerNumber) != 0 ? 1 : movementDirection;
|
||||
|
||||
float horizontal = Input.GetAxis("Horizontal3");
|
||||
float vertical = Input.GetAxis("Vertical3");
|
||||
if (movementDirection != 0)
|
||||
{
|
||||
Vector3 direction = new Vector3(horizontal, 0, -vertical).normalized;
|
||||
this.transform.rotation = Quaternion.LookRotation(direction, Vector3.up);
|
||||
}
|
||||
}
|
||||
|
||||
//Links
|
||||
@@ -67,18 +77,19 @@ public class PlayerController : MonoBehaviour
|
||||
transform.Rotate(Vector3.up, -this.rotationSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
Debug.Log(movementDirection);
|
||||
//Forward
|
||||
if (movementDirection > 0)
|
||||
if (movementDirection != 0)
|
||||
{
|
||||
this.rb.drag = this.drag;
|
||||
this.rb.AddRelativeForce(Vector3.forward * this.movementSpeed * Time.deltaTime, ForceMode.Impulse);
|
||||
}
|
||||
|
||||
//Zurück
|
||||
if (movementDirection < 0)
|
||||
{
|
||||
this.rb.AddRelativeForce(Vector3.back * this.movementSpeed / 2 * Time.deltaTime, ForceMode.Impulse);
|
||||
}
|
||||
//if (movementDirection < 0)
|
||||
//{
|
||||
// this.rb.AddRelativeForce(Vector3.back * this.movementSpeed / 2 * Time.deltaTime, ForceMode.Impulse);
|
||||
//}
|
||||
|
||||
//Boost
|
||||
if (Input.GetButtonDown("Boost" + this.playerNumber) || aiInput[AiInputs.BOOST] > 0 && !this.lockBoost)
|
||||
@@ -99,5 +110,7 @@ public class PlayerController : MonoBehaviour
|
||||
this.forceZone.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user