Exemplo n.º 1
0
        //get a new extinguisher object
        private void GetExtinguisher()
        {
            foreach (Tile t in lineOfSight)          //up, down, left and right
            {
                if (sharedExtinguishers.Contains(t)) //if it is still in the shared extinguishers list (it has not been taken yet)
                {
                    this.extinguisher = new Extinguisher();
                    this.sharedExtinguishers.Remove(t);                  //remove it from the shared list
                    this.DIJKSTRA = new Dijkstra(currentLocation, grid); //create the dijsktra object
                    this.NewExtinguisher();                              //create a new extinguisher

                    if (RedrawHandler != null)
                    {
                        RedrawHandler.Invoke(t); //Call the form's redraw method to redraw a wall
                    }

                    return; //spend one tick to get the extinguisher
                }
            }

            this.NewExtinguisher(); //set a new extinguisher
            RunForExtinguisher();   //avoid wasting time in one place when no extinguisher at the current place
        }
Exemplo n.º 2
0
 //Removes the extinguisher when no fuel or malfunction and calls the RunForExtinguisher method without an extinguisher
 private void RemoveExtinguisher()
 {
     this.extinguisher = null; //remove the extinguisher
     RunForExtinguisher();     //run the method without extinguisher
 }