Пример #1
0
    private void TriggerMove(MovingJoystick move, bool isLift)
    {
        if (isLift)
        {
            GestureArgs e = new GestureArgs();
            e.name           = "OnSingleTap";
            e.airWelGamePosX = 0f;
            e.airWelGamePosY = 0f;
            e.airWelGamePosZ = 0f;
            e.selectedObjID  = -1;
            e.towards        = -1f;
            e.inputType      = InputType.Joystick;
            //LogicSystem.FireGestureEvent(e);
            LogicSystem.SetJoystickInfo(e);
            return;
        }

        UnityEngine.GameObject playerSelf = LogicSystem.PlayerSelf;
        if (playerSelf != null && move.joystickAxis != UnityEngine.Vector2.zero)
        {
            UnityEngine.Vector2 joyStickDir = move.joystickAxis * 10.0f;
            UnityEngine.Vector3 targetRot   = new UnityEngine.Vector3(joyStickDir.x, 0, joyStickDir.y);
            UnityEngine.Vector3 targetPos   = playerSelf.transform.position + targetRot;

            GestureArgs e = new GestureArgs();
            e.name          = "OnSingleTap";
            e.selectedObjID = -1;
            float towards = UnityEngine.Mathf.Atan2(targetPos.x - playerSelf.transform.position.x, targetPos.z - playerSelf.transform.position.z);
            e.towards        = towards;
            e.airWelGamePosX = targetPos.x;
            e.airWelGamePosY = targetPos.y;
            e.airWelGamePosZ = targetPos.z;
            e.inputType      = InputType.Joystick;
            //LogicSystem.FireGestureEvent(e);
            LogicSystem.SetJoystickInfo(e);
        }
    }