Beispiel #1
0
    // Called when script is loaded
    void Awake()
    {
        // Checks to make sure gems are persisted
        Debug.Log(gemManager.GetGemOne().ToString() + " successfully persisted");
        Debug.Log(gemManager.GetGemTwo().ToString() + " successfully persisted");

        spawn = GameObject.FindGameObjectWithTag("SpecialAttack");

        foreach (Transform childTransform in gameObject.transform.Find("Shot Spawn"))
        {
            if (childTransform.gameObject.CompareTag(gemManager.GetGemOne().ToString()))
            {
                gemOne = childTransform.gameObject;
            }
            if (childTransform.gameObject.CompareTag(gemManager.GetGemTwo().ToString()))
            {
                gemTwo = childTransform.gameObject;
            }
        }

        // Sets all gem game objects to be inactive except selected gems
        foreach (Transform child in spawn.transform)
        {
            child.gameObject.SetActive(false);
        }
        gemOne.SetActive(true);
        gemTwo.SetActive(true);
        gemTwo.GetComponent <GenericGem>().isCurrent = false;

        // Current selection starts with gemOne
        gemManager.SetCurrentGem(gemManager.GetGemOne());

        // Updates which gem's abilities the staff is using
        updateStaff(gemOne);
    }
Beispiel #2
0
    void Awake()
    {
        if (fire)
        {
            GemSelection.SetGemOne(Gem.Red);
            GemSelection.SetGemTwo(Gem.Green);
        }
        else if (lightning)
        {
            GemSelection.SetGemOne(Gem.Yellow);
            GemSelection.SetGemTwo(Gem.Green);
        }
        else if (ice)
        {
            GemSelection.SetGemOne(Gem.Blue);
            GemSelection.SetGemTwo(Gem.Green);
        }

        spawn  = GameObject.FindGameObjectWithTag("SpecialAttack");
        gemOne = GameObject.FindGameObjectWithTag(GemSelection.GetGemOne().ToString());

        foreach (Transform child in spawn.transform)
        {
            child.gameObject.SetActive(false);
        }
        gemOne.SetActive(true);

        //current selection starts with gemOne
        GemSelection.SetCurrentGem(GemSelection.GetGemOne());
    }