void Update() { Movement.RemoveFromDirection(LastSeenForceByKeyPress.normalized, 1); LastSeenForceByKeyPress = ForceByKeyPress; Movement.AddToDirection(ForceByKeyPress.normalized, 1); ForceByKeyPress = Vector3.zero; }
private void AddRandomMovement(MovableBody movableBody) { LastAddedMovementMagnitude = Dice.Roll(0.5f, 2f); LastAddedMovement = new Vector3( Dice.Roll(-1f, 1f), 0f, Dice.Roll(-1f, 1f) ); movableBody.AddToDirection( LastAddedMovement, LastAddedMovementMagnitude ); }
public void StartCharging( float duration, float bonusSpeed, float bonusAcceleration ) { IsCharging = true; if (ColorShifter != null) { ColorShifter.ShiftToColor(new Color(1f, 1f, 1f), new Color(1f, 0f, 0f), duration / 4f); } Vector3 direction = (Target - Origin).normalized; StartCoroutine(EndAfter( duration, bonusSpeed, bonusAcceleration, direction )); MovableBody.SetMaxSpeed(MovableBody.GetMaxSpeed() + bonusSpeed); MovableBody.SetAcceleration(MovableBody.GetAcceleration() + bonusAcceleration); MovableBody.AddToDirection(direction, MovementWeighting); }