コード例 #1
0
 public bool CheckCombo(InputArrow inputArrow, int inputAction, int globalSuccessCounter, out bool isComboEnd, out bool isPerfectCombo)
 {
     if (globalSuccessCounter == 0 || globalSuccessCounter == comboSuccessCounter)
     {
         if (comboAction[globalSuccessCounter] == inputAction)
         {
             if (globalSuccessCounter == comboAction.Length - 1 && (comboArrow == InputArrow.NULL || inputArrow == comboArrow))
             {
                 comboSuccessCounter = 0;
                 isComboEnd          = true;
                 isPerfectCombo      = inputArrow == comboArrow;
                 return(true);
             }
             else if (globalSuccessCounter == comboAction.Length - 1)
             {
                 isComboEnd     = false;
                 isPerfectCombo = false;
                 return(false);
             }
             comboSuccessCounter = globalSuccessCounter + 1;
             isComboEnd          = false;
             isPerfectCombo      = false;
             return(true);
         }
     }
     comboSuccessCounter = 0;
     isComboEnd          = false;
     isPerfectCombo      = false;
     return(false);
 }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        //Move
        isUpButtonDown    = actionMap["MoveUp"].triggered;
        isDownButtonDown  = actionMap["MoveDown"].triggered;
        isRightButtonDown = actionMap["MoveRight"].triggered;
        isLeftButtonDown  = actionMap["MoveLeft"].triggered;

        if (isUpButtonDown)
        {
            moveArrow        = InputArrow.UP;
            isMoveButtonDown = true;
        }
        else if (isDownButtonDown)
        {
            moveArrow        = InputArrow.DOWN;
            isMoveButtonDown = true;
        }
        else if (isRightButtonDown)
        {
            moveArrow        = InputArrow.RIGHT;
            isMoveButtonDown = true;
        }
        else if (isLeftButtonDown)
        {
            moveArrow        = InputArrow.LEFT;
            isMoveButtonDown = true;
        }
        else
        {
            isMoveButtonDown = false;
        }

        //Attack
        isAttackButtonDown = actionMap["Attack"].triggered;
    }
コード例 #3
0
ファイル: MazePrinter.cs プロジェクト: KevinAdrar/maze
        public void PrintAndPlay()
        {
            bool[,] explored = new bool[MazeInformations.Length, MazeInformations.Width];

            int x = 0;
            int y = MazeInformations.Entree;

            for (int i = 0; i < MazeInformations.Length; i++)
            {
                for (int j = 0; j < MazeInformations.Width; j++)
                {
                    explored[i, j] = true;
                }
            }

            while (true)
            {
                MazeInformations.Map[x, y] = MapType.CurrentPos;

                for (int i = 0; i < MazeInformations.Length; i++)
                {
                    for (int j = 0; j < MazeInformations.Width; j++)
                    {
                        if ((i >= x - 1 && i <= x + 1) && (j >= y - 1 && j <= y + 1))
                        {
                            explored[i, j] = true;
                        }
                        if (explored[i, j])
                        {
                            Console.Write((char)MazeInformations.Map[i, j]);
                        }
                        else
                        {
                            Console.Write(" ");
                        }
                    }
                    Console.WriteLine("");
                }

                MazeInformations.Map[x, y] = MapType.Free;

                if (x == MazeInformations.Length - 1 && y == MazeInformations.Sortie)
                {
                    break;
                }

                InputArrow arrow = MazeInput.GetArrow();

                if (x > 0 && arrow == InputArrow.Up && MazeInformations.Map[x - 1, y] == MapType.Free)
                {
                    x--;
                }
                if (arrow == InputArrow.Down && MazeInformations.Map[x + 1, y] == MapType.Free)
                {
                    x++;
                }
                if (arrow == InputArrow.Left && MazeInformations.Map[x, y - 1] == MapType.Free)
                {
                    y--;
                }
                if (arrow == InputArrow.Right && MazeInformations.Map[x, y + 1] == MapType.Free)
                {
                    y++;
                }

                Console.Clear();
            }
            Console.SetCursorPosition(50, 10);
            Console.WriteLine("Well Play !");
        }
コード例 #4
0
        public void DynamicPrint()
        {
            Console.Clear();

            bool[,] explored = new bool[MazeInformations.Height, MazeInformations.Width];

            int x = 0;
            int y = MazeInformations.EntryPositionWidth;

            for (int i = 0; i < MazeInformations.Height; i++)
            {
                for (int j = 0; j < MazeInformations.Width; j++)
                {
                    explored[i, j] = false;
                }
            }

            while (true)
            {
                MazeInformations.Map[x, y] = SquareType.CurrentPos;

                for (int i = 0; i < MazeInformations.Height; i++)
                {
                    for (int j = 0; j < MazeInformations.Width; j++)
                    {
                        if ((i >= x - 1 && i <= x + 1) && (j >= y - 1 && j <= y + 1))
                        {
                            explored[i, j] = true;
                        }
                        if (explored[i, j])
                        {
                            Console.Write((char)MazeInformations.Map[i, j]);
                        }
                        else
                        {
                            Console.Write(" ");
                        }
                    }
                    Console.WriteLine("");
                }

                MazeInformations.Map[x, y] = SquareType.Free;

                if (x == MazeInformations.Height - 1 && y == MazeInformations.ExitPositionWidth)
                {
                    break;
                }

                InputArrow arrow = MazeInputHandler.GetArrow();

                if (x > 0 && arrow == InputArrow.Up && MazeInformations.Map[x - 1, y] == SquareType.Free)
                {
                    x--;
                }
                if (arrow == InputArrow.Down && MazeInformations.Map[x + 1, y] == SquareType.Free)
                {
                    x++;
                }
                if (arrow == InputArrow.Left && MazeInformations.Map[x, y - 1] == SquareType.Free)
                {
                    y--;
                }
                if (arrow == InputArrow.Right && MazeInformations.Map[x, y + 1] == SquareType.Free)
                {
                    y++;
                }

                Console.Clear();
            }

            Console.WriteLine("You won !");
        }