Esempio n. 1
0
 public override void Execute(IODAAgent source, IODAAgent target)
 {
     source.SetDebug("Wiggle");
     AnimalAgent agent = source.GetComponent<AnimalAgent>() as AnimalAgent;
     agent.Wiggle();
     //Debug.Log("Wiggle");
 }
Esempio n. 2
0
    public override void Execute(IODAAgent source, IODAAgent target)
    {
        source.SetDebug("SeekFood");
        //GameObject.FindGameObjectWithTag("GameController").GetComponent<QuestManager>().SendMessage("EventListner", "fight");
        AnimalAgent agent = source.GetComponent<AnimalAgent>() as AnimalAgent;
        if (agent != null)
        {
            List<EvolutionAgent> percepts = agent.GetPerceptGetter().GetPercepts();
            EvolutionAgent foundTarget = null;
            if (agent.IsCarnivore())
            {
                foundTarget = SeekCorpse(agent, percepts);
                if (!foundTarget)
                {
                    foundTarget = SeekAnimal(agent, percepts);
                }
            }
            else
            {
                foundTarget = SeekBush(agent, percepts);
            }

            if (null != foundTarget)
            {
                source.target = foundTarget.GetComponent<IODAAgent>();
                source.SetDebug("SeekFood-Found");
            }
            else
            {
                source.target = null;
                source.SetDebug("SeekFood-Not found");

            }

            if (null != source.target)
            {
                source.SetDebug("SeekFood-MoveToward");
                agent.MoveTowards(source.target.GetComponent<EvolutionAgent>());
            }
            else
            {
                agent.Wiggle();
                source.SetDebug("SeekFood-Wiggle");

            }
        }
    }
Esempio n. 3
0
 public override void Execute(IODAAgent source, IODAAgent target)
 {
     source.SetDebug("GrowPlant");
         PlantAgent plant = (PlantAgent)source.GetComponent<PlantAgent>();
         if (!plant.IsMature())
         {
             plant.Grow(Time.deltaTime, Time.timeScale);
         }
 }
Esempio n. 4
0
    public override void Execute(IODAAgent source, IODAAgent target)
    {
        source.SetDebug("EatCorpse");
        //Get Energy from corpse
        CorpseAgent b = target.GetComponent<CorpseAgent>();
        AnimalAgent a = source.GetComponent<AnimalAgent>();

        a.GetAAC().eatingAnimation();

        a.AddToValue(EvolutionNames.AgentSelf.Energy,b.Take());
        //Debug.Log(source.ToString() + " eats a corpse (+" + b.reserve + ")");
    }
Esempio n. 5
0
    public override void Execute(IODAAgent source, IODAAgent target)
    {
        source.SetDebug("EatBush");
        //Get Energy from berries
        Bush b = target.GetComponent<Bush>();
        AnimalAgent a = source.GetComponent<AnimalAgent>();

        if (b.IsMature())
        {
            a.GetAAC().eatingAnimation();
            a.AddToValue(EvolutionNames.AgentSelf.Energy, b.Take());
            //a.RemoveBush(target.gameObject);
            //Debug.Log(source.ToString() + " eats a bush (+" + b.growMax + ")");
        }
        else
        {
            source.target = null;
        }
    }