Ejemplo n.º 1
0
 void Awake()
 {
     if (instance == null) {
         instance = this;
         DontDestroyOnLoad(gameObject);
     } else {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 3
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (!col.CompareTag("Player"))
        {
            return;
        }

        BeeCountStore.GetInstance().beesAtStartOfLevel = GameObject.Find("bees").transform.childCount;

        audioSource.Play();

        StartCoroutine(WaitAndLoadNextScene());
    }
Ejemplo n.º 4
0
    void Start()
    {
        BeeCountStore store      = BeeCountStore.GetInstance();
        Transform     beesParent = GameObject.Find("bees").transform;

        for (int i = 0; i < store.beesAtStartOfLevel; i++)
        {
            Vector3    beePosition = new Vector3(transform.position.x + (Random.value * 2 - 1), transform.position.y + (Random.value * 2 - 1), 0f);
            GameObject bee         = (GameObject)Instantiate(beePrefab, beePosition, Quaternion.identity);
            bee.transform.parent = beesParent;
            bee.GetComponent <AudioSource>().clip = beeHitSounds[Random.Range(0, beeHitSounds.Length)];
        }

        BeeCountUpdater.GetInstance().UpdateBeeCount();
    }