示例#1
0
        private void UpdateLooking()
        {
            Vector2 mousePosition = GameState.Instance.mouseLocation - controllable.transform.position;
            float   turretAngle   = controllable.Turret.transform.WorldRotation;
            float   dotProduct    = Vector2.Dot(mousePosition, Utils.RotatedVector(turretAngle));

            if (dotProduct < -1)
            {
                tankController.LookLeft();
            }
            else if (dotProduct > 1)
            {
                tankController.LookRight();
            }
            else
            {
                tankController.StopLooking();
            }
        }