Exemplo n.º 1
0
        public override void LateUpdate()
        {
            Vector3 angle = Angle;

            RobitTools.ClampAngle(ref angle);

            float rX = angle.y;
            float x  = Mathf.Abs(rX);

            if (x < 22.5f)
            {
                _facing = Facing.Up;
            }
            else if (x < 67.5f)
            {
                _facing = rX < 0 ? Facing.UpLeft : Facing.UpRight;
            }
            else if (x < 112.5f)
            {
                _facing = rX < 0 ? Facing.Left : Facing.Right;
            }
            else if (x < 157.5f)
            {
                _facing = rX < 0 ? Facing.DownLeft : Facing.DownRight;
            }
            else
            {
                _facing = Facing.Down;
            }
        }
Exemplo n.º 2
0
 void Update()
 {
     if (target && Input.GetMouseButton(1))
     {
         _angle.x += Input.GetAxis("Mouse X") * rotationSensitivity;
         RobitTools.ClampAngle(ref _angle);
     }
 }