예제 #1
0
 void Awake()
 {
     // Setting up the references.
     anim           = GetComponent <Animator>();
     bunnyMovement  = GetComponent <BunnyMovement>();
     bunnyRigidBody = GetComponent <Rigidbody>();
 }
예제 #2
0
    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);
        }
    }
예제 #3
0
 private void Start()
 {
     bunnyMovement = bunnyPrefab.gameObject.GetComponent <BunnyMovement>();
 }