Beispiel #1
0
        public void MoveMinotaur()
        {
            Vector2 T     = new Vector2(TheseusColumn, TheseusRow);
            Vector2 M     = new Vector2(MinotaurColumn, MinotaurRow);
            Vector2 delta = T - M;

            int[] move = null;
            if (delta.X > 0)  //Minotaur goes RIGHT
            {
                if (!(getSquare(MinotaurColumn, MinotaurRow).Right))
                {
                    Moveable minotaurMove = new Moveable(MinotaurColumn, MinotaurRow, this);
                    move = minotaurMove.GoRight();
                    currentLevel.levelLayout[MinotaurColumn, MinotaurRow].minotaurLeftSquare();
                    currentLevel.levelLayout[move[1], move[0]].minotaurEnteredSquare();
                    MinotaurRow    = move[0];
                    MinotaurColumn = move[1];
                }
            }
            if (delta.X < 0 && move == null)    //Minotaur goes LEFT
            {
                if (!getSquare(MinotaurColumn, MinotaurRow).Left)
                {
                    Moveable minotaurMove = new Moveable(MinotaurColumn, MinotaurRow, this);
                    move = minotaurMove.GoLeft();
                    currentLevel.levelLayout[MinotaurColumn, MinotaurRow].minotaurLeftSquare();
                    currentLevel.levelLayout[move[1], move[0]].minotaurEnteredSquare();
                    MinotaurRow    = move[0];
                    MinotaurColumn = move[1];
                }
            }
            if (delta.Y < 0 && move == null)   //Minotaur Moves Up
            {
                if (!getSquare(MinotaurColumn, MinotaurRow).Top)
                {
                    Moveable minotaurMove = new Moveable(MinotaurColumn, MinotaurRow, this);
                    move = minotaurMove.GoUp();
                    currentLevel.levelLayout[MinotaurColumn, MinotaurRow].minotaurLeftSquare();
                    currentLevel.levelLayout[move[1], move[0]].minotaurEnteredSquare();
                    MinotaurRow    = move[0];
                    MinotaurColumn = move[1];
                }
            }
            if (delta.Y > 0 && move == null)
            {
                if (!getSquare(MinotaurColumn, MinotaurRow).Bottom)
                {
                    Moveable minotaurMove = new Moveable(MinotaurColumn, MinotaurRow, this);
                    move = minotaurMove.GoDown();
                    currentLevel.levelLayout[MinotaurColumn, MinotaurRow].minotaurLeftSquare();
                    currentLevel.levelLayout[move[1], move[0]].minotaurEnteredSquare();
                    MinotaurRow    = move[0];
                    MinotaurColumn = move[1];
                }
            }


            CheckForMinotaurWon();
        }
Beispiel #2
0
        public void MoveTheseus(Directions direction)
        {
            switch (direction)
            {
            case Directions.UP:     //UP
                if (getSquare(TheseusColumn, TheseusRow).Top)
                {
                    break;
                }
                else
                {
                    Moveable theseusMove = new Moveable(TheseusColumn, TheseusRow, this);
                    int[]    move        = theseusMove.GoUp();
                    currentLevel.levelLayout[TheseusColumn, TheseusRow].theseusLeftSquare();
                    currentLevel.levelLayout[move[1], move[0]].theseusEnteredSquare();
                    TheseusRow    = move[0];
                    TheseusColumn = move[1];
                    MoveCount    += 1;
                    break;
                }

            case Directions.DOWN:     //DOWN
                if (getSquare(TheseusColumn, TheseusRow).Bottom)
                {
                    break;
                }
                else
                {
                    Moveable theseusMove = new Moveable(TheseusColumn, TheseusRow, this);
                    int[]    move        = theseusMove.GoDown();
                    currentLevel.levelLayout[TheseusColumn, TheseusRow].theseusLeftSquare();
                    currentLevel.levelLayout[move[1], move[0]].theseusEnteredSquare();
                    TheseusRow    = move[0];
                    TheseusColumn = move[1];
                    MoveCount    += 1;
                    break;
                }

            case Directions.LEFT:     //LEFT
                if (getSquare(TheseusColumn, TheseusRow).Left)
                {
                    break;
                }
                else
                {
                    Moveable theseusMove = new Moveable(TheseusColumn, TheseusRow, this);
                    int[]    move        = theseusMove.GoLeft();
                    currentLevel.levelLayout[TheseusColumn, TheseusRow].theseusLeftSquare();
                    currentLevel.levelLayout[move[1], move[0]].theseusEnteredSquare();
                    TheseusRow    = move[0];
                    TheseusColumn = move[1];
                    MoveCount    += 1;
                    break;
                }

            case Directions.RIGHT:     //RIGHT
                if (getSquare(TheseusColumn, TheseusRow).Right)
                {
                    break;
                }
                else
                {
                    Moveable theseusMove = new Moveable(TheseusColumn, TheseusRow, this);
                    int[]    move        = theseusMove.GoRight();
                    currentLevel.levelLayout[TheseusColumn, TheseusRow].theseusLeftSquare();
                    currentLevel.levelLayout[move[1], move[0]].theseusEnteredSquare();
                    TheseusRow    = move[0];
                    TheseusColumn = move[1];
                    MoveCount    += 1;
                    break;
                }

            case Directions.PAUSE:     //PAUSE
                MoveCount += 1;
                break;
            }
            HasTheseusEscaped();
            CheckForMinotaurWon();
        }