コード例 #1
0
 public void MakeAgentsJump()
 {
     foreach (GameObject agent in agents)
     {
         AgentJumper jumperScript = agent.GetComponent <AgentJumper>();
         if (jumperScript)
         {
             jumperScript.performJump();
         }
     }
 }
コード例 #2
0
 public bool AllAgentsTouchedDeadZone()
 {
     foreach (GameObject agent in agents)
     {
         AgentJumper jumper = agent.GetComponent <AgentJumper>();
         if (jumper && (jumper.ticksInDeadZone == 0))
         {
             return(false);
         }
     }
     return(true);
 }
コード例 #3
0
    public bool AreAgentsJumping()
    {
        foreach (GameObject agent in agents)
        {
            AgentJumper jumperScript = agent.GetComponent <AgentJumper>();
            if (jumperScript && jumperScript.isJumping)
            {
                return(true);
            }
        }

        return(false);
    }
コード例 #4
0
    public void UpdateAgentJumpingStrength(List <DNA <float> > genes)
    {
        for (int i = 0; i < genes.Count; i++)
        {
            float       combinedJumpStrength = 0;
            DNA <float> dna   = genes[i];
            GameObject  agent = agents[i];

            for (int j = 0; j < dna.Genes.Length; j++)
            {
                combinedJumpStrength += dna.Genes[j];
            }

            AgentJumper script = agent.GetComponent <AgentJumper>();
            if (script)
            {
                script.jumpStrength = combinedJumpStrength;
            }
        }
    }