void Awake() { // Setting up the references. anim = GetComponent <Animator>(); bunnyMovement = GetComponent <BunnyMovement>(); bunnyRigidBody = GetComponent <Rigidbody>(); }
private void CreateBoomerangBodies() { if (boomerangList != null) { for (int i = 0; i < boomerangList.Count; i++) { GameObject.Destroy(boomerangList[i].gameObject); //Es carrega tots els boomerangs existents } } boomerangList = new List <BunnyMovement>(); //Itera per crear tots els nous boo merangs for (int i = 0; i < populationSize; i++) { BunnyMovement boomer = ((GameObject)Instantiate(boomerPrefab, new Vector3(UnityEngine.Random.Range(-40f, 40f), 0, UnityEngine.Random.Range(-40f, 40f)), boomerPrefab.transform.rotation)).GetComponent <BunnyMovement>(); //Crea un boomerang i en pilla el punter a la mateix linia //boomer.Init(nets[i], foodVector, elephantVector); //Valors inicials del boomerang, com la neural net que usa o on esta l'hexagon boomerangList.Add(boomer); } }
private void Start() { bunnyMovement = bunnyPrefab.gameObject.GetComponent <BunnyMovement>(); }