void Start()
    {
        EasyJoystick.On_JoystickMoveStart += OnJoyStickMoveBegin;
        EasyJoystick.On_JoystickMove      += OnJoyStickMove;
        EasyJoystick.On_JoystickMoveEnd   += OnJoyStickMoveEnd;

        EasyButton.On_ButtonDown += OnButtonPressed;
        EasyButton.On_ButtonUp   += OnButtonUp;

        directMsg = new MsgVector2((ushort)CharactorEvent.eJoyStick, Vector2.zero);
        buttonMsg = new MsgBase((ushort)CharactorEvent.eAttack);
    }
Exemple #2
0
    public override void ProccessEvent(MsgBase Msg)
    {
        switch (Msg.msgId)
        {
        case (ushort)CharactorEvent.eJoyStickBegin:
            controlMsg.ChangeEventId((ushort)CharactorEvent.eRun);
            controlMsg.value = tmpSpeed;
            SendMsg(controlMsg);
            break;

        case (ushort)CharactorEvent.eJoyStick:
            MsgVector2 tmpMsg = (MsgVector2)Msg;
            MoveCtr(tmpMsg.joyStick);

            controlMsg.ChangeEventId((ushort)CharactorEvent.eRun);
            controlMsg.value = tmpSpeed;
            SendMsg(controlMsg);

            break;

        case (ushort)CharactorEvent.eJoyStickEnd:
            controlMsg.ChangeEventId((ushort)CharactorEvent.eIdle);
            controlMsg.value = 0;
            SendMsg(controlMsg);
            break;

        case (ushort)CharactorEvent.eLooseBlood:
            MsgFloat bloodMsg = (MsgFloat)Msg;
            monsterData.ReduceBlood(bloodMsg.value);
            MsgFloat tmp = new MsgFloat((ushort)CharactorEvent.eLooseBlood, monsterData.GetBlood());
            SendMsg(tmp);
            break;

        default:
            break;
        }
    }