protected override Entity createEnemy(EntitiyType type)
        {
            TextureManager texManager = TextureManager.Textures;

            Entity e;

            switch (type)
            {
            case EntitiyType.Grunt1:
                e = new Grunt1(Vector2.Zero, texManager.Get(TextureManager.Type.Grunt1));
                break;

            case EntitiyType.Grunt2:
                e = new Grunt2(Vector2.Zero, texManager.Get(TextureManager.Type.Grunt2));
                break;

            case EntitiyType.Boss1:
                e = new Boss1(Vector2.Zero, texManager.Get(TextureManager.Type.Boss1));
                break;

            case EntitiyType.Boss2:
                e = new Boss2(Vector2.Zero, texManager.Get(TextureManager.Type.Boss2));
                break;

            case EntitiyType.Player:
                e        = new Player(Vector2.Zero, texManager.Get(TextureManager.Type.SpaceshipPlayer), 7.0f);
                e.Health = 5;
                break;

            default:
                throw new Exception("Warning: StandardEnemyFactory: Request for unsupported Enemy");
            }
            return(e);
        }
예제 #2
0
        /// <summary>
        /// Subscribe the EventManager to all Sprite * Events
        /// </summary>
        /// <param name="e"></param>
        public void SubscribeAll(Sprite e)
        {
            // Every Sprite has Dispose
            e.Dispose += this.eventManager.Dispose;

            // Entitiy Specific Events
            if (e is Entity)
            {
                Entity v = (Entity)e;
                v.Collided += this.eventManager.Collided;
            }

            // BulletSpawner Specific Events
            if (e is BulletSpawner)
            {
                BulletSpawner b = (BulletSpawner)e;
                b.Fire += this.eventManager.Fire;
            }

            if (e is Boss2)
            {
                Boss2 b = (Boss2)e;
                b.NewSpawner += this.eventManager.ReadyEnqueue;
            }

            if (e is Boss1)
            {
                Boss1 b = (Boss1)e;
                b.NewSpawner += this.eventManager.ReadyEnqueue;
            }
        }