Exemplo n.º 1
0
        public Enemy createEnemy(int posX, int posY, Enemy.Type type)
        {
            Enemy e = null;
            switch (type)
            {
                case Enemy.Type.Goblin: // Create a smelly goblin
                    e = new Goblin(context, posX, posY);
                    break;
                case Enemy.Type.Skeleton: // Create a scary skeleton
                    e = new Skeleton(context, posX, posY);
                    break;
            }
            addEntity(100, e, e.id);

            StateChange sc = StateChangeFactory.createEntityStateChange(e.id, posX, posY, e.frameWidth, e.GetFrameTime(), e.getDefaultTexture(), e.scale, 100);
            changes.Add(sc);

            return e;
        }
Exemplo n.º 2
0
        public Enemy.Type type; // Type of enemy to create

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Create a new SpawnCommand.
        /// </summary>
        public SpawnCommand(Vector2 pos, Enemy.Type type, TimeSpan offset)
        {
            this.pos = pos;
            this.type = type;
            this.offset = offset;
        }