public void Move(Direction direction) { //TODO(ash) // Direction = input // based on input, and camera position/rotation, figure out direction vector to move character // apply Vector3 MovementDirection = new Vector3(0, 0, 0); switch (direction) { case Direction.F: MovementDirection += F(); break; case Direction.B: MovementDirection += B(); break; case Direction.L: MovementDirection += L(); break; case Direction.R: MovementDirection += R(); break; case Direction.FL: MovementDirection += F() + L(); break; case Direction.FR: MovementDirection += F() + R(); break; case Direction.BL: MovementDirection += B() + L(); break; case Direction.BR: MovementDirection += B() + R(); break; } MovementDirection.Normalize(); MovementDirection *= GetCurrentSpeed(); // apply gravity after regular movement MovementDirection += Gravity(); _actor.SetDirection(direction); _characterController.Move(MovementDirection * Time.deltaTime); }
public void SetDirection(Direction d) { this._direction = d; }