Inheritance: ACScript, IDisposable
Esempio 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;
                    }
                }
            }
        }
Esempio n. 2
0
 public static void SetInput(GameState state, int team, ACInputController ic)
 {
     state.teams[team].Input = ic;
 }
 void Player_OnNewSelection(ACInputController arg1, List<IEntity> arg2)
 {
     if(arg2 == null || arg2.Count != 1)
         UI.SelectionToggle = 0;
     else {
         var u = arg2[0] as RTSUnit;
         var b = arg2[0] as RTSBuilding;
         if(u != null) {
             UI.SelectionToggle = 1;
             UI.UnitDataPanel.SetData(u);
         }
         else if(b != null) {
             UI.SelectionToggle = 2;
             UI.BuildingDataPanel.SetData(b);
         }
     }
 }