Наследование: MonoBehaviour
Пример #1
0
    private AudioSource[] sirens; // Reference to the AudioSources of the megaphones.

    #endregion Fields

    #region Methods

    void Awake()
    {
        // Setup the reference to the alarm light.
        alarm = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent<AlarmLight>();

        // Setup the reference to the main directional light in the scene.
        mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).GetComponent<Light>();

        // Setup the reference to the additonal audio source.
        panicAudio = transform.FindChild ("secondaryMusic").GetComponent<AudioSource>();

        // Setup the reference to the alarm.
        alarmAudio = transform.FindChild ("alarmSFX").GetComponent<AudioSource>();

        // Find an array of the siren gameobjects.
        // TODO fix
        //GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag(Tags.siren);

        // Set the sirens array to have the same number of elements as there are gameobjects.
        // TODO fix
        //sirens = new AudioSource[sirenGameObjects.Length];

        // For all the sirens allocate the audio source of the gameobjects.
        // TODO fix
        /*
         * for(int i = 0; i < sirens.Length; i++)
        {
            sirens[i] = sirenGameObjects[i].GetComponent<AudioSource>();
        }
         */
    }
Пример #2
0
    private void Start()
    {
        if (restartButton)
        {
            restartButton.onClick.AddListener(Restart);
            restartButtonHolder.SetActive(false);
        }
        for (int iB = 0; iB < rList.Count; iB++)
        {
            GameObject         prefab    = rList[iB].GetPrefab();
            int                amount    = rList[iB].GetMaxAmount();
            Queue <GameObject> tempQueue = new Queue <GameObject>();
            for (int iC = 0; iC < amount; iC++)
            {
                GameObject robot = Instantiate(prefab, transform);
                //robots disable in their Start()
                Enemy enemy = robot.GetComponent <Enemy>();
                allEnemies.Add(enemy);
                tempQueue.Enqueue(robot);
            }
            robotPool.Add(prefab.name, tempQueue);
        }

        alarmLight = FindObjectOfType <AlarmLight>();
        //if (cinematic) {
        //    StartSpawnSequence();
        //}
        maxEnemyEscapes = workerImages.Count;
    }
    private AudioSource[] sirens;                                           // Reference to the AudioSources of the megaphones.


    void Awake()
    {
        // Setup the reference to the alarm light.//configura la referencia de la luz de alarma
        alarm = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent <AlarmLight>();

        // Setup the reference to the main directional light in the scene.
        //configura la referencia de la luz principal direccional en la escena.
        mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).light;

        // Setup the reference to the additonal audio source.
        //Configura la referencia de el audio source aderido.
        panicAudio = transform.Find("secondaryMusic").audio;

        // Find an array of the siren gameobjects.// Encuentra un array de los objetos de juego de sirena
        GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag(Tags.siren);

        // Set the sirens array to have the same number of elements as there are gameobjects.
        //Establece el array sirena para tener el mismo numero de elementos como de objetos de juego.
        sirens = new AudioSource[sirenGameObjects.Length];

        // For all the sirens allocate the audio source of the gameobjects.
        // Para todas la sirenas asigne el audio source en el objeto de juego.
        for (int i = 0; i < sirens.Length; i++)
        {
            sirens[i] = sirenGameObjects[i].audio;
        }
    }
    void Awake()
    {
        //  Game Controller AudioSource
        audioSource = GetComponent <AudioSource>();

        // Setup the reference to the alarm light.
        alarm = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent <AlarmLight>();

        // Setup the reference to the main directional light in the scene.
        mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).GetComponent <Light>();

        // Setup the reference to the additonal audio source.
        panicAudio = transform.Find("secondaryMusic").GetComponent <AudioSource>();

        // Find an array of the siren gameobjects.
        GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag(Tags.siren);

        // Set the sirens array to have the same number of elements as there are gameobjects.
        sirens = new AudioSource[sirenGameObjects.Length];

        // For all the sirens allocate the audio source of the gameobjects.
        for (int i = 0; i < sirens.Length; i++)
        {
            sirens[i] = sirenGameObjects[i].GetComponent <AudioSource>();
        }
    }
Пример #5
0
 void Awake()
 {
     alarmScript = GameObject.FindWithTag (Tags.AlarmLight).GetComponent<AlarmLight> ();
     mainLight = GameObject.FindWithTag (Tags.MainLight).GetComponent<Light> ();
     music = GetComponent<AudioSource> ();
     panicAudio = transform.Find ("secondary_music").GetComponent<AudioSource> ();
     GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag (Tags.Siren);
     sirens = new AudioSource[sirenGameObjects.Length];
     for (int i = 0; i<sirens.Length; i++) {
         sirens[i] = sirenGameObjects[i].GetComponent<AudioSource>();
     }
 }
Пример #6
0
    void Awake()
    {
        alarm = GameObject.FindGameObjectWithTag (Tags.alarm).GetComponent<AlarmLight> ();
        mainLight = GameObject.FindGameObjectWithTag (Tags.mainLight).light;
        panicAudio = transform.Find ("secondaryMusic").audio;
        GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag (Tags.siren);
        sirens = new AudioSource[sirenGameObjects.Length];

        for(int i = 0; i < sirens.Length; i++) {
            sirens[i] = sirenGameObjects[i].audio;
        } // end for
    }
Пример #7
0
    private void Awake()
    {
        alarm = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent<AlarmLight>();
        mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).GetComponent<Light>();
        GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag(Tags.siren);
        sirens = new AudioSource[sirenGameObjects.Length];

        for (int i = 0; i < sirens.Length; i++)
        {
            sirens[i] = sirenGameObjects[i].GetComponent<AudioSource>();
        }
    }
Пример #8
0
 private void Awake()
 {
     AssignDestinationPoints();
     gameManager     = FindObjectOfType <GameController>();
     carScript       = FindObjectOfType <ThiefCarScript>();
     alarmController = FindObjectOfType <AlarmLight>();
     soundScript     = thiefAnim.gameObject.GetComponent <Footsteps>();
     player          = GameObject.FindGameObjectWithTag("Player").transform;
     headScript      = GetComponent <HeadLookController>();
     agent           = GetComponent <NavMeshAgent>();
     col             = GetComponent <SphereCollider>();
     agent.autoTraverseOffMeshLink = false;
 }
    void Awake()
    {
        alarm = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent<AlarmLight>();
        mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).GetComponent<Light>();

        panic = GetComponent<Transform>().FindChild("secondaryMusic").GetComponent<AudioSource>();
        GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag(Tags.siren);

        sirens = new AudioSource[sirenGameObjects.Length];

        for (uint i = 0; i < sirens.Length; ++i)
            sirens[i] = sirenGameObjects[i].GetComponent<AudioSource>();
    }
Пример #10
0
 void Awake()
 {
     alarmScript = GameObject.FindWithTag(Tags.AlarmLight).GetComponent <AlarmLight>();
     mainLight   = GameObject.FindWithTag(Tags.MainLight).GetComponent <Light>();
     music       = GetComponent <AudioSource>();
     panicAudio  = transform.Find("secondary_music").GetComponent <AudioSource>();
     GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag(Tags.Siren);
     sirens = new AudioSource[sirenGameObjects.Length];
     for (int i = 0; i < sirens.Length; ++i)
     {
         sirens[i] = sirenGameObjects[i].GetComponent <AudioSource>();
     }
 }
Пример #11
0
    void Awake()
    {
        alarm = GameObject.FindGameObjectWithTag (Tags.alarm).GetComponent<AlarmLight> ();
        mainLight = GameObject.FindGameObjectWithTag (Tags.mainLight).GetComponent<Light> ();
        panicAudio = transform.Find ("SecondaryMusic").GetComponent<AudioSource> (); //Search through all children of a transform
        audio = GetComponent<AudioSource> ();
        GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag (Tags.siren);
        sirens = new AudioSource[sirenGameObjects.Length];

        for (int i = 0; i < sirenGameObjects.Length; i++) {
            sirens [i] = sirenGameObjects [i].GetComponent<AudioSource> ();
        }
    }
Пример #12
0
 private void Awake()
 {
     alarm      = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent <AlarmLight>();
     mainLight  = GameObject.FindGameObjectWithTag(Tags.mainLight).GetComponent <Light>();
     panicAudio = transform.Find("sendaryMusic").GetComponent <AudioSource>();
     audio      = GetComponent <AudioSource>();
     GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag(Tags.siren);
     sirens = new AudioSource[sirenGameObjects.Length];
     for (int i = 0; i < sirens.Length; i++)
     {
         sirens[i] = sirenGameObjects[i].GetComponent <AudioSource>();
     }
 }
    void Awake()
    {
        audio = GetComponent<AudioSource>();
        alarmAudio = transform.Find("secondaryMusic").GetComponent<AudioSource>();

        alarm = GameObject.FindGameObjectWithTag("Alarm").GetComponent<AlarmLight>();

        GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag("Siren");
        sirens = new AudioSource[sirenGameObjects.Length];

        for (int i = 0; i < sirens.Length; i++) {
            sirens[i] = sirenGameObjects[i].GetComponent<AudioSource>();
        }
    }
Пример #14
0
 void Start()
 {
     //通过tag值找到所有喇叭的对象
     GameObject[] sirens = GameObject.FindGameObjectsWithTag(Tags.Siren);
     //初始化数组
     alarmAudios = new AudioSource[sirens.Length];
     //获取AlarmLight脚本组件
     alarmLight = GameObject.FindWithTag(Tags.AlarmLight).GetComponent <AlarmLight>();
     //获取所有喇叭对象中的audiosource组件
     for (int i = 0; i < sirens.Length; i++)
     {
         alarmAudios[i] = sirens[i].GetComponent <AudioSource>();
     }
 }
    void Awake()
    {
        audio      = GetComponent <AudioSource>();
        alarmAudio = transform.Find("secondaryMusic").GetComponent <AudioSource>();

        alarm = GameObject.FindGameObjectWithTag("Alarm").GetComponent <AlarmLight>();

        GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag("Siren");
        sirens = new AudioSource[sirenGameObjects.Length];

        for (int i = 0; i < sirens.Length; i++)
        {
            sirens[i] = sirenGameObjects[i].GetComponent <AudioSource>();
        }
    }
Пример #16
0
    void Awake()
    {
        alarm     = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent <AlarmLight>();
        mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).light;

        panicAudio = this.transform.Find("secondaryMusic").audio;

        GameObject[] sirensGo = GameObject.FindGameObjectsWithTag(Tags.siren);

        sirens = new AudioSource[sirensGo.Length];
        for (int i = 0; i < sirens.Length; i++)
        {
            sirens[i] = sirensGo[i].audio;
        }
    }
Пример #17
0
 void Start()
 {
     alarmLight  = GameObject.FindWithTag(Tags.AlarmLight).GetComponent <AlarmLight>();
     normalMusic = GetComponent <AudioSource>();
     //panicMusic = GetComponentInChildren<AudioSource>();
     panicMusic = transform.GetChild(0).GetComponent <AudioSource>();
     //先找到6个喇叭对象
     GameObject[] sirenObjs = GameObject.FindGameObjectsWithTag(Tags.Siren);
     //初始化
     sirenAud = new AudioSource[sirenObjs.Length];
     //逐个填充
     for (int i = 0; i < sirenObjs.Length; i++)
     {
         sirenAud[i] = sirenObjs[i].GetComponent <AudioSource>();
     }
 }
Пример #18
0
    private AudioSource[] sirens;                                                                               // Reference to the AudioSources of the megaphones.


    void Awake()
    {
        alarm = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent <AlarmLight>();

        mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).GetComponent <Light>();

        audio = GetComponent <AudioSource> ();

        panicAudio = transform.FindChild("secondaryMusic").GetComponent <AudioSource>();

        // Find an array of the siren gameobjects.
        GameObject[] sirenGameObjects = GameObject.FindGameObjectsWithTag(Tags.siren);

        // Set the sirens array to have the same number of elements as there are gameobjects.
        sirens = new AudioSource[sirenGameObjects.Length];

        // For all the sirens allocate the audio source of the gameobjects.
        for (int i = 0; i < sirens.Length; i++)
        {
            sirens[i] = sirenGameObjects[i].GetComponent <AudioSource>();
        }
    }
Пример #19
0
 void Awake()
 {
     alarm     = GameObject.FindGameObjectWithTag(Tags.alarm).GetComponent <AlarmLight>();
     mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).light;
 }
Пример #20
0
 void Awake()
 {
     _instance = this;
     light     = GetComponent <Light>();
 }
Пример #21
0
 // Use this for initialization
 void Start()
 {
     nodes = new ArrayList ();
     light_script = alarmLight.GetComponent<AlarmLight> ();
 }
Пример #22
0
    AlarmLight light_script;      // AlarmLight script binded to the AlarmLight GameObject

    // Use this for initialization
    void Start()
    {
        nodes        = new ArrayList();
        light_script = alarmLight.GetComponent <AlarmLight> ();
    }