Inheritance: IDisposable
Exemplo n.º 1
0
        public void HookToGame(GameState state, int ti, Camera camera)
        {
            // Get The Team To Be Visualized
            teamIndex = ti;
            teamInput = state.teams[teamIndex].Input;
            SelectionCircleTexture = LoadTexture2D(@"Content\Textures\SelectionCircle.png");

            // Get The Camera
            Camera = camera;

            // Create The Map
            CreateVoxGeos(state.VoxState.World.Atlas);
            Map = new VoxMap(this, state.CGrid.numCells.X, state.CGrid.numCells.Y);
            // TODO: Parse This In
            VoxMapConfig vmc = new VoxMapConfig();
            vmc.VoxState = state.VoxState;
            vmc.TexVoxMap = @"voxmap.png";
            vmc.RootPath = state.LevelGrid.Directory.FullName;
            vmc.FXFile = @"FX\Voxel";
            Map.Build(gManager, cManager, vmc);

            Camera.MoveTo(state.CGrid.size.X * 0.5f, state.CGrid.size.Y * 0.5f);
            fxMap.MapSize = state.CGrid.size;
            pRenderer.MapSize = state.CGrid.size;

            // Hook FOW
            state.CGrid.OnFOWChange += OnFOWChange;
            Minimap.Hook(this, state, ti);

            // Load Particles
            // TODO: Config
            ParticleOptions pOpt = ZXParser.ParseFile(@"Content\FX\Particles\Particle.conf", typeof(ParticleOptions)) as ParticleOptions;
            pRenderer.Load(this, pOpt);

            // Load Team Visuals
            for(int i = 0; i < state.teams.Length; i++) {
                if(state.teams[i] == null) continue;
                LoadTeamVisuals(state, i);
            }

            // Set FOW
            for(int y = 0; y < Map.FogOfWarTexture.Height; y++) {
                for(int x = 0; x < Map.FogOfWarTexture.Width; x++) {
                    switch(state.CGrid.GetFogOfWar(x, y, teamIndex)) {
                        case FogOfWar.Active:
                            Map.SetFOW(x, y, 1f);
                            break;
                        case FogOfWar.Passive:
                            Map.SetFOW(x, y, 0.5f);
                            break;
                        case FogOfWar.Nothing:
                            Map.SetFOW(x, y, 0f);
                            break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        //public SpriteFont CreateFont(string fontName, int size, int spacing = 0, bool useKerning = true, string style = "Regular", char defaultChar = '*', int cStart = 32, int cEnd = 126) {
        //    IDisposable disp;
        //    SpriteFont f = XNASpriteFont.Compile(G, fontName, size, out disp, spacing, useKerning, style, defaultChar, cStart, cEnd);
        //    toDispose.Add(disp);
        //    return f;
        //}
        //public SpriteFont CreateFont(string fontName, int size, out IDisposable disp, int spacing = 0, bool useKerning = true, string style = "Regular", char defaultChar = '*', int cStart = 32, int cEnd = 126) {
        //    SpriteFont f = XNASpriteFont.Compile(G, fontName, size, out disp, spacing, useKerning, style, defaultChar, cStart, cEnd);
        //    toDispose.Add(disp);
        //    return f;
        //}
        #endregion

        public void HookToGame(GameState state, int ti, Camera camera)
        {
            // Get The Team To Be Visualized
            teamIndex = ti;
            teamInput = state.teams[teamIndex].Input;
            SelectionCircleTexture = LoadTexture2D(@"Content\Textures\SelectionCircle.png");

            // Get The Camera
            Camera = camera;

            // Create The Map
            CreateVoxGeos(state.VoxState.World.Atlas);
            Map = new VoxMap(this, state.CGrid.numCells.X, state.CGrid.numCells.Y);
            // TODO: Parse This In
            VoxMapConfig vmc = new VoxMapConfig();

            vmc.VoxState  = state.VoxState;
            vmc.TexVoxMap = @"voxmap.png";
            vmc.RootPath  = state.LevelGrid.Directory.FullName;
            vmc.FXFile    = @"FX\Voxel";
            Map.Build(gManager, cManager, vmc);

            Camera.MoveTo(state.CGrid.size.X * 0.5f, state.CGrid.size.Y * 0.5f);
            fxMap.MapSize     = state.CGrid.size;
            pRenderer.MapSize = state.CGrid.size;

            // Hook FOW
            state.CGrid.OnFOWChange += OnFOWChange;
            Minimap.Hook(this, state, ti);


            // Load Particles
            // TODO: Config
            ParticleOptions pOpt = ZXParser.ParseFile(@"Content\FX\Particles\Particle.conf", typeof(ParticleOptions)) as ParticleOptions;

            pRenderer.Load(this, pOpt);

            // Load Team Visuals
            for (int i = 0; i < state.teams.Length; i++)
            {
                if (state.teams[i] == null)
                {
                    continue;
                }
                LoadTeamVisuals(state, i);
            }

            // Set FOW
            for (int y = 0; y < Map.FogOfWarTexture.Height; y++)
            {
                for (int x = 0; x < Map.FogOfWarTexture.Width; x++)
                {
                    switch (state.CGrid.GetFogOfWar(x, y, teamIndex))
                    {
                    case FogOfWar.Active:
                        Map.SetFOW(x, y, 1f);
                        break;

                    case FogOfWar.Passive:
                        Map.SetFOW(x, y, 0.5f);
                        break;

                    case FogOfWar.Nothing:
                        Map.SetFOW(x, y, 0f);
                        break;
                    }
                }
            }
        }