예제 #1
0
    public static string GetActionName(eActionState state)
    {
        string sAniname = "";

        m_ActionDict.TryGetValue(state, out sAniname);

        return(sAniname);
    }
예제 #2
0
    public CAnimator(Animator animator, int layer = 0)
    {
        m_pAnimator    = animator;
        m_nLayer       = 0;
        m_eActionState = eActionState.None;


        m_pAniInfo            = new CAnimatorStateInfo();
        m_pAniInfo.bStartPlay = false;

        m_bPlayAction = false;
    }
예제 #3
0
        private void ActionOfFinishMove(Button i_ButtonStartOfMove, Button i_ButtonClicked)
        {
            int  colSourcePosition = (i_ButtonStartOfMove.Left - m_Board[0, 0].Location.X) / k_ButtonSize;
            int  rowSourcePosition = (i_ButtonStartOfMove.Location.Y - m_Board[0, 0].Location.Y) / k_ButtonSize;
            int  colChoosePosition = (i_ButtonClicked.Left - m_Board[0, 0].Location.X) / k_ButtonSize;
            int  rowChoosePosition = (i_ButtonClicked.Location.Y - m_Board[0, 0].Location.Y) / k_ButtonSize;
            bool IsSourceIsChoose  = i_ButtonStartOfMove.Equals(i_ButtonClicked);

            if (IsSourceIsChoose)
            {
                i_ButtonStartOfMove.BackColor = Color.Wheat;
                m_TurnFlag = false;
            }
            else
            {
                Move         move        = new Move(rowSourcePosition, colSourcePosition, rowChoosePosition, colChoosePosition);
                eActionState ActionState = m_CheckersBoardManagment.CheckingMovementState(move);

                switch (ActionState)
                {
                case eActionState.IlegalMove:
                    ShowTryAgainMessage("Ilegal Move!");
                    break;

                case eActionState.NeedToEat:
                    ShowTryAgainMessage("You need to eat first");
                    break;

                case eActionState.MoveIsPossible:
                    m_CheckersBoardManagment.DoMove(move);
                    break;

                default: break;
                }

                i_ButtonStartOfMove.BackColor = Color.Wheat;
                m_TurnFlag = false;
            }
        }
예제 #4
0
        public eActionState CheckingMovementState(Move i_Move)
        {
            User         UserWhoPlays       = UserTurn();
            List <Move>  UserMoveCollection = UserMovesCollection(UserWhoPlays);
            eActionState ActionState        = eActionState.MoveIsPossible;

            if (i_Move.StartRow < 0 || i_Move.StartRow >= r_BoardSize || i_Move.StartCol < 0 || i_Move.StartCol >= r_BoardSize)
            {
                ActionState = eActionState.IlegalMove;
            }
            else if (m_Board[i_Move.StartRow, i_Move.StartCol] != UserWhoPlays.SoldierSign && m_Board[i_Move.StartRow, i_Move.StartCol] != UserWhoPlays.KingSign)
            {
                ActionState = eActionState.IlegalMove;
            }
            else if (IsCanEat(UserMoveCollection[0]) && !IsCanEat(i_Move))
            {
                ActionState = eActionState.NeedToEat;
            }
            else if (IsCanEat(i_Move))
            {
                int EndRowPos = (i_Move.StartRow + i_Move.EndRow) / 2;
                int EndColPos = (i_Move.StartCol + i_Move.EndCol) / 2;

                if (!CanEatMove(UserWhoPlays, i_Move.StartRow, i_Move.StartCol, EndRowPos, EndColPos, i_Move.EndRow, i_Move.EndCol))
                {
                    ActionState = eActionState.IlegalMove;
                }
            }
            else
            {
                if (!CheckingLegalMovment(UserWhoPlays, i_Move.StartRow, i_Move.StartCol, i_Move.EndRow, i_Move.EndCol))
                {
                    ActionState = eActionState.IlegalMove;
                }
            }

            return(ActionState);
        }