Select Git revision
SMA.cs 1.03 KiB
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SMA : MonoBehaviour
{
public List<Agent> agents;
public Environnement environnement;
public int population = 80;
public GameObject boid;
// Start is called before the first frame update
void Start()
{
createEnvironnement();
createAgents();
}
// Update is called once per frame
void Update()
{
}
void createEnvironnement() {
//environnement = new Environnement();
//environnement = gameObject.AddComponent<Environnement>() as Environnement;
environnement = GameObject.Find("Environnement").GetComponent<Environnement>();
}
void createAgents() {
GameObject a;
for(int i=0; i<population; i++) {
a = Instantiate(boid, environnement.validPosition(), Quaternion.identity,environnement.transform) as GameObject;
agents.Add(a.GetComponent<Agent>());
}
}
}