Пример #1
0
 void Update()
 {
     if (Input.GetKeyDown(changeControllerStateKey)) //Keycode.N
     {
         if (currentControllerState == ControllerState.Player)
         {
             unitCamera.enabled     = true;
             playerCamera.enabled   = false;
             selectionState         = SelectionState.None;
             currentControllerState = ControllerState.Unit;
         }
         else
         {
             unitCamera.enabled     = false;
             playerCamera.enabled   = true;
             selectionState         = SelectionState.None;
             currentControllerState = ControllerState.Player;
         }
         print("Current State " + currentControllerState.ToString());
     }
     if (currentControllerState == ControllerState.Player)
     {
         PlayerController();
         playerCameraController.FollowPlayer();
     }
     else if (currentControllerState == ControllerState.Unit)
     {
         UnitController();
         unitCameraController.FreeMovement();
     }
     else
     {
         print("No State");
     }
 }
    public TData GetData(ControllerState state)
    {
        switch (state)
        {
        case ControllerState.Walking:
            return(walking);

        case ControllerState.Sprinting:
            return(sprint);

        case ControllerState.Crouching:
            return(crouch);

        case ControllerState.Proning:
            return(prone);
        }

        throw new ArgumentException("Controller State Data " + state.ToString() + " Not Defined");
    }
Пример #3
0
        public static TData GetData(IControllerStatesDataTemplate <TData> template, ControllerState state)
        {
            switch (state)
            {
            case ControllerState.Walking:
                return(template.Walk);

            case ControllerState.Sprinting:
                return(template.Sprint);

            case ControllerState.Crouching:
                return(template.Crouch);

            case ControllerState.Proning:
                return(template.Prone);

            case ControllerState.Sliding:
                return(template.Slide);
            }

            throw new ArgumentException("Controller State Data " + state.ToString() + " Not Defined");
        }
Пример #4
0
 private void updateStateTextBox()
 {
     serializedOutput.Text = State.ToString();
 }
Пример #5
0
 private void ClearControllerStateFlag(string flagName, byte mask)
 {
     ControllerState = (byte)(ControllerState & mask);
     LogMessage("{0}: Cleared (0x{1})", flagName, ControllerState.ToString("X").PadLeft(2, '0'));
 }
Пример #6
0
 public override string ToString()
 {
     return(Controller.ToString() + FirePressed.ToString());
 }