コード例 #1
0
ファイル: AnimPlayer.cs プロジェクト: Gerjo/Gravwar
        public void checkBulletCollision(Weapons.AbstractBullet bullet)
        {
            if (bullet.isDestroyed) return;

            if (currentHitbox.Intersects(bullet.getHitBox()) && isDead == false)
            {
                // Inflict damage on this player. The removeHealth function returns if this player died.
                if (!bullet.isHit)
                {
                    if (removeHealth(bullet.damageScore))
                    {
                        bullet.ownerPlayer.playerKills++;
                    }
                    bullet.isHit = true;
                }
                if (bullet.isFlameable == false)
                    bullet.isDestroyed = true;
                else
                {
                    // Reset the counter for when the player was last hit by a bullet.
                    lastHitCount = 0;
                    bullet.isExploding = true;
                    // Mark the bullet as destroyed (The corresponding weaponManager will delete the bullet).
                    bullet.runRemovalCounter = true;
                }
            }
        }