Exemple #1
0
    public void AddPower(string powerName)
    {
        if (myPowers.Count > 0)
        {
            myPowers[myPowers.Count - 1].isReady = false;
        }
        Debug.Log(powerName);
        SuperPowerBase spb = gameObject.AddComponent(Type.GetType(powerName)) as SuperPowerBase;

        spb.isReady = true;
        myPowers.Add(spb);
    }
Exemple #2
0
 internal void Update()
 {
     //Try to cleanup oldest power
     if (myPowers.Count > 0)
     {
         SuperPowerBase p = myPowers[0];
         if (!p.isActive && !p.isReady)
         {
             myPowers.RemoveAt(0);
             Destroy(p);
             //Debug.Log("Cleaning");
         }
     }
 }
Exemple #3
0
    public void AddPower(string powerName)
    {
        if (myPowers.Count > 0)
            { myPowers[myPowers.Count - 1].isReady = false; }
        //Debug.Log(powerName);
        SuperPowerBase spb = gameObject.AddComponent(Type.GetType(powerName)) as SuperPowerBase;
        spb.isReady = true;
        myPowers.Add(spb);

        if (!powerText)
        {
            GameObject powerUI = GameObject.FindGameObjectWithTag("PowerUp");
            powerText = powerUI.transform.GetChild(playerIndex).GetComponent<Text>();
        }
        powerText.text = powerName;
    }