コード例 #1
0
    protected override void OnCollide(projectileAI projectile)
    {
        hitCount++;

        if (hitCount == 2)
            health = 0;

        Destroy(projectile.gameObject);
    }
コード例 #2
0
ファイル: EnemyAI.cs プロジェクト: CST4D/WindowsDefender
    /// <summary>
    /// When a projectile collides with this enemy object
    /// </summary>
    protected virtual void OnCollide(projectileAI projectile)
    {
        int damage;

        if ((damage = projectile.damage - armour) > 0)
            health -= damage;

        aSource.PlayOneShot(hitSound, 0.9f);

        if (drainDuration <= 0)
        {
            drainDamage = projectile.drainDamage;
            drainSpd = projectile.drainSpd;
            drainDuration += projectile.drainDuration;
        }

        Destroy(projectile.gameObject);
    }