Exemplo n.º 1
0
        public void UpdateThreadedFireSpreading()
        {
            for (int i = threadedFireSpreadList.Count - 1; i > -1; i--)
            {
                ThreadedFireSpread fireSpread = threadedFireSpreadList[i];

                Fire fire = WorldController.world.tileGrid[fireSpread.tileX, fireSpread.tileY].fire;

                if (fire == null)
                {
                    fire = new Fire(fireSpread.tileX, fireSpread.tileY);
                    AddFire(fire); //need to add the fire before the mini fire for drawing
                    fire.AddMiniFire(fireSpread.miniX, fireSpread.miniY);
                }
                else
                {
                    if (fire.isPartialBurntOut)
                    {
                        //readd it to our list
                        AddFire(fire); //need to add the fire before the mini fire for drawing
                    }
                    fire.AddMiniFire(fireSpread.miniX, fireSpread.miniY);

                    //if its not in the update cycle because its partially burnt
                }

                threadedFireSpreadList.RemoveAt(threadedFireSpreadList.Count - 1);
            }
        }
Exemplo n.º 2
0
        //Okay so the issue is
        //if its finished but not completely burnt
        //we dont want to be updating it
        //however it could start up again


        public void Update()
        {
            //     EngineController.debugMiniFires = 0;
            //first = true;
            if (!first)
            {
                first = true;

                Fire fire = new Fire(184, 184);
                AddFire(fire);  //need to add the fire to the map before adding the minifire
                fire.AddMiniFire(0, 0);
            }

            List <Fire> fireList = fireArray[currentUpdateCount];

            EngineController.debugFires = fireList.Count;

            for (int i = fireList.Count - 1; i > -1; i--)
            {
                Fire fire = fireList[i];
                fire.Update();

                if (fire.isCompleteBurntOut && fire.IsFinishedDrawingSmoke())
                {
                    RemoveFireFromUpdateList(i, fireList);
                    SetTileToBurnt(fire);
                }
                else if (fire.isPartialBurntOut && fire.IsFinishedDrawingSmoke())
                {
                    RemoveFireFromUpdateList(i, fireList);
                }
            }


            currentUpdateCount++;
            if (currentUpdateCount > arrayCount - 1)
            {
                currentUpdateCount = 0;
            }
        }