Exemple #1
0
 void OnDestroy()
 {
     //Es crida quan es produeix l'event que Destroy del gameobject
     if (target != null)
     {
         GameController gameController = GameObject.Find("Main Camera").GetComponent <GameController> ();
         gameController.ApplyDamage(source, target);
         if (!target.isAlive())
         {
             if ((gameController.GetCurrentPlayer().statsCoreInfo.name == "Pride"))
             {
                 source.ChangeMass(2f * source.plainGrowth);
             }
             target.GetTileData().SetSlimeOnTop((Slime)null);
             target.GetPlayer().GetSlimes().Remove(target);
             Destroy(target.gameObject);
             gameController.RemoveSlime(target);
         }
         else
         {
             source.ChangeMass(source.selfDamage);
         }
         gameController.OnProjectileAnimationEnded();
     }
 }
Exemple #2
0
    public void ApplyDamage(Slime attacker, Slime defender)
    {
        int damage = attacker.getDamage;

        if (currentPlayer.statsCoreInfo.name == "Lust")
        {
            attacker.ChangeMass(attacker.selfDamage / 3f);
        }
        else if (currentPlayer.statsCoreInfo.name == "Pride")
        {
        }
        else
        {
            attacker.ChangeMass(attacker.selfDamage);
        }
        if (currentPlayer.statsCoreInfo.name == "Envy")
        {
            defender.ChangeMass((int)(-damage));
        }
        else
        {
            defender.ChangeMass((int)(-damage * (1 - defender.damageReduction)));
        }
        //FloatingTextController.CreateFloatingText (((int)-damage).ToString(),defender.transform);
    }