Ejemplo n.º 1
0
 void DropOrbs()
 {
     if (canUseWeapon0)
     {
         OrbScript orb = Instantiate <OrbScript>(orbPrefab, transform.position + new Vector3(Random.Range(0f, 0.5f), 0.8f, Random.Range(0f, 0.5f)), Quaternion.identity);
         orb.weaponIndex = 0;
         orb.GetComponent <MeshRenderer>().material.SetColor("_Color", grid.colors[0]);
         orb.Drop();
     }
     if (canUseWeapon1)
     {
         OrbScript orb = Instantiate <OrbScript>(orbPrefab, transform.position + new Vector3(Random.Range(0f, 0.5f), 0.8f, Random.Range(0f, 0.5f)), Quaternion.identity);
         orb.weaponIndex = 1;
         orb.GetComponent <MeshRenderer>().material.SetColor("_Color", grid.colors[1]);
         orb.Drop();
     }
     if (canUseWeapon2)
     {
         OrbScript orb = Instantiate <OrbScript>(orbPrefab, transform.position + new Vector3(Random.Range(0f, 0.5f), 0.8f, Random.Range(0f, 0.5f)), Quaternion.identity);
         orb.weaponIndex = 2;
         orb.GetComponent <MeshRenderer>().material.SetColor("_Color", grid.colors[2]);
         orb.Drop();
     }
     if (canUseWeapon3)
     {
         OrbScript orb = Instantiate <OrbScript>(orbPrefab, transform.position + new Vector3(Random.Range(0f, 0.5f), 0.8f, Random.Range(0f, 0.5f)), Quaternion.identity);
         orb.weaponIndex = 3;
         orb.GetComponent <MeshRenderer>().material.SetColor("_Color", grid.colors[3]);
         orb.Drop();
     }
 }
Ejemplo n.º 2
0
    void OnDestroy()
    {
        if (orb != null)
        {
            orb.gameObject.GetComponent <MeshRenderer>().enabled = true;
            orb.Drop();
        }

        if (!isQuitting && !grid.resetting)
        {
            GameObject rubble = Instantiate(rubblePrefab, transform.position, Quaternion.identity);
            rubble.GetComponentInChildren <SpriteRenderer>().color = transform.Find("Base").GetComponent <SpriteRenderer>().color;
        }
    }