public ExtortPersonAction(CitizenBehaviour self, CitizenBehaviour target) { Self = self; ActionCompleted = false; try{ CurrentActionTarget = target.gameObject; } catch (System.Exception) { MonoBehaviour.Destroy(self.gameObject); } ObjectiveRange = 0.15f; //Make sure all citizens spawn inside houses, and then moves out Self.SetPersonActive(true); targetStatsScript = CurrentActionTarget.GetComponent <CitizenStats> (); targetScript = target as Citizen_Civilian; targetPosition = CurrentActionTarget.transform.GetChild(0).GetChild(0); animator = Self.anim; //Change this to a "chasing" system. Also in the talk action //ForceTargetToHalt (); Gunparticle = Self.transform.GetChild(0).GetChild(0).GetChild(1).GetComponentInChildren <ParticleSystem> (); ExecuteAction(); }
public override bool GetNewTarget(List <GameObject> targets) { if (targets == null) { targets = new List <GameObject> (); } if (targets.Count == 0) { return(false); } List <GameObject> personTargets = new List <GameObject>(); for (int i = 0; i < targets.Count; i++) { if (targets [i].GetComponent <Citizen_Civilian> ()) { personTargets.Add(targets [i]); } } // Debug.Log("Getting new target"); CurrentActionTarget = personTargets [Random.Range(0, personTargets.Count)]; targetPosition = CurrentActionTarget.transform.GetChild(0).GetChild(0);; targetScript = CurrentActionTarget.GetComponent <Citizen_Civilian> (); return(true); }