Exemplo n.º 1
0
        //---------------------------------------------------------------------------

        public void Update(EGameAction action, float value)
        {
            if (Actions.ContainsKey(action))
            {
                Actions[action].Update(value);
            }
            else
            {
                Actions.Add(action, new GameActionData(value));
            }
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------------

        public void MapAction(EGameAction action, params EInput[] input)
        {
            if (!m_Mappings.ContainsKey(action))
            {
                m_Mappings.Add(action, input);
            }
            else
            {
                m_Mappings[action] = input;
            }
        }
Exemplo n.º 3
0
        //---------------------------------------------------------------------------

        private float GetValue(EGameAction action)
        {
            if (m_Mappings.ContainsKey(action))
            {
                float value = 0.0f;
                foreach (EInput input in m_Mappings[action])
                {
                    value = Math.Max(value, InputManager.Get().GetValue(input, m_PlayerIndex));
                }
                return(value);
            }
            return(0);
        }
Exemplo n.º 4
0
        //---------------------------------------------------------------------------

        public GameActionData this[EGameAction action]
        {
            get { return(Actions.ContainsKey(action) ? Actions[action] : null); }
        }
        private EGameActionFailure Pending_Turn_Allows_Action( EGameAction action )
        {
            switch ( action )
            {
                case EGameAction.Play_Card:
                case EGameAction.Discard_Card:
                    if ( m_PendingTurn.Actions.Count == 1 )
                    {
                        if ( m_PendingTurn.Actions[ 0 ].Action == EGameAction.Pass_Cards )
                        {
                            return EGameActionFailure.Cannot_Play_A_Card_After_Passing_Cards;
                        }
                        else
                        {
                            return EGameActionFailure.Cannot_Play_More_Than_One_Card;
                        }
                    }
                    else if ( m_PendingTurn.Actions.Count > 1 )
                    {
                        return EGameActionFailure.Turn_Is_Already_Complete;
                    }
                    break;

                case EGameAction.Draw_From_Discard:
                case EGameAction.Draw_From_Deck:
                    if ( m_PendingTurn.Actions.Count == 0 )
                    {
                        return EGameActionFailure.You_Must_Play_A_Card_Before_Drawing;
                    }
                    else if ( m_PendingTurn.Actions.Count > 1 )
                    {
                        return EGameActionFailure.Turn_Is_Already_Complete;
                    }
                    else if ( m_PendingTurn.Actions[ 0 ].Action == EGameAction.Pass_Cards )
                    {
                        return EGameActionFailure.Cannot_Play_A_Card_After_Passing_Cards;
                    }
                    break;

                case EGameAction.Pass_Cards:
                    if ( Match.GameState.Mode != EGameModeType.Four_Players )
                    {
                        return EGameActionFailure.Can_Only_Pass_Cards_In_A_Four_Player_Game;
                    }

                    if ( m_PendingTurn.Actions.Count == 1 )
                    {
                        if ( m_PendingTurn.Actions[ 0 ].Action == EGameAction.Pass_Cards )
                        {
                            return EGameActionFailure.Can_Only_Pass_One_Set_Of_Cards;
                        }
                        else
                        {
                            return EGameActionFailure.Turn_Is_Already_Complete;
                        }
                    }
                    else if ( m_PendingTurn.Actions.Count > 1 )
                    {
                        return EGameActionFailure.Turn_Is_Already_Complete;
                    }
                    break;
            }

            return EGameActionFailure.None;
        }