Inheritance: Character
Example #1
0
        internal Boolean HasEaten()
        {
            Theseus theseus = myGame.GetTheseus();

            if (Coordinate == theseus.Coordinate)
            {
                return(true);
            }
            return(false);
        }
Example #2
0
        internal void Hunt()
        {
            Theseus theseus = myGame.GetTheseus();

            for (int i = 0; i < 2; i++)
            {
                // if minotaur's X value isn't the same as theseus'
                if (Coordinate.X != theseus.Coordinate.X)
                {
                    HuntHorizontal();
                }
                else if (Coordinate.X == theseus.Coordinate.X)
                {
                    HuntVertical();
                }
            }
        }
Example #3
0
        protected void SetCharacters(int theMap)
        {
            switch (theMap)
            {
            case 1:
                minotaur = SetMinotaur(1, 0);
                theseus  = SetTheseus(1, 2);
                break;

            case 2:
                theseus  = SetTheseus(2, 1);
                minotaur = SetMinotaur(0, 1);
                break;

            case 3:
                theseus  = SetTheseus(1, 1);
                minotaur = SetMinotaur(1, 0);
                break;

            case 4:
                theseus  = SetTheseus(1, 1);
                minotaur = SetMinotaur(4, 2);
                break;

            case 5:
                theseus  = SetTheseus(2, 1);
                minotaur = SetMinotaur(2, 4);
                break;

            case 6:
                theseus  = SetTheseus(0, 1);
                minotaur = SetMinotaur(4, 3);
                break;

            case 7:
                theseus  = SetTheseus(4, 5);
                minotaur = SetMinotaur(0, 5);
                break;

            default:
                break;
            }
        }
Example #4
0
        protected void HuntVertical()
        {
            Theseus theseus = myGame.GetTheseus();

            if (Coordinate.Y > theseus.Coordinate.Y)
            {
                if (!Move(Direction.Up))
                {
                    //trapped, do nothing
                }
            }
            if (Coordinate.Y < theseus.Coordinate.Y)
            {
                if (!Move(Direction.Down))
                {
                    //trapped, do nothing
                }
            }
        }
Example #5
0
        protected void HuntHorizontal()
        {
            Theseus theseus = myGame.GetTheseus();

            // if Theseus is to the left
            if (Coordinate.X > theseus.Coordinate.X)
            {
                if (!Move(Direction.Left))
                {
                    HuntVertical();
                }
            }
            if (Coordinate.X < theseus.Coordinate.X)
            {
                if (!Move(Direction.Right))
                {
                    HuntVertical();
                }
            }
        }
Example #6
0
 protected void SetCharacters(int theMap)
 {
     switch (theMap)
     {
         case 1:
             minotaur = SetMinotaur(1, 0);
             theseus = SetTheseus(1, 2);
             break;
         case 2:
             theseus = SetTheseus(2, 1);
             minotaur = SetMinotaur(0, 1);
             break;
         case 3:
             theseus = SetTheseus(1, 1);
             minotaur = SetMinotaur(1, 0);
             break;
         case 4:
             theseus = SetTheseus(1, 1);
             minotaur = SetMinotaur(4, 2);
             break;
         case 5:
             theseus = SetTheseus(2, 1);
             minotaur = SetMinotaur(2, 4);
             break;
         case 6:
             theseus = SetTheseus(0, 1);
             minotaur = SetMinotaur(4, 3);
             break;
         case 7:
             theseus = SetTheseus(4, 5);
             minotaur = SetMinotaur(0, 5);
             break;
         default:
             break;
     }
 }
Example #7
0
 protected void SetTheseus(Theseus newTheseus)
 {
     theseus = newTheseus;
     theseus.SetGame(this);
 }
Example #8
0
 protected Theseus SetTheseus(int newX, int newY)
 {
     theseus = new Theseus(newX, newY);
     return(theseus);
 }
Example #9
0
        public void SetTheseus()
        {
            int x = theTile.Coordinate.X;
            int y = theTile.Coordinate.Y;

            if ((Object)theseus == null)
            {
                theseus = new Theseus(x, y);
            }

            // catch: minotaur/exit on same tile
        }
Example #10
0
        /*public void Restart()
        {
            theMap = theFiler.GetMap(currentMap);
            //SetTheseus(theFiler.GetTheseus());
            //SetMinotaur(theFiler.GetMinotaur());m,
            Run();
        }

        public void NextMap()
        {
            currentMap += 1;
            theMap = theFiler.GetMap(currentMap);
            //SetTheseus(theFiler.GetTheseus());
            //SetMinotaur(theFiler.GetMinotaur());
            Run();
        }
        */
        protected void SetTheseus(Theseus newTheseus)
        {
            theseus = newTheseus;
            theseus.SetGame(this);
        }
Example #11
0
 protected Theseus SetTheseus(int newX, int newY)
 {
     theseus = new Theseus(newX, newY);
     return theseus;
 }
Example #12
0
        internal static String ObjectsToString(Tile[,] theMap, Theseus theTheseus, Minotaur theMinotaur)
        {
            string output = "";
            int width = theMap.GetLength(0);
            int height = theMap.GetLength(1);

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    output += ".";
                    if (theMap[x, y].MyWalls.HasFlag(TheWalls.North))
                    {
                        output += "___";
                    }
                    else
                    {
                        output += "   ";
                    }

                }
                output += ".\n";

                for (int x = 0; x < width; x++)
                {
                    if (x != width - 1)
                    {
                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "|   ";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "    ";
                        }

                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "| X ";
                        }
                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "| X ";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "  X ";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "  X ";
                        }
                    }

                    if (x == width - 1)
                    {
                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "|    ";
                        }
                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "|   |";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "    |";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "     ";
                        }

                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "| X  ";
                        }
                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "| X  ";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "  X  ";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "  X  ";
                        }
                    }

                    if (x == theMinotaur.Coordinate.X && y == theMinotaur.Coordinate.Y)
                    {
                        StringBuilder minoPosition = new StringBuilder(output);
                        minoPosition[output.Length - 2] = 'M';
                        output = minoPosition.ToString();
                    }
                    if (x == theTheseus.Coordinate.X && y == theTheseus.Coordinate.Y)
                    {
                        StringBuilder thesPosition = new StringBuilder(output);
                        thesPosition[output.Length - 2] = 'T';
                        output = thesPosition.ToString();
                    }
                }
                output += "\n";

            }

            // lowest row of map
            for (int x = 0; x < width; x++)
            {
                output += ".";
                if (theMap[x, height - 1].MyWalls.HasFlag(TheWalls.South))
                {
                    output += "___";
                }
                else
                {
                    output += "   ";
                }
            }
            output += ".";

            return output;
        }
Example #13
0
 protected void SetTheseus(int newX, int newY)
 {
     theseus = new Theseus(newX, newY);
 }