示例#1
0
    private void ProcessShieldHit(ShieldDmgDealer shieldDmgDealer)
    {
        shieldHealth -= shieldDmgDealer.GetShieldDamage();
        shieldDmgDealer.Hit();

        GameObject shieldPing = Instantiate(shieldVFX, transform.position,
                                            Quaternion.Euler(180, 0, 0));

        Destroy(shieldPing, durationOfPing);
    }
示例#2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        ShieldDmgDealer shieldDmgDealer = other.gameObject.GetComponent <ShieldDmgDealer>();
        DamageDealer    damageDealer    = other.gameObject.GetComponent <DamageDealer>();

        // if (!damageDealer) { return; }

        if (shieldHealth > 0)
        {
            ProcessShieldHit(shieldDmgDealer);
        }

        if (shieldHealth <= 0)
        {
            ProcessHit(damageDealer);
        }
    }