Example #1
0
    void OnTriggerStay(Collider other)
    {
        //if(other.gameObject.name == "Player2")

        if (other.gameObject.name == "Player2" && (Time.time >= nextUpdate))
        {
            //One issue = BOTH players gain and lose mana when function is triggered
            if (manaScript != null)
            {
                manaScript.GainMana(ManaGainAmount);
                //Debug.Log ("Mana Increase" + manaScript.GetMana());
                //isTogether = true;
                em.Play();
                em2.Play();
            }
            else
            {
                Debug.Log("Mana Null - SideBySide");
            }

            nextUpdate = Mathf.FloorToInt(Time.time) + 1;
        }

        if (other.gameObject.name == "Player1" || other.gameObject.name == "Player2")
        {
            //isTogether = true;
        }
    }
Example #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         if (manaScript != null)
         {
             manaScript.GainMana(manaIncreaseAmount);
         }
         Destroy(gameObject);
     }
 }
    void OnTriggerStay(Collider other)
    {
        if (other.tag == "Player" && (Time.time >= nextUpdate))
        {
            if (manaScript != null)
            {
                manaScript.GainMana(ManaGainAmount);
                Debug.Log("ManaIncrease");
                em.Play();
            }
            else
            {
                Debug.Log("Mana Null");
            }

            nextUpdate = Mathf.FloorToInt(Time.time) + 1;
        }
    }
Example #4
0
    void GainManaAt(List <GamePiece> gamePieces)
    {
        foreach (GamePiece piece in gamePieces)
        {
            if (piece != null)
            {
                Mana targetMana = null;

                foreach (Mana mana in m_allManas)
                {
                    if (mana.manaType == piece.type)
                    {
                        targetMana = mana;
                        break;
                    }
                }

                if (targetMana != null)
                {
                    targetMana.GainMana(manaPerPiece);
                }
            }
        }
    }