示例#1
0
        public ParseCommandFile(String filename)
        {
            if (filename == null) return;
            sr = (new ReadFileFactory()).GetSource(filename);

            CommandList = GetReplacementList();
        }
示例#2
0
    public IDragonState HandleInput(DragonController dragon, IHandleInput input)
    {
        if (dragon.isFlinching)
        {
            return(new FlinchingState());
        }

        if (dragon.executingAction)
        {
            return(null);
        }

        if (input.Action() != null)
        {
            if (input.Action().CommandName().Equals("fire"))
            {
                return(new FiringState());
            }
            else if (input.Action().CommandName().Equals("deflect"))
            {
                return(new DeflectingState());
            }
            else if (input.Action().CommandName().Equals("dash"))
            {
                return(new DashingState());
            }
        }

        if (input.Move() != Vector3.zero)
        {
            return(new RunningState());
        }

        return(null);
    }
 public GameStateReadyToStart(IHandleInput inputHandler)
 {
     inputHandler.OnContinue.Subscribe(_ =>
     {
         SwitchToNextGameState();
     });
     CustomDebug.CDebug.Log("Construct GameStateReadyToStart");
 }
示例#4
0
        /// <summary>
        /// Injection and first initialization.
        /// </summary>
        private void Awake()
        {
            #region Self-Injection
#if UNITY_EDITOR
            inputHandler = new UnityInputHandler();
#else
            inputHandler = new UnityInputHandler();
#endif
            #endregion
        }
 // ReSharper disable once UnusedMethodReturnValue.Local
 private Boolean OnMouseInputWithCapture <TArgs>(IHandleInput <TArgs> capture,
                                                 IVisualElement captureAsVisual,
                                                 TArgs args,
                                                 InputAction action,
                                                 Boolean isButtonAction,
                                                 out IHandleInput handledBy)
     where TArgs : IMouseInputEventArgs <TArgs>
 {
     if (!(_elementLocator.TryGetLastRenderBounds(captureAsVisual) is { } bounds))
     {
         handledBy = default !;
示例#6
0
#pragma warning restore 649

        #endregion

        private void Awake()
        {
            #region Self-Injection

            input = new UnityInputHandler();

            #endregion

            basicShortcuts = new Dictionary <KeyCode[], UnityEvent>();

            shortcouts.ForEach(sc => AddListener(sc.keyEvent.Invoke, sc.keyCodes));
        }
示例#7
0
 private void Start()
 {
     state = new IdlingState();
     if (isRobot)
     {
         inputSource = GetComponent <DragonRobot>();
     }
     else
     {
         inputSource = GetComponent <PlayerInput>();
     }
     animator = GetComponent <Animator>();
 }
示例#8
0
    void Start()
    {
        thrust = GetComponent <Thrust>();
        rb     = GetComponent <Rigidbody>();

        if (curentSystemPlatform == Platform.Windows)
        {
            handleInput = new HandleWindows();
        }
        else if (curentSystemPlatform == Platform.Android)
        {
            handleInput = new HandleAndroid();
        }
    }
示例#9
0
    private void Start()
    {
        Instance = this;

        if (InputAction == null)
        {
            InputAction = new HandleInput();
        }

        //Spawn all pieces
        SpawnAllChessPieces();
        WhiteCamera.enabled = true;
        BlackCamera.enabled = false;
    }
示例#10
0
 public IDragonState HandleInput(DragonController dragonController, IHandleInput input)
 {
     if (input.Move() == Vector3.zero)
     {
         return(new IdlingState());
     }
     else if (input.Move() != Vector3.zero)
     {
         return(new RunningState());
     }
     else
     {
         return(null);
     }
 }
示例#11
0
        public GameUI(IMazeIntegration mazeIntegration, IHandleInput handleInput, ILoadMaze loadMaze,
                      IRenderMaze renderMaze, ILoadPlayer loadPlayer, IExecuteUserAction executeUserAction)
        {
            _mazeIntegration   = mazeIntegration;
            _handleInput       = handleInput;
            _loadMaze          = loadMaze;
            _renderMaze        = renderMaze;
            _loadPlayer        = loadPlayer;
            _executeUserAction = executeUserAction;

            InitializeSettings();
            PlayGame();

            Console.WriteLine(Constants.PlayerConstants.EOG);
            Console.ReadKey();
        }
示例#12
0
        private static void InitHandler()
        {
            // First, just try to use the legacy input, see if its working.
            // The InputSystem package may be present but not actually activated, so we can find out this way.

            if (LegacyInput.TInput != null)
            {
                try
                {
                    m_inputModule = new LegacyInput();
                    CurrentType   = InputType.Legacy;

                    // make sure its working
                    GetKeyDown(KeyCode.F5);

                    ExplorerCore.Log("Initialized Legacy Input support");
                    return;
                }
                catch
                {
                    // It's not working, we'll fall back to InputSystem.
                }
            }

            if (InputSystem.TKeyboard != null)
            {
                try
                {
                    m_inputModule = new InputSystem();
                    CurrentType   = InputType.InputSystem;
                    ExplorerCore.Log("Initialized new InputSystem support.");
                    return;
                }
                catch (Exception ex)
                {
                    ExplorerCore.Log(ex);
                }
            }

            ExplorerCore.LogWarning("Could not find any Input Module Type!");
            m_inputModule = new NoInput();
            CurrentType   = InputType.None;
        }
示例#13
0
        public static void Init()
        {
            if (InputSystem.TKeyboard != null || (ReflectionHelpers.LoadModule("Unity.InputSystem") && InputSystem.TKeyboard != null))
            {
                m_inputModule = new InputSystem();
                CurrentType   = InputType.InputSystem;
            }
            else if (LegacyInput.TInput != null || (ReflectionHelpers.LoadModule("UnityEngine.InputLegacyModule") && LegacyInput.TInput != null))
            {
                m_inputModule = new LegacyInput();
                CurrentType   = InputType.Legacy;
            }

            if (m_inputModule == null)
            {
                ExplorerCore.LogWarning("Could not find any Input module!");
                m_inputModule = new NoInput();
                CurrentType   = InputType.None;
            }
        }
示例#14
0
    public IDragonState HandleInput(DragonController dragon, IHandleInput input)
    {
        Debug.Log("Flinchstate Active");
        if (dragon.isFlinching)
        {
            return(null);
        }

        if (input.Move() == Vector3.zero)
        {
            return(new IdlingState());
        }
        else if (input.Move() != Vector3.zero)
        {
            return(new RunningState());
        }
        else
        {
            return(null);
        }
    }
示例#15
0
        public void DispatchMouseInput(World world, MouseInput mi)
        {
            if (mi.Event == MouseInputEvent.Move)
                mousePos = mi.Location;

            if (dragRegion != null) {
                dragRegion.HandleInput( world, mi );
                if (mi.Event == MouseInputEvent.Up) dragRegion = null;
                return;
            }

            dragRegion = regions.FirstOrDefault(r => r.HandleInput(world, mi));
            if (mi.Event != MouseInputEvent.Down)
                dragRegion = null;
        }
示例#16
0
 public IDragonState HandleInput(DragonController dragonController, IHandleInput input)
 {
     return(null);
 }
 public GameStateInitialToIntro(IHandleInput handleInput)
 {
     handleInput.OnContinue.Subscribe(_ => SwitchNextToGameState());
 }