コード例 #1
0
 // Use this for initialization
 void Start()
 {
     animator = GetComponent<AgentAnimationController> ();
     animalAgent = GetComponent<AnimalAgent> ();
     navAgent = GetComponent<NavMeshAgent> ();
     Debug.Assert (Camera.main != null);
     cameraTransform = Camera.main.transform;
 }
コード例 #2
0
ファイル: Hunger.cs プロジェクト: Xaunaught/CHICKEN
 public override void Enter(AnimalAgent agent)     //Do Upon Start of Action
 {
     _target = agent.GetTarget();
     if (_target)
     {
         _supply = _target.GetComponent <ResourceManager>();
     }
 }
コード例 #3
0
 void Start()
 {
     agent = gameObject.GetComponentInChildren <AnimalAgent>();
     agent.EpisodeReset += EnvironmentReset;
     agent.TaskDone     += UpdateTask;
     targets             = gameObject.GetComponentsInChildren <BaseTarget>().ToList();
     obstacles           = gameObject.GetComponentsInChildren <Obstacle>().ToList();
 }
コード例 #4
0
ファイル: Hunger.cs プロジェクト: Xaunaught/CHICKEN
 public override void UpdateAction(AnimalAgent agents)
 {
     if (_target != null && _supply.GetSupply())
     {
         agents.NavMeshAgent.SetDestination(_target.transform.position);
     }
     else if (_supply.GetSupply() == false)
     {
         _target = agents.GetTarget();
         _supply = _target.GetComponent <ResourceManager>();
     }
     if (_target.transform.position.magnitude - agents.transform.position.magnitude < 1f)
     {
         _supply.SetSupply(false);
         agents.Hunger = 0;
     }
 }
コード例 #5
0
ファイル: Fight.cs プロジェクト: TsubameDono/Evolution
 public float FightCalculator(AnimalAgent attacker, AnimalAgent defenser)
 {
     return attacker.dna.GetAttackValue() - defenser.dna.GetDefenseValue();
 }
コード例 #6
0
ファイル: AIAction.cs プロジェクト: Xaunaught/CHICKEN
 public abstract void Exit(AnimalAgent agent);
コード例 #7
0
ファイル: AIAction.cs プロジェクト: Xaunaught/CHICKEN
 public abstract void Enter(AnimalAgent agent);
コード例 #8
0
ファイル: AIAction.cs プロジェクト: Xaunaught/CHICKEN
 public abstract void UpdateAction(AnimalAgent agents);
コード例 #9
0
ファイル: AIAction.cs プロジェクト: Xaunaught/CHICKEN
 public abstract float Evaluate(AnimalAgent agent);
コード例 #10
0
ファイル: Search.cs プロジェクト: 4rx311/ecosystem
 public Search(AnimalAgent searchingAgent)
 {
     _previousTick   = DateTime.Now;
     _searchingAgent = searchingAgent;
 }
コード例 #11
0
 void Start()
 {
     agent = GetComponent<AnimalAgent> ();
 }
コード例 #12
0
ファイル: Hunger.cs プロジェクト: Xaunaught/CHICKEN
 public override void Exit(AnimalAgent agent)     //Do Upon End of Action
 {
 }
コード例 #13
0
ファイル: SeekFood.cs プロジェクト: TsubameDono/Evolution
    public EvolutionAgent SeekBush(AnimalAgent agent, List<EvolutionAgent> percepts)
    {
        EvolutionAgent foundTarget = null;
        foreach (EvolutionAgent a in percepts)
        {
            if (a != null && a.GetComponent<IODA.IODAAgent>().agentName == "Bush"
                && a.GetComponent<Bush>() != null && a.GetComponent<Bush>().IsMature())
            {
                if (!foundTarget)
                {
                    foundTarget = a;
                }
                //compares distances
                if (Vector3.Distance(agent.transform.position, a.transform.position) <= Vector3.Distance(agent.transform.position, foundTarget.transform.position))
                {
                    foundTarget = a;
                }
            }
        }

        return foundTarget;
    }
コード例 #14
0
ファイル: SeekFood.cs プロジェクト: TsubameDono/Evolution
    private EvolutionAgent SeekAnimal(AnimalAgent agent, List<EvolutionAgent> percepts)
    {
        EvolutionAgent foundTarget = null;
        foreach (EvolutionAgent a in percepts)
        {
            if (a != null && a.GetComponent<IODA.IODAAgent>().agentName == "Animal"
                && a.GetComponent<AnimalAgent>() != null && a.GetComponent<SimpleGenome>().id != agent.genome.id)
            {
                if (!foundTarget)
                {
                    foundTarget = a;
                }
                //compares distances
                if (Vector3.Distance(agent.transform.position, a.transform.position) <= Vector3.Distance(agent.transform.position, foundTarget.transform.position))
                {
                    foundTarget = a;
                }
            }

        }

        return foundTarget;
    }
コード例 #15
0
 public override void Enter(AnimalAgent agent)     //Do Upon Start of Action
 {
 }
コード例 #16
0
 public override void UpdateAction(AnimalAgent agents)
 {
     //agents.NavMeshAgent.SetDestination(agents.WaterSource.transform.position);
 }
コード例 #17
0
 public Approach(AnimalAgent agent, string targetTagName)
 {
     _agent         = agent;
     _targetTagName = targetTagName;
 }
コード例 #18
0
ファイル: Hunger.cs プロジェクト: Xaunaught/CHICKEN
    public override float Evaluate(AnimalAgent agent)
    {
        float evaluation = agent.Hunger;

        return(evaluation);
    }
コード例 #19
0
ファイル: Flee.cs プロジェクト: 4rx311/ecosystem
 public Flee(AnimalAgent fleeingAgent, string targetTagName)
 {
     _fleeingAgent  = fleeingAgent;
     _targetTagName = targetTagName;
 }