public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Camera camera) { GroundLayer?.Draw(gameTime, spriteBatch, TileSet, camera); EdgeLayer?.Draw(gameTime, spriteBatch, TileSet, camera); BuildingLayer?.Draw(gameTime, spriteBatch, TileSet, camera); DecorationLayer?.Draw(gameTime, spriteBatch, TileSet, camera); }
private static void InitBurntLayers() { burntLayerList = new Dictionary <int, GroundLayer>(); int bitMaskIndex = 0; int tileSize = 12; for (int x = 0; x < 128; x++) { for (int y = 0; y < 512; y++) { int locationX = (x * tileSize) + x + 1 + 650; int locationY = (y * tileSize) + y + 1; Rectangle rectangle = new Rectangle(locationX, locationY, tileSize, tileSize); Sprite sprite = new Sprite(rectangle, TextureSheet.Ground); GroundLayer burntLayer = new GroundLayer(LayerType.BURNT, sprite, 0, 0); // burntLayer.scale = 11.6f; burntLayer.scale = 10.7f; burntLayerList.Add(bitMaskIndex, burntLayer); bitMaskIndex++; } } burntLayerList.Last().Value.isFullBurnt = true; }
private void AddLayerDraw(Tile tile, Rectangle destination, Color color) { if (tile.GetBaseLayer() != null) { GroundLayer layer = tile.GetBaseLayer(); DisplayController.spriteBatch1.Draw(layer.sprite.texture2D, destination, layer.sprite.location, color, layer.sprite.rotation, layer.sprite.rotationCenter, SpriteEffects.None, 1f); } if (tile.GetLayerList() != null) { foreach (GroundLayer extraLayer in tile.GetLayerList()) { DisplayController.spriteBatch1.Draw(extraLayer.sprite.texture2D, destination, extraLayer.sprite.location, color, extraLayer.sprite.rotation, extraLayer.sprite.rotationCenter, SpriteEffects.None, 1f); } } if (tile.GetBurntLayer() != null) { GroundLayer layer = tile.GetBurntLayer(); DisplayController.spriteBatch1.Draw(layer.sprite.texture2D, destination, layer.sprite.location, color, layer.sprite.rotation, layer.sprite.rotationCenter, SpriteEffects.None, 1f); } /* if (tile.isCompleteBurnt) * { * GroundLayer extraLayer = GroundLayerController.burntLayer; * DisplayController.spriteBatch1.Draw(extraLayer.sprite.texture2D, destination, extraLayer.sprite.location, color, extraLayer.sprite.rotation, extraLayer.sprite.rotationCenter, SpriteEffects.None, 1f); * }*/ }
public void SetBurntLayer() { if (fire != null) { burntLayer = GroundLayerController.GetBurntLayerByBitMask(fire.GetBurntLayerBitMaskId()); } }
public void Update(GameTime gameTime) { GroundLayer?.Update(gameTime); EdgeLayer?.Update(gameTime); BuildingLayer?.Update(gameTime); DecorationLayer?.Update(gameTime); }
private static void LoadLayer(LayerType layerType, bool rotateBase) { Dictionary <int, GroundLayer> myList = new Dictionary <int, GroundLayer>(); int textureSheetHeightIndex = (int)layerType; float degrees = 0; for (int i = 0; i < 21; i++) { Sprite sprite = new Sprite(GetSpriteSheetRectangle(i, textureSheetHeightIndex), TextureSheet.Ground); GroundLayer layer = new GroundLayer(layerType, sprite, textureSheetHeightIndex, BitMask.GetBitmaskFromTileIndex(i)); sprite.rotation = MathHelper.ToRadians(degrees); myList.Add(i, layer); if (rotateBase || i > 11) { degrees += 90; } if (degrees == 360) { degrees = 0; } } layerTypeList.Add(layerType, myList); }
public PlayerCameToLayerEA(GroundLayer groundLayer) { if (groundLayer == null) { Management.Log.Instance.WriteException(new ArgumentNullException()); } GroundLayer = groundLayer; }
public void AddLayer(GroundLayer groundLayer) { if (layerList == null) { layerList = new GroundLayer[0]; } ResizeLayerList(1); layerList[layerList.Length - 1] = groundLayer; }
// public Layer vehicle1; // public Layer vehicle2; public Tile(GroundLayer baseLayer, TileLogistic tileLogistic, int tileX, int tileY) { //landtype just all starts as water //when we expand our shunk map the landtype gets set? this.tileLogistic = tileLogistic; this.baseLayer = baseLayer; location = new Vector2((tileX * GroundLayerController.tileSize) + GroundLayerController.halfTileSize, (tileY * GroundLayerController.tileSize) + GroundLayerController.halfTileSize); }
public void OnPlayerCameToLayer(EventArgs args) { if (args is PlayerCameToLayerEA pctl) { if (_visitedGroundLayer != null) { if (_visitedGroundLayer.AreaType == GroundLayer.EAreaType.Surface) { _surfaceLightingController.ChangeLighting(new ChangeAmbientLightEA.AmbientLightSetting { LightToRemove = _visitedGroundLayer.AmbientLight }); } else if (_visitedGroundLayer.AreaType == GroundLayer.EAreaType.Underground) { _undergroundLightingController.ChangeLighting(new ChangeAmbientLightEA.AmbientLightSetting { LightToRemove = _visitedGroundLayer.AmbientLight }); } } _visitedGroundLayer = pctl.GroundLayer; if (_visitedGroundLayer != null) { if (_visitedGroundLayer.AreaType == GroundLayer.EAreaType.Surface) { _surfaceLightingController.ChangeLighting(new ChangeAmbientLightEA.AmbientLightSetting { LightToAdd = pctl.GroundLayer.AmbientLight, ChangeMode = ChangeAmbientLightEA.EChangeMode.Stack }); if (_changeControllerCoroutine != null) { StopCoroutine(_changeControllerCoroutine); } _changeControllerCoroutine = StartCoroutine(ChangeToSurface()); } else if (_visitedGroundLayer.AreaType == GroundLayer.EAreaType.Underground) { _undergroundLightingController.ChangeLighting(new ChangeAmbientLightEA.AmbientLightSetting { LightToAdd = pctl.GroundLayer.AmbientLight, ChangeMode = ChangeAmbientLightEA.EChangeMode.Stack }); if (_changeControllerCoroutine != null) { StopCoroutine(_changeControllerCoroutine); } _changeControllerCoroutine = StartCoroutine(ChangeToUnderground()); } } } else { Log.Instance.WriteException(new InvalidEventArgsException()); } }
void Start() { Current = masterGround.GetComponent<GroundLayer>(); int count = 0; foreach (SwitchLight lightswitch in this.gameObject.GetComponentsInChildren<SwitchLight>()) { lightswitch.SetID(count++); } this.gameObject.transform.DetachChildren(); NumberOfGrounds = MINIMUM_NUMBER_OF_GROUNGS; if ((numberOfGrounds -= MINIMUM_NUMBER_OF_GROUNGS) > 0) AddGrounds(numberOfGrounds); numberOfGrounds = NumberOfGrounds; Current.IsActiveGround = true; }
public void OnPlayerCameToLayer(EventArgs args) { if (args is PlayerCameToLayerEA pctl) { if (!enabled) { enabled = true; } _currentLayer = pctl.GroundLayer; ChangeTransparency(pctl.GroundLayer.AreaType); } else { Management.Log.Instance.WriteException(new InvalidEventArgsException()); } }
public void SetChildObject(MapObject mapObject, bool deleteBase, bool deleteLayerList, TileLogistic tileLogistic, bool changeTileLogistic) { childObject = mapObject; if (deleteLayerList) { layerList = null; } if (deleteBase) { baseLayer = null; } if (changeTileLogistic) { this.tileLogistic = tileLogistic; } }
void Start() { Current = masterGround.GetComponent <GroundLayer>(); int count = 0; foreach (SwitchLight lightswitch in this.gameObject.GetComponentsInChildren <SwitchLight>()) { lightswitch.SetID(count++); } this.gameObject.transform.DetachChildren(); NumberOfGrounds = MINIMUM_NUMBER_OF_GROUNGS; if ((numberOfGrounds -= MINIMUM_NUMBER_OF_GROUNGS) > 0) { AddGrounds(numberOfGrounds); } numberOfGrounds = NumberOfGrounds; Current.IsActiveGround = true; }
private void FootstepEvent() { if (!IsPlayingFootstepSound) { return; } if (!CharIsOnSpecialSurface) { terrainID = GetActiveTerrainTextureIdx(); switch (terrainID) { case 0: currentPlayerGroundLayer = GroundLayer.shortGrass; break; case 1: currentPlayerGroundLayer = GroundLayer.sand; break; case 2: currentPlayerGroundLayer = GroundLayer.wetSand; break; case 3: currentPlayerGroundLayer = GroundLayer.longGrass; break; case 4: currentPlayerGroundLayer = GroundLayer.stone; break; case 6: currentPlayerGroundLayer = GroundLayer.agricol; break; default: currentPlayerGroundLayer = GroundLayer.shortGrass; break; } } PlayFootstepSound(); }
public void Update(GameTime gameTime) { if (GroundLayer != null) { GroundLayer.Update(gameTime); } if (EdgeLayer != null) { EdgeLayer.Update(gameTime); } if (BuildingLayer != null) { BuildingLayer.Update(gameTime); } if (DecorationLayer != null) { DecorationLayer.Update(gameTime); } }
public void Draw(GameTime gameTime, SpriteBatch spriteBatch, Camera camera) { if (GroundLayer != null) { GroundLayer.Draw(gameTime, spriteBatch, TileSet, camera); } if (EdgeLayer != null) { EdgeLayer.Draw(gameTime, spriteBatch, TileSet, camera); } if (BuildingLayer != null) { BuildingLayer.Draw(gameTime, spriteBatch, TileSet, camera); } if (DecorationLayer != null) { DecorationLayer.Draw(gameTime, spriteBatch, TileSet, camera); } }
//to save a variable we only use child object. to find if its a parent object we just need to see //if mapobject is not null public void AddMapObject(MapObject mapObject, bool deleteBase, bool deleteLayerList, bool includeChildObject, TileLogistic tileLogistic, bool changeTileLogistic) { //We could also change this to have a bool of drawlayers or not this.mapObject = mapObject; if (includeChildObject) { childObject = mapObject; } if (deleteLayerList) { layerList = null; } if (deleteBase) { baseLayer = null; } if (changeTileLogistic) { this.tileLogistic = tileLogistic; } }
public void Update(GameTime gameTime) { GroundLayer.Update(gameTime); MiddleLayer.Update(gameTime); TopLayer.Update(gameTime); }
public void UnloadContent() { GroundLayer.UnloadContent(); MiddleLayer.UnloadContent(); TopLayer.UnloadContent(); }
public void LoadContent() { GroundLayer.LoadContent(); MiddleLayer.LoadContent(); TopLayer.LoadContent(); }
public void Draw(SpriteBatch spriteBatch) { GroundLayer.Draw(spriteBatch); MiddleLayer.Draw(spriteBatch); TopLayer.Draw(spriteBatch); }
public void SetGroundTile(int x, int y, int index) { GroundLayer.SetTile(x, y, index); }
public int GetGroundTile(int x, int y) { return(GroundLayer.GetTile(x, y)); }