Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        if (numberOfChickens == 0)
        {
            numberOfChickens = 20;
        }

        chickens = new List <GameObject>();

        audioSourceDie  = GetComponents <AudioSource>()[0];
        audioSourceRush = GetComponents <AudioSource>()[1];
        audioSourceIDLE = GetComponents <AudioSource>()[2];

        ListAudiosRushing = new List <AudioClip>();
        ListAudiosDying   = new List <AudioClip>();

        ListAudiosRushing.Add(Resources.Load("Audio/Gallina rushing 1") as AudioClip);
        ListAudiosRushing.Add(Resources.Load("Audio/Gallina rushing 2") as AudioClip);
        ListAudiosRushing.Add(Resources.Load("Audio/Gallina rushing") as AudioClip);
        ListAudiosDying.Add(Resources.Load("Audio/Gallina dying 1") as AudioClip);
        ListAudiosDying.Add(Resources.Load("Audio/Gallina dying 2") as AudioClip);

        AudioIDLE     = Resources.Load("Audio/Gallina IDLE") as AudioClip;
        AudioGameOver = Resources.Load("Audio/Game over") as AudioClip;

        for (int i = 0; i < numberOfChickens; i++)
        {
            GameObject chicken = Instantiate(ChickenPrefab, new Vector3(Random.Range(-x, x), Random.Range(-y, y)), Quaternion.identity);
            ChickenAI  ai      = chicken.GetComponent <ChickenAI>();
            ai.destroyed  += Ai_destroyed;
            ai.feedSpoted += Ai_feedSpoted;
            chickens.Add(chicken);
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        //GameObject Chicken = GameObject.("Chicken complete (1)");

        h = chicken.GetComponent <ChickenAI> ();
    }