Пример #1
0
        public void CollidedWith(IHandleCollisions gameObject)
        {
            switch (gameObject)
            {
            case Player.Player player:
                break;

            case Bullet bullet:
                _gameContext.GameAudio.PlaySoundEffect(_gameContext.AssetManager.GetSoundEffect(GameConstants.MeteorConstants.Audio.HitSoundEffectName));
                Damage(bullet.CollisionDamageAmount);
                break;

            case HealthPack healthPack:
                break;

            case Meteor meteor:
                //ToDo do something here to stop meteors overlapping
                break;

            case Enemy enemy:
                //Damage(enemy.CollisionDamageAmount);
                break;
            }
            Console.WriteLine($"{GetType()} collided with {gameObject.GetType()}");
        }
Пример #2
0
        public void CollidedWith(IHandleCollisions gameObject)
        {
            switch (gameObject)
            {
            case Player.Player player:
                //ToDo swap for appropriate sfx (enemy collided with player)
                _gameContext.GameAudio.PlaySoundEffect(_gameContext.AssetManager.GetSoundEffect(GameConstants.ProjectileConstants.Bullet3Constants.Audio.ShootSoundEffectName));
                Damage(player.CollisionDamageAmount);
                break;

            case Bullet bullet:
                //ToDo swap for appropriate sfx (enemy collided with bullet)
                _gameContext.GameAudio.PlaySoundEffect(_gameContext.AssetManager.GetSoundEffect(GameConstants.ProjectileConstants.Bullet3Constants.Audio.ShootSoundEffectName));
                Damage(bullet.CollisionDamageAmount);
                break;

            case HealthPack healthPack:
                break;

            case Enemy enemy:
                //ToDo do something here to stop enemies overlapping
                break;

            case Meteor meteor:
                //ToDo swap for appropriate sfx (enemy collided with meteor)
                //_gameContext.GameAudio.PlaySoundEffect(_gameContext.AssetManager.GetSoundEffect(GameConstants.Projectiles.Bullet3.Audio.ShootSoundEffectName));
                //Damage(meteor.CollisionDamageAmount);
                break;
            }
            Console.WriteLine($"{GetType()} collided with {gameObject.GetType()}");
        }
Пример #3
0
        public void CollidedWith(IHandleCollisions gameObject)
        {
            Console.WriteLine($"{GetType()} collided with {gameObject.GetType()}");

            //ToDo Assign and use collision layers
            if (gameObject is Player.Player)
            {
                IsActive = false;
                PlayCollectedSoundEffect();
            }
        }