Exemple #1
0
        public void GiveEnemiesPositions()
        {
            for (int i = 0; i < EnemyNPCs.Count; i++)
            {
                bool passable = false;
                bool occupied = false;

                do
                {
                    int sampleX = Gamestate.RandObj.Next(0, C.TilesPerRow);
                    int sampleY = Gamestate.RandObj.Next(0, C.TilesPerRow);

                    if (MapGrid[sampleX, sampleY].Passable == true)
                    {
                        if (MapGrid[sampleX, sampleY].ID != 3 && MapGrid[sampleX, sampleY].ID != 4)
                        {
                            if (i == 0)
                            {
                                EnemyPosX.Add(sampleX);
                                EnemyPosY.Add(sampleY);
                                passable = true;
                            }
                            else
                            {
                                for (int e = 0; e < EnemyPosX.Count; e++)
                                {
                                    if (EnemyPosX[e] == sampleX && EnemyPosY[e] == sampleY)
                                    {
                                        occupied = true;
                                    }
                                }

                                if (occupied == false)
                                {
                                    EnemyPosX.Add(sampleX);
                                    EnemyPosY.Add(sampleY);
                                    passable = true;
                                }

                                occupied = false;
                            }
                        }
                    }
                } while (passable == false);
            }
        }
Exemple #2
0
        public void DungeonTransition()
        {
            // Called when the player has completed a layer of a dungeon
            // Examples: reaching the dungeon exit; using an item

            UpdateDungeonValues();
            InitiateNewLocation();

            GenerateItemList();

            RemoveAllPassives();

            EnemyNPCs.Clear();
            EnemyPosX.Clear();
            EnemyPosY.Clear();

            Gamestate.TimeSinceMerchantSpawn = Gamestate.TimeSinceMerchantSpawn + 1;

            CreateListsOfNPCs();

            Gamestate.Location = Location.Name;
        }