예제 #1
0
        public WorldAutoElements WorldAutoElements()
        {
            WorldAutoElements autoElements = new WorldAutoElements();

            autoElements.Init(Content.Load <Texture2D>("Graphics/Items/Transportation/smallBoat"));
            return(autoElements);
        }
예제 #2
0
        /// <summary>
        /// Initialize the tile engine
        /// </summary>
        /// <param name="tiles">List of tiles to use</param>
        /// <param name="worldMap">Bitmap index of world-map</param>
        /// <param name="ScreenTexturecolors">Index of colors from the worldMap bitmap</param>
        /// <param name="Outofbound">Fallback texture to use on tiles not render-able</param>
        public void LoadWorld()
        {
            MapTileCollection = GSS.TextureLoader.WorldMapTiles();
            _autoElements     = GSS.TextureLoader.WorldAutoElements();
            _autoElements.SetMapTileCollection(MapTileCollection);
            worldCharacter = GSS.TextureLoader.WorldCharacter();
            worldCharacter.SetMapTileCollection(MapTileCollection);
            cloudsTileCollection = GSS.TextureLoader.Clouds();
            Minimap = GSS.TextureLoader.Minimap();
            _worldMapAnimationSet  = GSS.TextureLoader.WorldMaps();
            _minimapSpriteAnimator = new AnimationRotator <Rectangle>(_minimapLightAnimationSize, AnimationFunction.FORWARD_BACKWARD, playTimeSeconds: 2f);

            WorldInformation.mapWidth  = (int)_worldMapAnimationSet.Size.X;
            WorldInformation.mapHeight = (int)_worldMapAnimationSet.Size.Y;
            _minimapW = (int)(DisplayOutputSettings.ScreenWidth * 0.2);
            _minimapH = (int)(DisplayOutputSettings.ScreenHeight * 0.2);


            int mapCount = _worldMapAnimationSet.Length;

            _worldMapSpriteSet = new Color[mapCount][];
            for (int a = 0; a < mapCount; a++)
            {
                _worldMapSpriteSet[a] = new Color[(int)(_worldMapAnimationSet.Size.X * _worldMapAnimationSet.Size.Y)];
                _worldMapAnimationSet.GetTexture(a).GetData(_worldMapSpriteSet[a]);
            }
            _worldmapAnimator = new AnimationRotator <Color[]>(_worldMapSpriteSet, AnimationFunction.FORWARD_BACKWARD, playTimeSeconds: 3f);

            WorldInformation.worldMapCheck = _worldMapSpriteSet[0];

            _tileUsedBy = new object[WorldInformation.mapHeight * WorldInformation.mapWidth];
            //+1 is added to buffed draw the next coulomb to the right of the frame
            //1600 is screen width
            _halfHeightPlus = (int)(DisplayOutputSettings.ScreenWidth / (float)EngineSettings.TileSize) + 1;
            //900 is screen height
            //+2 is added to buffed draw the next two rows bellow the frame (one row was not enough)
            _halfWidthPlus = (int)(DisplayOutputSettings.ScreenHeight / (float)EngineSettings.TileSize) + 2;

            minimapXoff = DisplayOutputSettings.ScreenWidth - _minimapW - 10;
            RunInitWork(MapTileCollection);
            sw.Start();
        }
예제 #3
0
        /// <summary>
        /// Initialize the tile engine
        /// </summary>
        /// <param name="tiles">List of tiles to use</param>
        /// <param name="worldMap">Bitmap index of world-map</param>
        /// <param name="ScreenTexturecolors">Index of colors from the worldMap bitmap</param>
        /// <param name="Outofbound">Fallback texture to use on tiles not render-able</param>
        public void InitTiles(Texture2D[] Tiles, Texture2D[] WorldMap,
                              Texture2D[] MinimapAssets, Texture2D[] WorldClouds, World_Character WorldCharacter, WorldAutoElements AutoElements)
        {
            this._autoElements    = AutoElements;
            this.worldCharacter   = WorldCharacter;
            _worldCloudTexSet     = WorldClouds;
            minimapTex            = MinimapAssets[0];
            minimapCursorTex      = MinimapAssets[1];
            _worldMapAnimationSet = WorldMap;

            mapHeight = _worldMapAnimationSet[0].Height;
            mapWidth  = _worldMapAnimationSet[0].Width;
            _minimapW = (int)(GSS.ScreenWidth * 0.2);
            _minimapH = (int)(GSS.ScreenHeight * 0.2);

            _worldmapTilesTexSet = Tiles;
            _timeOfDayColor      = new Color(200, 200, 200);

            int mapCount = WorldMap.Length;

            _worldMapSpriteSet = new Color[mapCount][];
            for (int a = 0; a < mapCount; a++)
            {
                _worldMapSpriteSet[a] = new Color[WorldMap[a].Width * WorldMap[a].Height];
                WorldMap[a].GetData(_worldMapSpriteSet[a]);
            }
            _activeWorldMapSprite = _worldMapSpriteSet[_activeWorldMapSpriteSetIndex];
            worldMapCheck         = _worldMapSpriteSet[0];

            _tileUsedBy = new object[mapHeight * mapWidth];
            //+1 is added to buffed draw the next coulomb to the right of the frame
            //1600 is screen width
            _halfHeightPlus = (int)(GSS.ScreenWidth / (float)GSS.TileSize) + 1;
            //900 is screen height
            //+2 is added to buffed draw the next two rows bellow the frame (one row was not enough)
            _halfWidthPlus = (int)(GSS.ScreenHeight / (float)GSS.TileSize) + 2;

            minimapXoff = GSS.ScreenWidth - _minimapW - 10;
            runInitWork();
            sw.Start();
        }
예제 #4
0
        protected override void LoadContent()
        {
            GSS.spriteBatch = new SpriteBatch(GraphicsDevice);

            //Font Loading
            GSS.baseFont = Content.Load<SpriteFont>("Fonts/Arial");

            //Load Main Menu Buttons
            List<Texture2D> MainMenuBtn = new List<Texture2D>();
            MainMenuBtn.Add(Content.Load<Texture2D>("Menu/easy"));
            MainMenuBtn.Add(Content.Load<Texture2D>("Menu/medium"));
            List<Texture2D> MainMenuActiveBtn = new List<Texture2D>();
            MainMenuActiveBtn.Add(Content.Load<Texture2D>("Menu/easyActive"));
            MainMenuActiveBtn.Add(Content.Load<Texture2D>("Menu/mediumActive"));

            GSS.DefaultTex = Content.Load<Texture2D>("Graphics/Maps/WorldMap/Minimap");

            //Worldmap tex
            Texture2D[] WorldMap = new Texture2D[3];
            WorldMap[0] = Content.Load<Texture2D>("Graphics/Maps/WorldMap/BaseMap");
            WorldMap[1] = Content.Load<Texture2D>("Graphics/Maps/WorldMap/BaseMap1");
            WorldMap[2] = Content.Load<Texture2D>("Graphics/Maps/WorldMap/BaseMap2");
            Texture2D[] WorldClouds = new Texture2D[1];
            WorldClouds[0] = Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/Cloud/cloud1");

            //WorldmapTiles
            List<Texture2D> WorldMapTextures = new List<Texture2D>();
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/Land/Grass"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/Land/Sand"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/Water/Shallow"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/Water/Ocean"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/Water/DeepOcean"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/CityGround"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/CityWall"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/Harbour"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/House/Roof/RoofStoneUp"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/House/Roof/RoofStoneDown"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/House/Roof/RoofStoneRight"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/House/Roof/RoofStoneLeft"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/House/Roof/RoofStoneCornerUpRight"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/House/Roof/RoofMiddleVertical"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/House/Roof/RoofMiddleHorisontal"));
            WorldMapTextures.Add(Content.Load<Texture2D>("Graphics/Maps/WorldMap/Overlay/City/House/Roof/RoofMiddleCornerUpRight"));

            Texture2D[] MinimapAssets = new Texture2D[2]{
            Content.Load<Texture2D>("Graphics/Maps/WorldMap/Minimap"),
            Content.Load<Texture2D>("Graphics/Misc/Minimap/MinimapCursor")
            };

            //Load Character sprites
            World_Character wCharacter = new World_Character(Content.Load<Texture2D>("Graphics/People/PC/baseChar"));

            //Init Intro
            //Init Main Menu
            GSS.mainMenu.InitMenu(MainMenuBtn.ToArray(), MainMenuActiveBtn.ToArray());
            //Init In-game Menu
            GSS.ingameMenu.initMenu(Content.Load<Texture2D>("Menu/Ingame/Menu1"));
            //Init WorldMap
            WorldAutoElements autoElements = new WorldAutoElements();
            autoElements.Init(Content.Load<Texture2D>("Graphics/Items/Transportation/smallBoat"));
            GSS.world.InitTiles(WorldMapTextures.ToArray(), WorldMap, MinimapAssets, WorldClouds, wCharacter, autoElements);
            //Init Area
            //Init Battle
            //Init Scene
        }