Esempio n. 1
0
        public void StartEditor()
        {
            Game.I.Screen = Screens.editor;

            Game.I.editingPlatform = new IGPos(1, 1, 0);
            Game.I.level           = Level.Load(CastlesConfigurationReader.GetConfiguration().Editor.Level);;
        }
Esempio n. 2
0
        public static Entity CreateEntity(EntityDef md)
        {
            //tohle je tu nejake divne....
            if (md.ET == EntityType.Player)
            {
                md.Class = "Castles.Player";
            }

            string cls = CastlesConfigurationReader.GetConfiguration().GetEntityByType(md.ET).Class;

            try
            {
                Type t = Assembly.GetExecutingAssembly().GetType(cls);

                Object oh = Activator.CreateInstance(t);
                Entity m  = oh as Entity;

                if (m != null)
                {
                    m.position         = new IGPos(md.X, md.Y, md.Layer);
                    m.positionOriginal = new IGPos(md.X, md.Y, md.Layer);

                    return(m);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Cannot create entity. Something went wrong:", ex);
            }

            return(null);
        }
Esempio n. 3
0
        public void Init()
        {
            this.gameStatus = GameStatus.Preparing;
            this.resourceManager = new ResourceManager();
            this.screenManager = new ScreenManager();
            this.eventManager = new EventManager();
            this.inputManager = new InputManager();
            InitExperienceTable();

            resourceManager.Init(CastlesConfigurationReader.GetConfiguration().DataFolder);
            boardOrigin = new Vector2i(500, 200);

            screenManager.StartNewGame();

            // set initial screen
            screenManager.StartEditor();
        }
Esempio n. 4
0
        public override void Die()
        {
            if (!CastlesConfigurationReader.GetConfiguration().Immortal)
            {
                base.Die();

                // play sound...

                if (lives == 0)
                {
                    Game.I.screenManager.GameOver();
                }
                else
                {
                    Game.I.level.PutMonstersToOriginalPositions();
                }
            }
        }
Esempio n. 5
0
        public void Init(string dir)
        {
            Cache_texture = new Dictionary <string, Texture>();
            Cache_audio   = new Dictionary <string, object>();
            Texts         = new Dictionary <string, string>();

            this.gameDirectory = dir;

            // load all from config
            if (CastlesConfigurationReader.GetConfiguration().Gfxs != null)
            {
                foreach (Gfx pgfx in CastlesConfigurationReader.GetConfiguration().Gfxs)
                {
                    Load_Texture(pgfx);
                }
            }

            // texts
            Texts.Add("WINDOW_CAPTION", "test window caption");

            //// animated sprites...
            //Load_Sprite("TestAnim.png", "TestAnim", 32, 32, 0);

            //// monsters
            //Load_Sprite("TreeTough.png", "TreeTough", 61, 65, 0);
            //Load_Sprite("TreeFeeding.png", "TreeFeeding", 32, 64, 0);
            //Load_Sprite("TreeDead.png", "TreeDead", 61, 63, 0);
            //Load_Sprite("Thuja.png", "Thuja", 29, 60, 0);
            //Load_Sprite("Snowman.png", "Snowman", 34, 35, 0);
            //Load_Sprite("BooobakMonster.png", "BooobakMonster", 32, 35, 0);

            //// player sprites ... load them
            //Load_Sprite("player.png", "player_walk_right_down", 48, 64, 2);
            //Load_Sprite("player.png", "player_walk_right_up", 48, 64, 3);
            //Load_Sprite("player.png", "player_walk_left_down", 48, 64, 0);
            //Load_Sprite("player.png", "player_walk_left_up", 48, 64, 1);
        }