Пример #1
0
 public void AddSheep(Ewe ewe)
 {
     if (!this.femaleSheep.Contains(ewe))
     {
         this.femaleSheep.Add(ewe);
     }
 }
Пример #2
0
    public void OnEat(GameObject sheep)
    {
        GameManager.instance.sheepEaten++;
        if (sheep.GetComponent <Ewe>())
        {
            Wolf.instance.OnFeed(20f);
            Ewe ewe = sheep.GetComponent <Ewe>();
            if (this.femaleSheep.Contains(ewe))
            {
                this.femaleSheep.Remove(ewe);
            }


            //This may agro any Rams in the area
            foreach (Ram ram in this.maleSheep)
            {
                WanderSheep ramWanderSheepScript = ram.GetComponent <WanderSheep>();
                if (ramWanderSheepScript && ramWanderSheepScript.target == sheep.transform)
                {
                    ramWanderSheepScript.StartLookingForMate();
                    ram.GetComponent <Sheep>().GetAngry(2);
                }

                if (Vector3.Distance(ram.transform.position, Wolf.instance.transform.position) < 3)
                {
                    ram.GetComponent <Sheep>().GetAngry(3);
                }
            }
        }
        else if (sheep.GetComponent <Ram>())
        {
            Wolf.instance.OnFeed(20f);
            Ram ram = sheep.GetComponent <Ram>();
            if (this.maleSheep.Contains(ram))
            {
                this.maleSheep.Remove(ram);
            }

            //Add to score
        }
        else if (sheep.GetComponent <Lamb>())
        {
            RemoveLamb(sheep.GetComponent <Lamb>());
            Wolf.instance.OnFeed(5f);
            foreach (Ram ram in this.maleSheep)
            {
                ram.GetComponent <Sheep>().GetAngry(5);
            }
        }

        Destroy(sheep);
    }