Exemplo n.º 1
0
        public static AEnemyObject EnemyFactory(PigTypes types, SpriteGenerator opbouwSprites, int oneBlockStep, List <IRoomLayout> worlds, int a, int x, int y, Dictionary <TextTypes, SpriteFont> spriteFonts, int enemyHearts, int enemyAttackDamage)
        {
            var type = Type.GetType("Pigit.Objects.NPCObjects." + types.ToString(), throwOnError: false);

            if (type != null)
            {
                return((AEnemyObject)Activator.CreateInstance(type, opbouwSprites.GetSpritePig(12), new Vector2(y * oneBlockStep, x * oneBlockStep), (MoveTypes)(worlds[a].Enemys[x, y] % 10), spriteFonts, enemyHearts, enemyAttackDamage));
            }
            return(null);
        }
        public ANPCObject(PigTypes pigType, SpriteGenerator sprites, Vector2 beginPosition, Dictionary <TextTypes, SpriteFont> spriteFonts, MoveTypes moveTypes)
        {
            text = new EnemyText(spriteFonts);
            switch (pigType)
            {
            case PigTypes.Standard:
                this.sprites = sprites.GetSpritePig(12);
                break;

            default:
                break;
            }
            Positie           = beginPosition;
            this.MovementType = moveTypes;
            CheckSprites();
        }