예제 #1
0
 public void Add(BurinkeruInputManager.InputCommand command)
 {
     actionDefinition.Add(new List <BurinkeruInputManager.InputCommand>()
     {
         command
     });
 }
예제 #2
0
        public static KeyCode GetDefaultKeyMapping(BurinkeruInputManager.InputCommand inputCommand)
        {
            KeyCode result = KeyCode.None;

            switch (inputCommand)
            {
            case BurinkeruInputManager.InputCommand.FORWARD:

                result = KeyCode.W;

                break;

            case BurinkeruInputManager.InputCommand.BACKWARD:

                result = KeyCode.S;

                break;

            case BurinkeruInputManager.InputCommand.LEFT:

                result = KeyCode.A;

                break;

            case BurinkeruInputManager.InputCommand.RIGHT:

                result = KeyCode.D;

                break;

            case BurinkeruInputManager.InputCommand.JUMP:

                result = KeyCode.Space;

                break;

            case BurinkeruInputManager.InputCommand.CROUCH:

                result = KeyCode.LeftControl;

                break;

            case BurinkeruInputManager.InputCommand.RUN:

                result = KeyCode.LeftShift;

                break;

            case BurinkeruInputManager.InputCommand.RELOAD:

                result = KeyCode.R;

                break;
            }

            return(result);
        }
예제 #3
0
        void updateKeys()
        {
            BurinkeruInputManager.InputCommand command = BurinkeruInputManager.InputCommand.NO_TYPE;
            KeyCode mappedKey = KeyCode.None;

            for (int c = 0; c < pressCommands.Length; c++)
            {
                command = (BurinkeruInputManager.InputCommand)c;

                if (command == BurinkeruInputManager.InputCommand.ATTACK)
                {
                    downCommands [c] = UnityEngine.Input.GetMouseButtonDown(0);
                    upCommands [c]   = UnityEngine.Input.GetMouseButtonUp(0);

                    if (downCommands [c])
                    {
                        pressCommands [c] = true;
                    }
                    else if (upCommands [c])
                    {
                        pressCommands [c] = false;
                    }
                }
                else if (command == BurinkeruInputManager.InputCommand.BLINK)
                {
                    downCommands [c] = UnityEngine.Input.GetMouseButtonDown(1);
                    upCommands [c]   = UnityEngine.Input.GetMouseButtonUp(1);

                    if (downCommands [c])
                    {
                        pressCommands [c] = true;
                    }
                    else if (upCommands [c])
                    {
                        pressCommands [c] = false;
                    }
                }
                else if (command != BurinkeruInputManager.InputCommand.NO_TYPE)
                {
                    mappedKey        = GetDefaultKeyMapping(command);
                    downCommands [c] = UnityEngine.Input.GetKeyDown(mappedKey);
                    upCommands [c]   = UnityEngine.Input.GetKeyUp(mappedKey);

                    if (downCommands [c])
                    {
                        pressCommands [c] = true;
                    }
                    else if (upCommands [c])
                    {
                        pressCommands [c] = false;
                    }
                }
            }
        }
 public bool IsCommandUp(BurinkeruInputManager.InputCommand inputCommand)
 {
     return(upCommands [(int)inputCommand]);
 }
 public bool IsCommandPressed(BurinkeruInputManager.InputCommand inputCommand)
 {
     return(pressCommands [(int)inputCommand]);
 }
 public bool IsCommandDown(BurinkeruInputManager.InputCommand inputCommand)
 {
     return(downCommands [(int)inputCommand]);
 }