コード例 #1
0
 public void FoodExist()
 {
     if (AllFish.GetSubscribers().Count() == 0)
     {
         AllFish.IsHungry();
         AllFish.NotifyObserversFood(Ohapka);
     }
 }
コード例 #2
0
ファイル: Aquarium.cs プロジェクト: ilmamen36/Aquarium
        //public void GrowWaterWood()
        //{
        //    if (Temperature >= 21 && AllFish.draw.Light)
        //    {
        //        int ran = rnd.Next(0, 2);
        //        if (something.Trees[ran].height.Count <= 10)
        //            something.Trees[ran].Grow();
        //    }
        //}

        public void GrowFish(Graphics g)
        {
            for (int i = 0; i < AllFish.residents.Count; i++)
            {
                if (AllFish.residents[i] is FishChild)
                {
                    if (AllFish.residents[i].Width == 50)
                    {
                        AllFish.residents[i].Width  = 100;
                        AllFish.residents[i].Height = 63;
                    }
                    else
                    {
                        AllFish.Add(new FishAdult(g, AllFish.residents[i].X, AllFish.residents[i].Y));
                        AllFish.residents[AllFish.residents.Count - 1].health = AllFish.residents[i].health;
                        AllFish.residents.RemoveAt(i);
                    }
                }
            }
        }
コード例 #3
0
ファイル: Aquarium.cs プロジェクト: ilmamen36/Aquarium
        public void NormConditions(Graphics g)
        {
            switch (sexSubscribers.Count)
            {
            case 0:
                for (int i = 0; i < AllFish.residents.Count(); i++)
                {
                    if (AllFish.residents[i].health > 65 && AllFish.residents[i] is FishAdult)
                    {
                        sexSubscribers.Add((AllFish.residents[i] as FishAdult));
                    }
                    if (sexSubscribers.Count == 2)
                    {
                        break;
                    }
                }
                break;

            case 1:
                sexSubscribers = new List <IsexSub>();
                break;

            case 2:
                int    TrgX = Middle((sexSubscribers[0] as LiveInAqua).X, (sexSubscribers[1] as LiveInAqua).X);
                int    TrgY = Middle((sexSubscribers[0] as LiveInAqua).Y, (sexSubscribers[1] as LiveInAqua).Y);
                double a    = sexSubscribers[0].GoSex(TrgX, TrgY);
                double b    = sexSubscribers[1].GoSex(TrgX, TrgY);
                if (a < 75)
                {
                    AllFish.Add(new FishChild(g, TrgX + 67, TrgY + 50));
                    sexSubscribers = new List <IsexSub>();
                    sexflag        = false;
                }
                break;
            }
        }
コード例 #4
0
ファイル: Aquarium.cs プロジェクト: ilmamen36/Aquarium
 public void Add(LiveInAqua obj)
 {
     AllFish.Add(obj);
 }
コード例 #5
0
 public void AddFish(LiveInAqua fish)
 {
     AllFish.Add(fish);
 }