public void EnterState() { alertRaised = true; safeSpaces = NpcBase.FindTargets <Safety>("Safety", NpcController.Location, 100f, mask, s => s.isOpen); if (safeSpaces.Count > 0) { safeHouse = NpcBase.TargetNearest <Safety>(NpcController.Location, safeSpaces).transform; } }
public void EnterState() { safeSpaces = NpcBase.FindTargets <Safety>("Safety", NpcController.Location, 100f, mask, s => s.isOpen); if (safeSpaces.Count > 0) { safeHouse = NpcBase.TargetNearest <Safety>(NpcController.Location, safeSpaces).transform; if (safeHouse != null) { NpcController.mover.MoveTo(safeHouse.position); // bMovingToSafety = true; } } }
void RunToSafety() { if (safeSpaces.Count > 0) { safeHouse = NpcBase.TargetNearest <Safety>(NpcController.Location, safeSpaces).transform; } if (safeHouse != null) { movement = (safeHouse.position - NpcController.Location).normalized; NpcController.Animate(movement, 1f); NpcController.mover.MoveTo(safeHouse.position); bMovingToSafety = true; } }