public void Defuse() { GameObject bomb = GameObject.Find(Misc.Constants.GAME_CONTROLLER_NAME).GetComponent <Core.GameController>().Bomb; BombScript bombScript = bomb.GetComponent <BombScript>(); if (!(NextPointInPath < Path.Count - 1) && WillDefuse) { if (!bombScript.IsTimerZero() && !bombScript.BeingDefused) { Defusing = true; bombScript.StartDefuse(gameObject); DefusingStarted = Core.Vars.SimulationTime; } } else { Defusing = false; if (bombScript.Defuser == gameObject) { bombScript.StopDefuse(); } } }
public void StepThrough() { // ct CounterTerroristAI.UpdateChildrenList(); TerroristAI.UpdateChildrenList(); CounterTerroristAI.CheckVisibility(TerroristAI.Children); SimulationStep(CounterTerroristAI); HideDead(); // tero CounterTerroristAI.UpdateChildrenList(); TerroristAI.UpdateChildrenList(); TerroristAI.CheckVisibility(CounterTerroristAI.Children); SimulationStep(TerroristAI); HideDead(); // end visibility check for recording UpdateVisibility(); Vars.SimulationTime += Time.fixedDeltaTime; //Debug.Log(Vars.SimulationTime); BombScript bomb = GameController.Bomb.GetComponent <BombScript>(); if (GameController.Winner == null) { if (CounterTerroristAI.Children.Count == 0 || bomb.IsTimerZero()) { GameController.Winner = Side.Terrorist; } else if (((TerroristAI.Children.Count == 0 || Vars.SimulationTime > 60) && !bomb.Planted) || bomb.IsDefused()) { GameController.Winner = Side.CounterTerrorist; } } }