ScrollingShooter.GameObjectManager.CreateShield C# (CSharp) Méthode

CreateShield() public méthode

Factory method for spawning a shield
public CreateShield ( ShieldType shieldType, Vector2 position, PlayerShip PlayerShip ) : ScrollingShooter.Shield
shieldType ShieldType The type of shield to create
position Vector2 Position of the shield in the game world
PlayerShip PlayerShip The Player
Résultat ScrollingShooter.Shield
        public Shield CreateShield(ShieldType shieldType, Vector2 position,
            PlayerShip PlayerShip)
        {
            Shield shield;
            uint id = NextID();

            switch (shieldType)
            {
                case ShieldType.EightBallShield:
                    shield = new EightBallShield(id, content, position, PlayerShip);
                    break;
                default:
                    throw new NotImplementedException("EightBallShield failed.");
            }

            shield.ObjectType = ObjectType.Shield;
            QueueGameObjectForCreation(shield);
            return shield;
        }