public void Lock_MultipleLocks_True() { var tieredLock = new TieredLock <ETestTieredLockEnum>(); tieredLock.Lock(ETestTieredLockEnum.TestReason); tieredLock.Lock(ETestTieredLockEnum.OtherTestReason); Assert.IsTrue(tieredLock.IsLocked()); }
public void Lock_MultipleLockedAndAllUnlocked_False() { var tieredLock = new TieredLock <ETestTieredLockEnum>(); tieredLock.Lock(ETestTieredLockEnum.TestReason); tieredLock.Lock(ETestTieredLockEnum.OtherTestReason); tieredLock.Unlock(ETestTieredLockEnum.OtherTestReason); tieredLock.Unlock(ETestTieredLockEnum.TestReason); Assert.IsFalse(tieredLock.IsLocked()); }
public void Lock_AlreadyLocked_ErrorAndStillLocked() { const ETestTieredLockEnum expectedReason = ETestTieredLockEnum.TestReason; LogAssert.Expect(LogType.Error, "Failed to lock! Already locked for reason " + expectedReason); var tieredLock = new TieredLock <ETestTieredLockEnum>(); tieredLock.Lock(ETestTieredLockEnum.TestReason); tieredLock.Lock(ETestTieredLockEnum.TestReason); Assert.IsTrue(tieredLock.IsLocked()); }
public void Lock_IsLocked_True() { var tieredLock = new TieredLock <ETestTieredLockEnum>(); tieredLock.Lock(ETestTieredLockEnum.TestReason); Assert.IsTrue(tieredLock.IsLocked()); }
public void Lock_UnlockAfterLocked_False() { var tieredLock = new TieredLock <ETestTieredLockEnum>(); tieredLock.Lock(ETestTieredLockEnum.TestReason); tieredLock.Unlock(ETestTieredLockEnum.TestReason); Assert.IsFalse(tieredLock.IsLocked()); }
public void SetHealthChangedEnabled(bool isEnabled, EHealthLockReason inReason) { if (isEnabled) { _healthChangeEnabled.Unlock(inReason); } else { _healthChangeEnabled.Lock(inReason); } }
public void SetStaminaChangeEnabled(bool isEnabled, ELockStaminaReason inReason) { if (!isEnabled) { _staminaLock.Lock(inReason); } else { _staminaLock.Unlock(inReason); } }
private void AlterLock(bool locking, EIntelligenceDisableReason inReason) { if (locking) { _thoughtLock.Lock(EIntelligenceDisableReason.Dead); if (ActiveGoal != null) { ActiveGoal.Terminate(); } } else { _thoughtLock.Unlock(EIntelligenceDisableReason.Dead); } }
private void AlterLock(bool locking, EVisionDisableReasons inReason) { if (locking) { _visionLock.Lock(inReason); if (_visionLock.IsLocked()) { gameObject.SetActive(false); } } else { _visionLock.Unlock(inReason); if (!_visionLock.IsLocked()) { gameObject.SetActive(true); } } }