// Update is called once per frame protected override void Update() { base.Update(); timer += Time.deltaTime; if ((int)timer % 3 == 0 && timer > 1) { Direction *= -1; jumpBody.AddForce(-Gravity.GetGravityDirection() * 20); } transform.position += new Vector3(Direction, 0, 0) * Time.deltaTime; }
public void Jump() { this.newVelocity.y = 0; this.newVelocity += -Gravity.GetGravityDirection() * this.jumpSpeed; }