/// <summary> /// Returns whether a duplicant must stop and wait. /// </summary> /// <param name="dupe">The duplicant to check.</param> /// <param name="x">The X direction they are going.</param> /// <returns>true if they must wait, or false if they may pass.</returns> private bool MustStop(GameObject dupe, float x) { var dir = checkpoint.direction.allowedDirection; // Left is decreasing X, must be facing the correct direction return((dir == WorkableReactable.AllowedDirection.Any || (dir == WorkableReactable.AllowedDirection.Left) == (x < 0.0f)) && checkpoint.workable.GetWorker() != null && checkpoint.MustStop(dupe, x)); }
/// <summary> /// Returns whether a duplicant must stop and wait. /// </summary> /// <param name="dupe">The duplicant to check.</param> /// <param name="x">The X direction they are going.</param> /// <returns>true if they must wait, or false if they may pass.</returns> private bool MustStop(GameObject dupe, float x) { var dir = checkpoint.direction.allowedDirection; // Allow suffocating Duplicants to pass var suff = dupe?.GetSMI <SuffocationMonitor.Instance>(); // Left is decreasing X, must be facing the correct direction return((dir == WorkableReactable.AllowedDirection.Any || (dir == WorkableReactable.AllowedDirection.Left) == (x < 0.0f)) && checkpoint.workable.GetWorker() != null && checkpoint.MustStop(dupe, x) && (suff == null || !suff.IsSuffocating())); }