private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.GetComponent <Character>() != null && other.gameObject == targetEnemy)
        {
            float extraDamage = parent.ApplyEffectDamage();
            float bonusDamage = parent.ApplyBonusDamage();

            damageApplyObject                = new DamageApplyClass();
            damageApplyObject.damage         = -damage;
            damageApplyObject.criticalDamage = -extraDamage;
            if (bonusDamage > 0f)
            {
                damageApplyObject.bonusDamage = -bonusDamage;
            }

            other.GetComponent <Character>().ApplyDamage(damageApplyObject);

            if (parent.SkillType == CharacterProperties.SkillType.SPLASH_DAMAGE)
            {
                parent.ApplySplashDamage(targetEnemy.transform.localPosition.x);
            }

            DestroySelf();
        }
    }
Exemplo n.º 2
0
    public override void ApplyDamage(DamageApplyClass obj)
    {
        base.ApplyDamage(obj);

        if (base.CurrentHitPoint <= 0)
        {
            if (UnitType == CharacterProperties.UnitType.BUILDING)
            {
                //globalController.GetComponent<DefenseMainHandler>().Status = "gameover";

                GlobalManager.Player winteam = this.Team == CharacterProperties.Team.LEFT ? GlobalManager.Player.Two : GlobalManager.Player.One;
                globalController.GetComponent <PuzzleHandler>().GameOver(winteam);
            }
        }
    }