Example #1
0
    // Use this for initialization
    void Start()
    {
        selected    = 0;
        speed       = 0;
        pins        = GetComponentsInChildren <pinController>();
        anim        = GetComponent <Animator>();
        firstPerson = FindObjectOfType <FirstPersonController>();
        lanterna    = FindObjectOfType <Lanterna>();

        // Building new random order
        order = new Stack <int>();
        int rand;

        while (order.Count != pins.Length)
        {
            rand = (int)Random.Range(0f, pins.Length);
            if (!order.Contains(rand))
            {
                order.Push(rand);
            }
        }

        firstPerson.enabled = false;
        lanterna.enabled    = false;

        size = cursor.anchoredPosition.x;

        //achando audios
        acertarPino       = GameObject.Find("audioSourcePino").GetComponent <AudioSource>();
        destrancandoPorta = GameObject.Find("audioSourceDestrancandoPorta").GetComponent <AudioSource>();
    }
Example #2
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        AudioSource[] ads = GetComponents <AudioSource>();
        LigarSound    = ads[0];
        DesligarSound = ads[1];
    }