void OnBestEvaluation(EvaluationBehaviour nextBest)
 {
     // Only change look-at every 3 seconds
     if (lastBestTime == 0.0f || Time.time - lastBestTime > changeDuration) {
         lastBestTime = Time.time;
         currentBest = nextBest;
     }
 }
Example #2
0
 void OnBestEvaluation(EvaluationBehaviour nextBest)
 {
     // Only change look-at every 3 seconds
     if (lastBestTime == 0.0f || Time.time - lastBestTime > changeDuration)
     {
         lastBestTime = Time.time;
         currentBest  = nextBest;
     }
 }
    void Awake()
    {
        upper = transform.Find("Cart/Upper").GetComponent<Rigidbody2D>();
        lower = transform.Find("Cart/Lower").GetComponent<Rigidbody2D>();
        wheel = transform.Find("Cart/Wheel").GetComponent<Rigidbody2D>();
        wheelJoint = wheel.transform.GetComponentInChildren<WheelJoint2D>();
        evaluation = GetComponent<EvaluationBehaviour>();

        if (json != null) {
          var genotype = NEAT.Genotype.FromJSON(JSON.Deserialize(json.text));
          Assert.AreEqual(JSON.Serialize(genotype.ToJSON()), json.text.Trim(),
        "JSON should be compatible round-trip");
          Network = NetworkPorts.FromGenotype(genotype);
        }
    }
Example #4
0
    void Awake()
    {
        upper      = transform.Find("Cart/Upper").GetComponent <Rigidbody2D>();
        lower      = transform.Find("Cart/Lower").GetComponent <Rigidbody2D>();
        wheel      = transform.Find("Cart/Wheel").GetComponent <Rigidbody2D>();
        wheelJoint = wheel.transform.GetComponentInChildren <WheelJoint2D>();
        evaluation = GetComponent <EvaluationBehaviour>();

        if (json != null)
        {
            var genotype = NEAT.Genotype.FromJSON(JSON.Deserialize(json.text));
            Assert.AreEqual(JSON.Serialize(genotype.ToJSON()), json.text.Trim(),
                            "JSON should be compatible round-trip");
            Network = NetworkPorts.FromGenotype(genotype);
        }
    }
Example #5
0
 void Awake()
 {
     textField.text = (0.0f).ToString();
     evaluation     = GetComponent <EvaluationBehaviour>();
 }
 void Awake()
 {
     textField.text = (0.0f).ToString();
     evaluation = GetComponent<EvaluationBehaviour>();
 }