Example #1
0
 public void removeBuff(HPObject checkObject, string buffId)
 {
     if (checkObject is BattlePlayer)
     {
         if (playerBuffDict.ContainsKey(buffId))
         {
             playerBuffDict.Remove(buffId);
         }
         else
         {
             Debug.LogError("buff does not exist get removed");
         }
     }
     else
     {
         if (monsterBuffDict.ContainsKey(buffId))
         {
             monsterBuffDict.Remove(buffId);
         }
         else
         {
             Debug.LogError("buff does not exist get removed");
         }
     }
 }
Example #2
0
    void applyEffect(AbilityInfo info, HPObject attacker)
    {
        bool isPlayer = attacker is BattlePlayer;

        //add effect
        if (info.effectRound >= 0)
        {
            if (info.applyOnSelf == isPlayer)
            {
                addEffect(playerBuffDict, info);
            }
            else
            {
                addEffect(monsterBuffDict, info);
            }
        }
        else
        {
            //instant effect
            switch (info.effectType)
            {
            case "restoreMana":

                ((BattlePlayer)attacker).restoreMana(info.getEffectValue);
                break;

            case "healPercent":
                attacker.heal(info.getEffectValue * attacker.getMaxHp() / 100);
                break;
            }
        }
    }
Example #3
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (isServer)
        {
            HPObject hp = collision.gameObject.GetComponent <HPObject>();
            if (hp != null)
            {
                hp.AddHP(-m_att);
            }

            NetworkServer.Destroy(gameObject);
        }
        else
        {
            gameObject.SetActive(false);
        }
    }
Example #4
0
    public override void OnStartLocalPlayer()
    {
        base.OnStartLocalPlayer();

        //Debug.Log("############# OnStartLocalPlayer");

        m_mouseTransform.gameObject.SetActive(true);
        m_shieldGO.SetActive(false);
        m_playerCamera = FindObjectOfType <PlayerCamera>();
        m_playerCamera.SetPlayer(transform);
        m_scoreUI = FindObjectOfType <ScoreUI>();
        m_scoreUI.SetPlayer(this);

        m_hpObject = gameObject.GetComponent <HPObject>();

        IsTuto = PlayerPrefs.GetInt("ShowTuto", 1) == 1;
        InitPlayer();
    }
Example #5
0
 public int getBuffValue(HPObject checkObject, string buffId)
 {
     if (checkObject is BattlePlayer)
     {
         if (playerBuffDict.ContainsKey(buffId))
         {
             return(playerBuffDict[buffId].value);
         }
     }
     else
     {
         if (monsterBuffDict.ContainsKey(buffId))
         {
             return(monsterBuffDict[buffId].value);
         }
     }
     return(0);
 }
Example #6
0
 public void updateHPObject(HPObject o)
 {
     ob = o;
 }