示例#1
0
    // Kill Agent, Will probalby have it respawn mayyybe? If you get the time brah do what you gotta do.
    void Die()
    {
        if (evade.targetedBy != null)
        {
            evade.targetedBy.GetComponent <Ship>().IndividualKilledEnemy();
        }
        // Update FitnessCalculator with fitness of this indidvidual
        FitnessCalculation fc = GameObject.Find("_SCRIPTS").GetComponent <FitnessCalculation> ();

        fc.SetFitness(individual, true);

        Destroy(gameObject);
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        fc        = GetComponent <FitnessCalculation> ();
        crossover = GetComponent <CrossoverAlgorithm> ();

        spawnLocations = new Vector3[popSize];
        for (int i = 0; i < spawnLocations.Length; i++)
        {
            spawnLocations[i].x = Random.Range(-20f, 20f);
            spawnLocations[i].y = Random.Range(-20f, 20f);
            spawnLocations[i].z = 0;
        }
        // Debug.Log ("Population Script: Loaded");
        Initialize(popSize, true);
    }
示例#3
0
 // Public Initialze Indivdual. Declare Genes.
 public void Initialize()
 {
     fitnessCalculator = GameObject.Find("_SCRIPTS").GetComponent <FitnessCalculation> ();
     ship = GetComponent <Ship> ();
 }
示例#4
0
 // Use this for initialization
 void Start()
 {
     fc = GetComponent <FitnessCalculation> ();
 }