public void DensitiesAndHeightFalloff() { var fog = new Fog(); fog.Height0 = 0; fog.Height1 = 0; fog.Density = 123; Assert.AreEqual(fog.Density, fog.Density0); Assert.AreEqual(fog.Density, fog.Density1); fog.Height0 = -77; fog.Height1 = 123; fog.Density = 0.77f; fog.HeightFalloff = 0.023f; var d0 = fog.Density0; var d1 = fog.Density1; fog.Density = 123; fog.HeightFalloff = 0.12312321312f; fog.Density0 = d0; fog.Density1 = d1; Assert.IsTrue(Numeric.AreEqual(0.77f, fog.Density)); Assert.IsTrue(Numeric.AreEqual(0.023f, fog.HeightFalloff)); fog.Density = 12; fog.HeightFalloff = 0; Assert.AreEqual(fog.Density0, fog.Density1); }
//-------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="FogNode"/> class. /// </summary> /// <param name="fog">The fog properties.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="fog"/> is <see langword="null"/>. /// </exception> public FogNode(Fog fog) { if (fog == null) throw new ArgumentNullException("fog"); _fog = fog; Shape = Shape.Infinite; }
public Appearance() { this.m_pointSpriteMode = (PointSpriteMode)null; this.m_textures = new Texture2D[2]; this.m_material = (Material)null; this.m_fog = (Fog)null; for (int index = 0; index < 2; ++index) { this.m_textures[index] = (Texture2D)null; } }
public override void SetFogMode(Fog fogMode) { FogMode newMode = modes[(int)fogMode]; if (newMode == fogTableMode) { return; } fogTableMode = newMode; device.SetRenderState(RenderState.FogTableMode, (int)fogTableMode); }
public void AddSettlement(Settlement s) { var idx = Settlements.AddSettlement(s); var t = terrain[s.Location.X, s.Location.Y]; t.City = (byte)idx; terrain[s.Location.X, s.Location.Y] = t; Fog.MarkRangeExplored(s.Location.X, s.Location.Y, 2); Fog.MarkRangeVisible(s.Location.X, s.Location.Y, 2); }
public FogSelector(Fog o) { InitializeComponent(); fog = o; using (XNAUtils utils = new XNAUtils()) { TRACK_Opacity.Value = fog.Opacity; PN_Preview.BackgroundImage = utils.ConvertToImage(fog.BackImage); LB_Opacity.Text = TRACK_Opacity.Value.ToString(); } }
public static Fog operator +(Fog a1, Fog a2) { Fog a = new Fog(); a.start = a1.start + a2.start; a.end = a1.end + a2.end; a.horizonColor = a1.horizonColor + a2.horizonColor; a.horizonColorDistance = a1.horizonColorDistance + a2.horizonColorDistance; a.zenithColor = a1.zenithColor + a2.zenithColor; return(a); }
public static Fog operator *(float scaler, Fog a1) { Fog a = new Fog(); a.start = scaler * a1.start; a.end = scaler * a1.end; a.horizonColor = scaler * a1.horizonColor; a.horizonColorDistance = scaler * a1.horizonColorDistance; a.zenithColor = scaler * a1.zenithColor; return(a); }
void Start() { Up = false; Volume volume = GameObject.Find("PostProcessing").GetComponent <Volume>(); Fog tempFog; if (volume.profile.TryGet <Fog>(out tempFog)) { fog = tempFog; } UpRange = Random.Range(10, 17); DownRange = Random.Range(1, 9); }
private void ReturnToPool(Fog fog) { fog.Destriction -= ReturnToPool; IsHaveFog = false; ReturningToPool?.Invoke(this); if (_spawner != null) { Destroy(_spawner.gameObject); } _pool.ReturnToPool(this); ReturningToPool = null; }
protected override void WriteData(ESPWriter writer) { SkyUpper.WriteBinary(writer); Fog.WriteBinary(writer); Unused1.WriteBinary(writer); Ambient.WriteBinary(writer); Sunlight.WriteBinary(writer); Sun.WriteBinary(writer); Stars.WriteBinary(writer); SkyLower.WriteBinary(writer); Horizon.WriteBinary(writer); Unused2.WriteBinary(writer); }
private void testCode() { Fog f = CurrentPlayer.Fog; sight = new LineOfSight(250, 250, 5); p_CurrentPlayer.Fog.AddLOS(sight); p_CurrentPlayer.Fog.UpdateLOS(); p_Window.MouseDown += delegate(object sender, MouseEventArgs e) { Point mousePosition = PointToClient(Cursor.Position); pathTest(mousePosition, e.Button); }; }
// ================================ internal static void Reset() { // track manager TrackManager.CurrentTrack = new TrackManager.Track(); // train manager TrainManager.Trains = new TrainManager.Train[] { }; // game Interface.ClearMessages(); RouteComment = ""; RouteImage = ""; RouteAccelerationDueToGravity = 9.80665; RouteRailGauge = 1.435; RouteInitialAirPressure = 101325.0; RouteInitialAirTemperature = 293.15; RouteInitialElevation = 0.0; RouteSeaLevelAirPressure = 101325.0; RouteSeaLevelAirTemperature = 293.15; Stations = new Station[] { }; Sections = new Section[] { }; BufferTrackPositions = new double[] { }; MarkerTextures = new int[] { }; PointsOfInterest = new PointOfInterest[] { }; BogusPretrainInstructions = new BogusPretrainInstruction[] { }; TrainName = ""; TrainStart = TrainStartMode.EmergencyBrakesNoAts; PreviousFog = new Fog(0.0f, 0.0f, new Color24(128, 128, 128), 0.0); CurrentFog = new Fog(0.0f, 0.0f, new Color24(128, 128, 128), 0.5); NextFog = new Fog(0.0f, 0.0f, new Color24(128, 128, 128), 1.0); NoFogStart = (float)World.BackgroundImageDistance + 200.0f; NoFogEnd = 2.0f * NoFogStart; InfoTotalTriangles = 0; InfoTotalTriangleStrip = 0; InfoTotalQuads = 0; InfoTotalQuadStrip = 0; InfoTotalPolygon = 0; // object manager ObjectManager.Objects = new ObjectManager.StaticObject[16]; ObjectManager.ObjectsUsed = 0; ObjectManager.ObjectsSortedByStart = new int[] { }; ObjectManager.ObjectsSortedByEnd = new int[] { }; ObjectManager.ObjectsSortedByStartPointer = 0; ObjectManager.ObjectsSortedByEndPointer = 0; ObjectManager.LastUpdatedTrackPosition = 0.0; ObjectManager.AnimatedWorldObjects = new ObjectManager.AnimatedWorldObject[4]; ObjectManager.AnimatedWorldObjectsUsed = 0; // renderer / sound Renderer.Reset(); SoundManager.StopAllSounds(true); GC.Collect(); }
private void updateDebug() { #region get debug string string dbgString = p_RenderHeartbeat.Rate + "fps"; try { p_Window.Invoke(new MethodInvoker(delegate { try { p_Window.Text = dbgString + " (" + p_Window.Renderer + ") Build: " + Globals.BUILD; } catch { } })); } catch { } Fog fog = p_CurrentPlayer.Fog; if (p_DebugFull) { Point mousePosition = Point.Empty; try { mousePosition = (Point)p_Window.Invoke((Func <Point>) delegate { return(p_Window.PointToClient(Cursor.Position)); }); } catch { } VisibleBlock blockAtCursor = p_MapRenderer.TryGetBlockAtPoint(p_Window.Context, mousePosition); dbgString = "Keys: keys[" + p_CurrentKeys + "] arw[" + p_ArrowKeyDown + "]\n" + "Camera position: " + p_Camera.X + "x" + p_Camera.Y + "\n" + "Vertices: " + p_Window.Renderer.Vertices + "\n" + "Blocks rendered: " + p_MapRenderer.VisibleBlocks.Count + "\n" + "Blocks revealed: " + fog.BlocksRevealed + "/" + (p_Map.Width * p_Map.Height) + " [" + (fog.BlocksRevealed * 1.0f / (p_Map.Width * p_Map.Height) * 100).ToString("0.00") + "%]\n" + "Block size: " + p_Camera.BlockSize + " (" + (p_Camera.BlockSizeScalar * 100).ToString("0.00") + "%)\n" + "Cursor position: [L]" + getPointString(mousePosition) + " [S]" + getPointString(Cursor.Position) + " [B]" + getPointString(new Point(blockAtCursor.BlockX, blockAtCursor.BlockY)) + "\n" + "Window size: " + getSizeString(new Size(p_Window.Context.Width, p_Window.Context.Height)) + "\n" + "Render: " + getHeartbeatString(p_RenderHeartbeat) + "\n" + "Logic: " + getHeartbeatString(p_LogicHeartbeat); } #endregion p_DebugLabel.Text = dbgString; p_DebugLabel.Location = new Point( p_Window.Context.Width - p_DebugLabel.Width - 10, p_Window.Context.Height - p_DebugLabel.Height - 10); }
protected IEnumerator SmoothMovement(int desiredIndex) { if (Scene._grid[desiredIndex].isWalkable /* && Scene._grid[desiredIndex].ItemValue != ItemValues.MiningBlock*/) { CurrentIndexPosition = desiredIndex; CurrentPosY = CurrentIndexPosition / Scene.Height; CurrentPosX = CurrentIndexPosition - CurrentPosY * Scene.Height; Vector3 end = Scene._grid[desiredIndex].position; if (PlayerBiome != Scene._grid[desiredIndex].Biome) { PlayerBiome = Scene._grid[desiredIndex].Biome; GlobalEventText.AddMessage(string.Format("You just entered in the biome {0}", PlayerBiome.ToString())); } //Calculate the remaining distance to move based on the square magnitude of the difference between current position and end parameter. //Square magnitude is used instead of magnitude because it's computationally cheaper. float sqrRemainingDistance = (transform.position - end).sqrMagnitude; //While that distance is greater than a very small amount (Epsilon, almost zero): while (sqrRemainingDistance > float.Epsilon) { //Find a new position proportionally closer to the end, based on the moveTime Vector3 newPostion = Vector3.MoveTowards(_rb2D.position, end, 20.0f * Time.deltaTime); //Call MovePosition on attached Rigidbody2D and move it to the calculated position. _rb2D.MovePosition(newPostion); //Recalculate the remaining distance after moving. sqrRemainingDistance = (transform.position - end).sqrMagnitude; //Return and loop until sqrRemainingDistance is close enough to zero to end the function yield return(null); } Fog.UpdateFog(CurrentIndexPosition, TileFogState.Active); } else { if (Scene._grid[desiredIndex].TileItem != null) { if (!Scene._grid[desiredIndex].TileItem.GetComponent <MonoDestructibleTile>().thisItem.OnDamage(50, desiredIndex)) { yield return(new WaitForSeconds(0.5f)); //Mining time } else { Destroy(Scene._grid[desiredIndex].TileItem); } } } _movementReady = true; }
/// <summary> /// Call this once to initialise the renderer /// </summary> public virtual void Initialize(HostInterface CurrentHost, BaseOptions CurrentOptions) { currentHost = CurrentHost; currentOptions = CurrentOptions; Background = new Background(this); Fog = new Fog(); OpenGlString = new OpenGlString(this); TextureManager = new TextureManager(currentHost); Cube = new Cube(this); Rectangle = new Rectangle(this); Loading = new Loading(this); Keys = new Keys(this); MotionBlur = new MotionBlur(this); StaticObjectStates = new List <ObjectState>(); DynamicObjectStates = new List <ObjectState>(); VisibleObjects = new VisibleObjectLibrary(currentHost, Camera, currentOptions, this); try { DefaultShader = new Shader("default", "default", true); DefaultShader.Activate(); DefaultShader.Deactivate(); } catch { CurrentHost.AddMessage(MessageType.Error, false, "Initialising the default shaders failed- Falling back to legacy openGL."); CurrentOptions.IsUseNewRenderer = false; } GL.ClearColor(0.67f, 0.67f, 0.67f, 1.0f); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); GL.Enable(EnableCap.DepthTest); GL.DepthFunc(DepthFunction.Lequal); SetBlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha); GL.Hint(HintTarget.FogHint, HintMode.Fastest); GL.Hint(HintTarget.LineSmoothHint, HintMode.Fastest); GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Fastest); GL.Hint(HintTarget.PointSmoothHint, HintMode.Fastest); GL.Hint(HintTarget.PolygonSmoothHint, HintMode.Fastest); GL.Hint(HintTarget.GenerateMipmapHint, HintMode.Nicest); GL.Enable(EnableCap.CullFace); GL.CullFace(CullFaceMode.Front); GL.Disable(EnableCap.Texture2D); GL.Disable(EnableCap.Dither); GL.Disable(EnableCap.Lighting); GL.Disable(EnableCap.Fog); GL.Fog(FogParameter.FogMode, (int)FogMode.Linear); }
public ParticleGenerator(byte[] options, bool applyFixes = false) { this.albedo = (Albedo)options[0]; this.blend_mode = (Blend_Mode)options[1]; this.specialized_rendering = (Specialized_Rendering)options[2]; this.lighting = (Lighting)options[3]; this.render_targets = (Render_Targets)options[4]; this.depth_fade = (Depth_Fade)options[5]; this.black_point = (Black_Point)options[6]; this.fog = (Fog)options[7]; this.frame_blend = (Frame_Blend)options[8]; this.self_illumination = (Self_Illumination)options[9]; ApplyFixes = applyFixes; TemplateGenerationValid = true; }
public void AddMissingFog() { for (int i = 0; i < hexGrid.size; i++) { bool checkFog = hexGrid.GetFog(i); if (checkFog == false) { hexGrid.SetFog(i, true); Vector3 pos = hexGrid.GetCellPos(i); pos.y = 0.1f; Fog fog = fogs[i] = Instantiate <Fog>(fogPrefab); fog.transform.SetParent(transform, false); fog.transform.localPosition = pos; } } }
/// <summary> /// Generator instantiation for method specific shaders. /// </summary> public ParticleGenerator(Albedo albedo, Blend_Mode blend_mode, Specialized_Rendering specialized_rendering, Lighting lighting, Render_Targets render_targets, Depth_Fade depth_fade, Black_Point black_point, Fog fog, Frame_Blend frame_blend, Self_Illumination self_illumination, bool applyFixes = false) { this.albedo = albedo; this.blend_mode = blend_mode; this.specialized_rendering = specialized_rendering; this.lighting = lighting; this.render_targets = render_targets; this.depth_fade = depth_fade; this.black_point = black_point; this.fog = fog; this.frame_blend = frame_blend; this.self_illumination = self_illumination; ApplyFixes = applyFixes; TemplateGenerationValid = true; }
void OnMouseDown() { Fog fog = gameObject.GetComponentInParent <Fog>(); if (!fog.canDeleteFog(near[0])) //点在black or white { return; } //可探索 // **判断是否不可前进即不可探索此块周边** // Manager manager = gameObject.GetComponentInParent <Manager>(); GameObject obj = manager.randomObject(transform, near, ref isblack); fog.deleteFog(near, isblack); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { numSegmentsIn += 1; switch (roomData.roomType) { case RoomType.normal: if (numSegmentsIn > 0 && !didPlayerEnter) { didPlayerEnter = true; //Debug.Log("Player entered room type " + roomData.roomType); isInCombat = true; } break; case RoomType.challenge: case RoomType.boss: if (numSegmentsIn == Player.body.Length && !didPlayerEnter) { didPlayerEnter = true; //Debug.Log("Player entered room type " + roomData.roomType); isInCombat = true; SetDoorIsClosed(true); } break; } if (!didFog) { didFog = true; if (Fog.isActive) { Vector3 pPos = Player.GetHead().transform.position; Vector3Int start = new Vector3Int((int)pPos.x, (int)pPos.y, 0); Vector3Int min = new Vector3Int((int)transform.position.x, (int)transform.position.y, 0); Vector3Int max = min + new Vector3Int(roomData.width, roomData.height, 0); Fog.Flood(start, min, max); } } } }
void Setup(int right, int down) { init = false; if (right > 0) { GameObject o = Instantiate(this.gameObject, transform.position + new Vector3(1f, 0f, 0f), Quaternion.identity) as GameObject; nextRight = o.GetComponent <Fog>(); nextRight.Setup(right - 1, down); } if (down > 0) { GameObject o = Instantiate(this.gameObject, transform.position + new Vector3(0f, -1f, 0f), Quaternion.identity) as GameObject; nextDown = o.GetComponent <Fog>(); nextDown.Setup(0, down - 1); } }
/// <summary> /// Returns a specific Weather class based on the value of parameter iRange /// </summary> /// <param name="iRange">Specific choice of Weather Object</param> /// <returns>wTempWeather</returns> public Weather RandomWeatherRange(int iRange) { Weather wTempWeather = new Weather(); switch (iRange) { case 0: //Rain wTempWeather = new Sunny(); return(wTempWeather); case 1: //Sunny wTempWeather = new Rain(); return(wTempWeather); case 2: //Cloudy wTempWeather = new Cloudy(); return(wTempWeather); case 3: //Snow wTempWeather = new Snow(); return(wTempWeather); case 4: //Windy wTempWeather = new Windy(); return(wTempWeather); case 5: //Thunderstorm wTempWeather = new Thunderstorm(); return(wTempWeather); case 6: //Hail wTempWeather = new Hail(); return(wTempWeather); case 7: //Fog wTempWeather = new Fog(); return(wTempWeather); case 8: //HeatWave wTempWeather = new HeatWave(); return(wTempWeather); } return(wTempWeather); }
public Pathfinding(Node origin, Node destiny, Unit unit, bool rangeConsidered = true) { this.map = GameController.map; this.unitCurrent = unit; this.origin = origin; this.rangeConsidered = rangeConsidered; this.destiny = CheckDestiny(destiny); this.opened = new Dictionary <int, Node>(); this.closed = new Dictionary <int, Node>(); // Optimizations this.nextExplored = null; // Diminui de 78702 para 9280 comparações da lista aberta. this.movements = new List <Vector2>(); this.fog = GameController.players[unit.idPlayer].fog; this.opened.Add((int)(origin.position.y * map.width + origin.position.x), origin); }
public RendererXNA(GraphicsDevice device) { this.modelMatrixStack.Push(Matrix.Identity); this.projMat = Matrix.Identity; this.viewMat = Matrix.Identity; this.basicEffect = new BasicEffect(device); this.multiTexture = new DualTextureEffect(device); this.skinnedEffect = new SkinnedEffect(device); this.skinnedEffect.WeightsPerVertex = 4; this.alphaTestEffect = new AlphaTestEffect(device); this.device = device; this.numTex = 0; this.m_cachedFog = (Fog)null; this.initBlendStates(); this.initRasterStates(); this.initDepthStates(); this.initSamplerStates(); }
void NewGame() { GameObject canvas = GameObject.Find("Canvas"); canvas.transform.Find("DistributeGold").gameObject.SetActive(true); canvas.transform.Find("DistributeWineskins").gameObject.SetActive(true); /* * heroes.Add(Archer.Instance); * heroes.Add(Mage.Instance); * heroes.Add(Dwarf.Instance); * Warrior.Instance.Cell = Cell.FromId(36); * Archer.Instance.Cell = Cell.FromId(49); * findHero("Archer").heroInventory.AddSmallToken(Telescope.Factory()); * findHero("Archer").heroInventory.AddHelm(Helm.Factory()); * Mage.Instance.Cell = Cell.FromId(25); * Dwarf.Instance.Cell = Cell.FromId(25); * thorald = Thorald.Instance; * Thorald.Instance.Cell = Cell.FromId(25); * Skral.Factory(25); * mainHeroIndex = 0; */ // FARMERS farmers.Add(Farmer.Factory(24)); farmers.Add(Farmer.Factory(36)); // MONSTERS gors.Add(Gor.Factory(8)); gors.Add(Gor.Factory(20)); gors.Add(Gor.Factory(21)); gors.Add(Gor.Factory(26)); gors.Add(Gor.Factory(48)); skrals.Add(Skral.Factory(19)); Fog.Factory(); wells.Add(Well.Factory(5)); wells.Add(Well.Factory(35)); wells.Add(Well.Factory(45)); wells.Add(Well.Factory(55)); }
public Layer(World world, int depth) { this.world = world; this.depth = depth; this.size = this.world.mapSize; this.worldRenderer = GameObject.FindObjectOfType <WorldRenderer>(); int cellCount = this.size * this.size; this.tiles = new CellState[cellCount]; for (int i = 0; i < this.tiles.Length; i++) { this.tiles[i] = new CellState(Main.instance.tileRegistry.getAir(), null, Rotation.UP); } this.temperatures = new float[cellCount]; this.heatSources = new float[cellCount]; this.hardness = new int[cellCount]; LayerData layerData = this.world.mapGenerator.getLayerFromDepth(this.depth); if (layerData != null) // Null if a layer is added through an external editor or the layer count is reduced // Set heat sourcess { this.cachedLayerHeat = layerData.defaultTemperature; if (this.cachedLayerHeat != 0) { for (int i = 0; i < this.heatSources.Length; i++) { this.heatSources[i] = this.cachedLayerHeat; } } // Setup Fog. if (layerData.hasFog) { this.fog = new Fog(this.size); this.fog.setAll(true); } } }
public void SaveMap(bool saveFog) { if (CanSave) { XmlLoader <GameMap> .Save(this, CreateFileName(id), true); if (saveFog) { FileInfo info = new FileInfo(XmlLoader <GameMap> .SaveFileName(CreateFogFileName(id), true)); using (FileStream stream = info.OpenWrite()) { byte[] byteArray = new byte[(int)Math.Ceiling((double)Fog.Length / 8)]; Fog.CopyTo(byteArray, 0); stream.Write(byteArray, 0, byteArray.Length); stream.Close(); } } } }
public void CopyFrom(Fog source) { //verify if (source.p_Width != p_Width || source.p_Height != p_Height) { throw new Exception("Source must have a matching size with the destination."); } //copy bool *ptr = p_FogMatrix; bool *sourcePtr = source.p_FogMatrix; bool *ptrEnd = p_FogMatrix + (p_Width * p_Height); while (ptr != ptrEnd) { *(ptr++) = *(sourcePtr++); } }
public ConsoleCommands(MenuFactory MenuFactory) { var ConsoleCommandsMenu = MenuFactory.Menu("Console Commands"); FogItem = ConsoleCommandsMenu.Item("Fog Disable", true); FilteringItem = ConsoleCommandsMenu.Item("Filtering Disable", true); ParticleHackItem = ConsoleCommandsMenu.Item("Particle Hack Enable", true); Fog = Game.GetConsoleVar("fog_enable"); Fog.SetValue(Convert.ToInt32(!FogItem.Value)); Filtering = Game.GetConsoleVar("fow_client_nofiltering"); Filtering.SetValue(Convert.ToInt32(FilteringItem.Value)); ParticleHack = Game.GetConsoleVar("dota_use_particle_fow"); ParticleHack.SetValue(Convert.ToInt32(!ParticleHackItem.Value)); FogItem.PropertyChanged += FogItemChanged; FilteringItem.PropertyChanged += FilteringItemChanged; ParticleHackItem.PropertyChanged += ParticleHackItemChanged; }
public float GetMaxSeverity(WeatherInfo weatherType = null) { WeatherInfo _weatherType = weatherType ?? currentWeather; if (_weatherType == null) { return(0); } float maxSeverity = _weatherType.maxSeverity; if (_weatherType.weather.name == "Wind") { maxSeverity = WindStorm.GetMaxSeverity(maxSeverity); } else if (_weatherType.weather.name == "Fog") { Fog fog = _weatherType.weather.GetComponent <Fog>(); maxSeverity = fog.GetMaxSeverity(maxSeverity); } return(maxSeverity); }
public CurrentRoute(BaseRenderer renderer) { this.renderer = renderer; Tracks = new[] { new Track { Elements = new TrackElement[0] } }; Trains = new AbstractTrain[0]; Sections = new Section[0]; Stations = new RouteStation[0]; BogusPreTrainInstructions = new BogusPreTrainInstruction[0]; PointsOfInterest = new PointOfInterest[0]; CurrentBackground = new StaticBackground(null, 6, false); TargetBackground = new StaticBackground(null, 6, false); NoFogStart = 800.0f; NoFogEnd = 1600.0f; PreviousFog = new Fog(NoFogStart, NoFogEnd, Color24.Grey, 0.0); CurrentFog = new Fog(NoFogStart, NoFogEnd, Color24.Grey, 0.5); NextFog = new Fog(NoFogStart, NoFogEnd, Color24.Grey, 1.0); Atmosphere = new Atmosphere(); SecondsSinceMidnight = 0.0; }
//check each player entity in entitystorage to determine their vision range and remove the fog for that range public void EntityCurrPlayerVision() { if (playerManager.currPlayer != string.Empty) { char playerChar = playerManager.currPlayer[0]; //Debug.Log(entityStorage.PlayerEntityList(playerChar)[0].name.Substring(2)); foreach (GameObject playerEntity in entityStorage.PlayerEntityList(playerChar)) { int visionDistance = entityStats.GetCurrVision(playerEntity); int index = entityStats.GetCellIndex(playerEntity); string height = hexGrid.GetTerrain(index); Dictionary <int, int> vision = PlayerVisionHelper(index, visionDistance, height); foreach (var tile in vision) { hexGrid.SetFog(tile.Key, false); Fog fog = fogs[tile.Key]; fog.GetComponent <Renderer>().enabled = false; } } foreach (GameObject buildingEntity in buildingStorage.PlayerBuildingList(playerChar)) { int visionDistance = buildingStats.GetCurrVision(buildingEntity); int index = buildingStats.GetCellIndex(buildingEntity); string height = hexGrid.GetTerrain(index); Dictionary <int, int> vision = PlayerVisionHelper(index, visionDistance, height); foreach (var tile in vision) { if (tile.Value >= -2) { hexGrid.SetFog(tile.Key, false); Fog fog = fogs[tile.Key]; fog.GetComponent <Renderer>().enabled = false; } } } } }
public void Start() { if(resourceManager == null){ resourceManager = gameObject.GetComponent<ResourceManager>(); } if(fog == null){ GameObject nObj; nObj = GameObject.Find("Fog"); if(nObj) fog = nObj.GetComponent<Fog>(); } if(unitSelect == null){ unitSelect = gameObject.GetComponent<UnitSelection>(); } if(grid == null){ GameObject nObj; nObj = GameObject.Find("UGrid"); if(nObj) grid = nObj.GetComponent<UGrid>(); } }
// ================================ internal static void Reset(bool ResetLogs) { // track manager TrackManager.CurrentTrack = new TrackManager.Track(); // train manager TrainManager.Trains = new TrainManager.Train[] { }; // game Interface.ClearMessages(); CurrentInterface = InterfaceType.Normal; RouteComment = ""; RouteImage = ""; RouteAccelerationDueToGravity = 9.80665; RouteRailGauge = 1.435; RouteInitialAirPressure = 101325.0; RouteInitialAirTemperature = 293.15; RouteInitialElevation = 0.0; RouteSeaLevelAirPressure = 101325.0; RouteSeaLevelAirTemperature = 293.15; Stations = new Station[] { }; Sections = new Section[] { }; BufferTrackPositions = new double[] { }; Messages = new Message[] { }; MarkerTextures = new Textures.Texture[] { }; PointsOfInterest = new PointOfInterest[] { }; PrecedingTrainTimeDeltas = new double[] { }; PrecedingTrainSpeedLimit = double.PositiveInfinity; BogusPretrainInstructions = new BogusPretrainInstruction[] { }; TrainName = ""; TrainStart = TrainStartMode.EmergencyBrakesNoAts; NoFogStart = (float)Math.Max(1.33333333333333 * Interface.CurrentOptions.ViewingDistance, 800.0); NoFogEnd = (float)Math.Max(2.66666666666667 * Interface.CurrentOptions.ViewingDistance, 1600.0); PreviousFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.0); CurrentFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 0.5); NextFog = new Fog(NoFogStart, NoFogEnd, new Color24(128, 128, 128), 1.0); InfoTotalTriangles = 0; InfoTotalTriangleStrip = 0; InfoTotalQuads = 0; InfoTotalQuadStrip = 0; InfoTotalPolygon = 0; InfoStaticOpaqueFaceCount = 0; if (ResetLogs) { LogRouteName = ""; LogTrainName = ""; LogDateTime = DateTime.Now; CurrentScore = new Score(); ScoreMessages = new ScoreMessage[] { }; ScoreLogs = new ScoreLog[64]; ScoreLogCount = 0; BlackBoxEntries = new BlackBoxEntry[256]; BlackBoxEntryCount = 0; BlackBoxNextUpdate = 0.0; } // renderer Renderer.Reset(); }
public FogSelector() { InitializeComponent(); fog = new Fog(); }
// ================================ internal static void Reset() { // track manager TrackManager.CurrentTrack = new TrackManager.Track(); // train manager TrainManager.Trains = new TrainManager.Train[] { }; // game Interface.ClearMessages(); RouteComment = ""; RouteImage = ""; RouteAccelerationDueToGravity = 9.80665; RouteRailGauge = 1.435; RouteInitialAirPressure = 101325.0; RouteInitialAirTemperature = 293.15; RouteInitialElevation = 0.0; RouteSeaLevelAirPressure = 101325.0; RouteSeaLevelAirTemperature = 293.15; Stations = new Station[] { }; Sections = new Section[] { }; BufferTrackPositions = new double[] { }; MarkerTextures = new int[] { }; PointsOfInterest = new PointOfInterest[] { }; BogusPretrainInstructions = new BogusPretrainInstruction[] { }; TrainName = ""; TrainStart = TrainStartMode.EmergencyBrakesNoAts; PreviousFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 0.0); CurrentFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 0.5); NextFog = new Fog(0.0f, 0.0f, new World.ColorRGB(128, 128, 128), 1.0); NoFogStart = (float)World.BackgroundImageDistance + 200.0f; NoFogEnd = 2.0f * NoFogStart; InfoTotalTriangles = 0; InfoTotalTriangleStrip = 0; InfoTotalQuads = 0; InfoTotalQuadStrip = 0; InfoTotalPolygon = 0; // object manager ObjectManager.Objects = new ObjectManager.StaticObject[16]; ObjectManager.ObjectsUsed = 0; ObjectManager.ObjectsSortedByStart = new int[] { }; ObjectManager.ObjectsSortedByEnd = new int[] { }; ObjectManager.ObjectsSortedByStartPointer = 0; ObjectManager.ObjectsSortedByEndPointer = 0; ObjectManager.LastUpdatedTrackPosition = 0.0; ObjectManager.AnimatedWorldObjects = new ObjectManager.AnimatedWorldObject[4]; ObjectManager.AnimatedWorldObjectsUsed = 0; // renderer / sound Renderer.Reset(); SoundManager.StopAllSounds(true); GC.Collect(); }
public virtual void SetFog(ushort zone_x, ushort zone_y, Fog fog) { Cl_SetFog(thisptr, zone_x, zone_y, (int)fog); }
public void SetData(Fog.FogOfWarProbeData[] newData) { Debug.Assert(newData != null); _probeData = newData; }
static void ReadMFOG(BinaryReader br, WMORoot wmo, uint size) { wmo.Fogs = new Fog[size/48]; for (int i = 0; i < wmo.Fogs.Length; i++) { var fog = new Fog { Flags = (FogFlags)br.ReadUInt32(), Position = br.ReadVector3(), Start = br.ReadSingle(), End = br.ReadSingle(), FogInfo_FOG = new FogInfo { End = br.ReadSingle(), StartScalar = br.ReadSingle(), Color = br.ReadColor4() }, FogInfo_UWFOG = new FogInfo { End = br.ReadSingle(), StartScalar = br.ReadSingle(), Color = br.ReadColor4() } }; wmo.Fogs[i] = fog; } }