Esempio n. 1
0
        private void InitializePlayer(bool reset)
        {
            if (!reset)
            {
                player         = new Drawable();
                pcStats        = new cStats(Pstr, Pdex, Pcon, Pintel, Pwis, Pcha);
                pcInv          = new InventoryManager(5);
                player.texture = '@';
                player.color   = ConsoleColor.Blue;
                player.tag     = "Player";
                Point p = Point.GetRandomPointInWorld();
                player.pos.xPos = p.X;
                player.pos.yPos = p.Y;
                player.active   = true;
                player.AddComponent(new cKeyboardMoveAndCollide());
                player.AddComponent(new cStory(10));
                player.AddComponent(new cCameraFollow(this));
                player.AddComponent(pcStats);
            }
            else
            {
                if (resetWorldUp)
                {
                    player.pos.xPos = stairsDown.pos.xPos;
                    player.pos.yPos = stairsDown.pos.yPos;
                }
                else
                {
                    player.pos.xPos = stairsUp.pos.xPos;
                    player.pos.yPos = stairsUp.pos.yPos;
                }
            }

            pcInv.RegenLoot();

            player.active = true;
        }
Esempio n. 2
0
        private void InintializePrincessAndDragon(bool reset)
        {
            if (!reset)
            {
                princess         = new Drawable();
                princess.texture = 'P';
                princess.color   = ConsoleColor.Magenta;
                princess.tag     = "Princess";
                onUpdate.Add(princess.Update);

                dragon         = new Drawable();
                dragon.color   = ConsoleColor.Red;
                dragon.texture = 'D';
                dragon.tag     = "Enemy";
                dragon.active  = true;
                var enemyAI = new cEnemyAI(player, pcStats, new Point(-1, -1), "Dragon",
                                           215 + (pcStats.level * 5), 35 + (pcStats.level * 2), 10, 8 + (pcStats.level / 10), 1.5, 0.25);
                dragon.AddComponent(enemyAI);
                onUpdate.Add(dragon.Update);
            }
            int flr = Math.Abs(this.floor);

            if (flr % 10 == 0 && flr != 0)
            {
                Point p = Point.GetRandomPointInWorld();
                princess.pos.xPos = p.X;
                princess.pos.yPos = p.Y;

                p = Point.GetRandomPointInWorld();
                dragon.GetComponent <cEnemyAI>().StartingPosition = p;
                dragon.pos.xPos = p.X;
                dragon.pos.yPos = p.Y;
                dragon.active   = true;
            }
            else
            {
                princess.pos.xPos = -1;
                princess.pos.yPos = -1;
                dragon.pos.xPos   = -1;
                dragon.pos.yPos   = -1;
                dragon.active     = false;
            }

            princess.active = true;
        }
Esempio n. 3
0
        private void InitializeStairs(bool reset)
        {
            if (!reset)
            {
                Point stairPos;
                stairsUp          = new Drawable();
                stairPos          = Point.GetRandomPointInWorld();
                stairsUp.pos.xPos = stairPos.X;
                stairsUp.pos.yPos = stairPos.Y;
                stairsUp.texture  = '>';
                stairsUp.color    = ConsoleColor.White;
                stairsUp.tag      = "Stairs";
                stairsUp.active   = true;
                stairsUp.AddComponent(new cStair(true));
                onUpdate.Add(stairsUp.Update);

                stairsDown          = new Drawable();
                stairPos            = Point.GetRandomDoorPoint(new Point(stairsUp.pos.xPos, stairsUp.pos.yPos));
                stairsDown.pos.xPos = stairPos.X;
                stairsDown.pos.yPos = stairPos.Y;
                stairsDown.texture  = '<';
                stairsDown.color    = ConsoleColor.White;
                stairsDown.tag      = "Stairs";
                stairsDown.active   = true;
                stairsDown.AddComponent(new cStair(false));
                onUpdate.Add(stairsDown.Update);
            }
            else
            {
                Point stairPos = Point.GetRandomPointInWorld();
                stairsUp.pos.xPos = stairPos.X;
                stairsUp.pos.yPos = stairPos.Y;

                stairPos            = Point.GetRandomDoorPoint(new Point(stairsUp.pos.xPos, stairsUp.pos.yPos));
                stairsDown.pos.xPos = stairPos.X;
                stairsDown.pos.yPos = stairPos.Y;
            }
        }