示例#1
0
        public override Vector2 GetVector2(string actionName)
        {
            // Not officially supported
            // Example : "Movement"  splits into "Movement X" and "Movement Y"

            Vector2Action vector2Action;

            bool found = vector2Actions.TryGetValue(actionName, out vector2Action);

            if (!found)
            {
                vector2Action = new Vector2Action(
                    string.Concat(actionName, " X"),
                    string.Concat(actionName, " Y")
                    );

                vector2Actions.Add(actionName, vector2Action);
            }

            Vector2 output = default(Vector2);

            try
            {
                output = new Vector2(Input.GetAxis(vector2Action.x), Input.GetAxis(vector2Action.y));
            }
            catch (System.Exception)
            {
                PrintInputWarning(vector2Action.x, vector2Action.y);
            }

            return(output);
        }
示例#2
0
        /// <summary>
        /// Initializes all the actions by instantiate them. Each action will be instantiated with its specific type (Bool, Float or Vector2).
        /// </summary>
        public void InitializeActions()
        {
            @jump = new BoolAction();
            @jump.Initialize();

            @run = new BoolAction();
            @run.Initialize();

            @interact = new BoolAction();
            @interact.Initialize();

            @jetPack = new BoolAction();
            @jetPack.Initialize();

            @dash = new BoolAction();
            @dash.Initialize();

            @crouch = new BoolAction();
            @crouch.Initialize();



            @movement = new Vector2Action();
        }