Esempio n. 1
0
        public override SF4InputState Convert()
        {
            SF4InputState outputState = new SF4InputState();

            gamePadState = GamePad.GetState(playerIndex);

            //Options
            outputState.Back  = gamePadState.Buttons.Back == ButtonState.Pressed;
            outputState.Start = gamePadState.Buttons.Start == ButtonState.Pressed;

            //Punches
            outputState.LightPunch  = gamePadState.Buttons.X == ButtonState.Pressed;
            outputState.MediumPunch = gamePadState.Buttons.Y == ButtonState.Pressed;
            outputState.HardPunch   = gamePadState.Buttons.RightShoulder == ButtonState.Pressed;

            //Kicks
            outputState.LightKick  = gamePadState.Buttons.A == ButtonState.Pressed;
            outputState.MediumKick = gamePadState.Buttons.B == ButtonState.Pressed;
            outputState.HardKick   = gamePadState.Triggers.Right > 0.25f;

            //Determine if Dpad has any input
            outputState.Right = (gamePadState.DPad.Right == ButtonState.Pressed || gamePadState.ThumbSticks.Left.X > 0.25f);

            outputState.Left = (gamePadState.DPad.Left == ButtonState.Pressed || -gamePadState.ThumbSticks.Left.X > 0.25f);

            outputState.Up = (gamePadState.DPad.Up == ButtonState.Pressed || gamePadState.ThumbSticks.Left.Y > 0.25f);

            outputState.Down = (gamePadState.DPad.Down == ButtonState.Pressed || -gamePadState.ThumbSticks.Left.Y > 0.25f);

            return(outputState);
        }
        public override SF4InputState Convert()
        {
            SF4InputState outputState = new SF4InputState();

            gamePadState = GamePad.GetState(playerIndex);

            //Options
            outputState.Options.Back = gamePadState.Buttons.Back == ButtonState.Pressed;
            outputState.Options.Start = gamePadState.Buttons.Start == ButtonState.Pressed;

            //Punches
            outputState.Punches.Light = gamePadState.Buttons.X == ButtonState.Pressed;
            outputState.Punches.Medium = gamePadState.Buttons.Y == ButtonState.Pressed;
            outputState.Punches.Hard = gamePadState.Buttons.RightShoulder == ButtonState.Pressed;

            //Kicks
            outputState.Kicks.Light = gamePadState.Buttons.A == ButtonState.Pressed;
            outputState.Kicks.Medium = gamePadState.Buttons.B == ButtonState.Pressed;
            outputState.Kicks.Hard = gamePadState.Triggers.Right > 0.25f;

            //Determine if Dpad has any input
            outputState.Directions.Right = (gamePadState.DPad.Right == ButtonState.Pressed || gamePadState.ThumbSticks.Left.X > 0.25f);

            outputState.Directions.Left = (gamePadState.DPad.Left == ButtonState.Pressed || -gamePadState.ThumbSticks.Left.X > 0.25f);

            outputState.Directions.Up = (gamePadState.DPad.Up == ButtonState.Pressed || gamePadState.ThumbSticks.Left.Y > 0.25f);

            outputState.Directions.Down = (gamePadState.DPad.Down == ButtonState.Pressed || -gamePadState.ThumbSticks.Left.Y > 0.25f);

            return outputState;
        }
Esempio n. 3
0
        public bool Equals(SF4InputState other)
        {
            if (object.ReferenceEquals(other, null))
            {
                return(false);
            }

            bool result = true;

            result &= Back == other.Back;
            result &= Start == other.Start;
            result &= Up == other.Up;
            result &= Down == other.Down;
            result &= Left == other.Left;
            result &= Right == other.Right;
            result &= Forward == other.Forward;
            result &= Backward == other.Backward;
            result &= LightPunch == other.LightPunch;
            result &= MediumPunch == other.MediumPunch;
            result &= HardPunch == other.HardPunch;
            result &= LightKick == other.LightKick;
            result &= MediumKick == other.MediumKick;
            result &= HardKick == other.HardKick;

            return(result);
        }
        // Update is called once per frame
        public void InputUpdate()
        {
            if (converter != null)
            {
                CurrentState = converter.Convert();
            }

            #if UNITY_EDITOR
                Debug.Log(CommandState.ToString());
            #endif
        }
Esempio n. 5
0
        // Update is called once per frame
        public void InputUpdate()
        {
            if (converter != null)
            {
                CurrentState = converter.Convert();
            }

            #if UNITY_EDITOR
            Debug.Log(CommandState.ToString());
            #endif
        }
        public bool Equals(SF4InputState other)
        {
            if (object.ReferenceEquals(other, null)) return false;

            bool result = true;
            result &= Options.Back == other.Options.Back;
            result &= Options.Start == other.Options.Start;
            result &= Directions.Up == other.Directions.Up;
            result &= Directions.Down == other.Directions.Down;
            result &= Directions.Left == other.Directions.Left;
            result &= Directions.Right == other.Directions.Right;
            result &= Directions.Forward == other.Directions.Forward;
            result &= Directions.Backward == other.Directions.Backward;
            result &= Punches.Light == other.Punches.Light;
            result &= Punches.Medium == other.Punches.Medium;
            result &= Punches.Hard == other.Punches.Hard;
            result &= Kicks.Light == other.Kicks.Light;
            result &= Kicks.Medium == other.Kicks.Medium;
            result &= Kicks.Hard == other.Kicks.Hard;

            return result;
        }
        public bool Equals(SF4InputState other)
        {
            if (object.ReferenceEquals(other, null)) return false;

            bool result = true;
            result &= Back == other.Back;
            result &= Start == other.Start;
            result &= Up == other.Up;
            result &= Down == other.Down;
            result &= Left == other.Left;
            result &= Right == other.Right;
            result &= Forward == other.Forward;
            result &= Backward == other.Backward;
            result &= LightPunch == other.LightPunch;
            result &= MediumPunch == other.MediumPunch;
            result &= HardPunch == other.HardPunch;
            result &= LightKick == other.LightKick;
            result &= MediumKick == other.MediumKick;
            result &= HardKick == other.HardKick;

            return result;
        }