Beispiel #1
0
        private void WatchOnMouse()
        {
            Vector3    mousePos  = Input.mousePosition;
            Vector3    direction = Camera.main.ScreenToWorldPoint(mousePos) - transform.position;
            Quaternion needRot   = InDirectionRotator.Rotate(direction);

            Tower.rotation = StraightQuaternionSwitcher.Get(Tower.rotation, needRot, TowerRotationSpeed * Time.fixedDeltaTime);
        }
Beispiel #2
0
        private void Accelerate(out Vector2 newVelocity)
        {
            Vector2 shouldVel = transform.up * Speed;

            newVelocity = AccelerationCalculator.Vector(Rigidbody.velocity, shouldVel, Accel);

            Quaternion needRot = InDirectionRotator.Rotate(CurrentDirection);

            transform.rotation = StraightQuaternionSwitcher.Get(transform.rotation, needRot, BodyRotateSpeed * Time.fixedDeltaTime);

            IsAccelerating = false;
            IsDiagonalMove = false;
        }
Beispiel #3
0
 public void SetRotation(Vector2 direction)
 {
     transform.rotation = InDirectionRotator.Rotate(direction);
 }