//so every update. updateTick = !updateTick; //so every draw //if !isBeingDrawn //isBeingDrawn = updateTick; //isBeingDrawn public Fire(int tileX, int tileY) { miniFireList = new MiniFire[gridSize, gridSize]; topLeftMiniXCenter = (tileX * GroundLayerController.tileSize) + 16; topLeftMiniYCenter = (tileY * GroundLayerController.tileSize) + 16; //Get the fuel and the intensity from the tileLogisticslayer fuel = 20000; intensity = 100f; this.tileX = tileX; this.tileY = tileY; if (fuel > 0f) { // { // AddMiniFire(miniFirePoint.X, miniFirePoint.Y); // } } else { isCompleteBurntOut = true; } }
public void AddMiniFire(int miniX, int miniY) { if (miniFireList[miniX, miniY] == null) { miniFireList[miniX, miniY] = new MiniFire(fuel, this, miniX, miniY); miniFireCount++; miniFireCurrentBurning++; isPartialBurntOut = false; } WorldController.world.tileGrid[tileX, tileY].SetBurntLayer(); }
private void UpdateMiniFires() { calculatedIntensity = intensity * EngineController.gameUpdateTime; if (miniFireCurrentBurning > 0) { for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { MiniFire miniFire = miniFireList[x, y]; if (miniFire != null && !miniFire.isBurnt) { miniFire.Update(); if (isBeingDrawn & miniFire.releaseSmoke) { AddSmoke(x, y); } if (miniFire.isBurnt) { miniFireCurrentBurning -= 1; } } } } } else { if (miniFireCount == totalPerGrid) { isCompleteBurntOut = true; } else { isPartialBurntOut = true; } } }
//put these in a seperate list later //Also only wont to kill the fires when all minifires when all the smoke is gone private void DrawFires(SpriteBatch spriteBatch) { if (miniFireCurrentBurning > 0) { //draw circles for the flame //however i think we will have the flames as particles in our list Vector2 location = new Vector2((tileX * GroundLayerController.tileSize) + halfGridSquare, (tileY * GroundLayerController.tileSize) + halfGridSquare); for (int x = 0; x < gridSize; x++) { for (int y = 0; y < gridSize; y++) { MiniFire miniFire = miniFireList[x, y]; if (miniFire != null) { miniFire.Draw(spriteBatch, new Vector2(location.X + (x * gridSquare), location.Y + (y * gridSquare))); } } } } }