コード例 #1
0
        //a method called to execute commands (collected inputs) sent by the host/server
        public void LaunchCommand(NetworkInput command)
        {
            switch ((InputMode)command.sourceMode)
            {
            case InputMode.create:
                OnCreateCommand(command);
                break;

            case InputMode.destroy:
                OnDestroyCommand(command);
                break;

            case InputMode.factionEntity:
                OnFactionEntityCommand(command);
                break;

            case InputMode.unitGroup:
                OnUnitGroupMovementCommand(command);
                break;

            case InputMode.unit:
                OnUnitCommand(command);
                break;

            case InputMode.building:
                OnBuildingCommand(command);
                break;

            case InputMode.resource:
                OnResourceCommand(command);
                break;

            case InputMode.APC:
                OnAPCCommand(command);
                break;

            case InputMode.customCommand:
                CustomEvents.OnCustomCommand(command);
                break;

            default:
                Debug.LogError("[Input Manager] Invalid input source mode!");
                break;
            }
        }