コード例 #1
0
ファイル: Island.cs プロジェクト: Dreamer65/IslandOfWolfs
        public void AddFWolf(int x, int y)
        {
            IAnimal animal = new FWolf(cells[x, y], _random);

            Animals.Add(animal);
            animal.Death += Animal_Die;
        }
コード例 #2
0
ファイル: Island.cs プロジェクト: Dreamer65/IslandOfWolfs
        public void Renovate(int rabitsCount, int FWolfsCount, int MWolfsCount)
        {
            Cell    tmp;
            IAnimal animal;

            _rabitsCount = rabitsCount;
            _MWolfsCount = MWolfsCount;
            _FWolfsCount = FWolfsCount;

            for (int i = 0; i < rabitsCount; i++)
            {
                tmp = RandomEmptyCell();
                if (tmp != null)
                {
                    animal = new Rabit(tmp, _random);
                    Animals.Add(animal);
                    animal.Death += Animal_Die;
                }
            }

            for (int i = 0; i < FWolfsCount; i++)
            {
                tmp = RandomEmptyCell();
                if (tmp != null)
                {
                    animal = new FWolf(tmp, _random);
                    Animals.Add(animal);
                    animal.Death += Animal_Die;
                }
            }

            for (int i = 0; i < MWolfsCount; i++)
            {
                tmp = RandomEmptyCell();
                if (tmp != null)
                {
                    animal = new MWolf(tmp, _random);
                    Animals.Add(animal);
                    animal.Death += Animal_Die;
                }
            }
        }