Beispiel #1
0
        /// <summary>
        /// Creates a new Map object, which solely draws its background
        /// texture and if debugLine is given the grid. If initialResources isn't
        /// further specified there will be no resources on the map.
        /// </summary>
        /// <param name="backgroundTexture">The background texture of the map</param>
        /// <param name="width">The width of the map in number of tiles</param>
        /// <param name="height">The height of the map in number of tiles</param>
        /// <param name="fow">The FoW of the Map</param>
        /// <param name="camera">The camera of the window</param>
        /// <param name="director">A reference to the Director</param>
        public Map(Texture2D backgroundTexture,
                   int width,
                   int height,
                   FogOfWar fow,
                   Camera camera,
                   ref Director director)
        {
            mWidth  = width;
            mHeight = height;

            mCamera = camera;

            mBackgroundTexture = backgroundTexture;

            mFow = fow;

            var initialResources = director.GetStoryManager.Level is TechDemo ? null : ResourceHelper.GetRandomlyDistributedResources(50, ref director);


            mCollisionMap = new CollisionMap();
            mStructureMap = new StructureMap(fow, ref director);
            mResourceMap  = new ResourceMap(initialResources, director);

            director.GetStoryManager.StructureMap = mStructureMap;
        }
Beispiel #2
0
 public void ReloadContent(Texture2D background, Camera camera, FogOfWar fow, ref Director dir, ContentManager content, UserInterfaceScreen ui)
 {
     mBackgroundTexture = background;
     mCamera            = camera;
     mFow = fow;
     //ADD ALL THE THINGS TO THE CAMERA AND THE FOW
     mStructureMap.ReloadContent(content, mFow, ref dir, mCamera, this, ui);
     mCollisionMap.ReloadContent();
     mResourceMap.ReloadContent(ref dir);
 }
Beispiel #3
0
        /// <summary>
        /// Creates a new structure map which holds all the structures currently in the game.
        /// </summary>
        public StructureMap(FogOfWar fow, ref Director director)
        {
            director.GetInputManager.AddMousePositionListener(this);

            mFow = fow;

            mPlatformToGraphId    = new Dictionary <PlatformBlank, int>();
            mGraphIdToGraph       = new Dictionary <int, Graph.Graph>();
            mGraphIdToEnergyLevel = new Dictionary <int, int>();

            mDirector = director;

            mStructuresToPlace = new LinkedList <StructurePlacer>();
            mPlatforms         = new LinkedList <PlatformBlank>();
            mRoads             = new LinkedList <Road>();
        }
Beispiel #4
0
        public void ReloadContent(ContentManager content, FogOfWar fow, ref Director dir, Camera camera, Map map, UserInterfaceScreen ui)
        {
            mFow      = fow;
            mDirector = dir;
            dir.GetInputManager.AddMousePositionListener(this);
            foreach (var placement in mStructuresToPlace)
            {
                placement.ReloadContent(camera, ref dir, map);
            }

            foreach (var platform in mPlatforms)
            {
                platform.ReloadContent(content, ref dir);
            }
            //Update uis graphid dictionary
            ui.GraphIdToGraphStructureDict = mGraphIdToGraph;

            foreach (var roads in mRoads)
            {
                roads.ReloadContent(ref dir);
            }
        }