示例#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);
        }
示例#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;
        }