public void Lock_IsLocked_True() { var tieredLock = new TieredLock <ETestTieredLockEnum>(); tieredLock.Lock(ETestTieredLockEnum.TestReason); Assert.IsTrue(tieredLock.IsLocked()); }
private bool CanAdjustHealth() { if (_healthChangeEnabled != null) { return(!_healthChangeEnabled.IsLocked()); } return(false); }
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_UnlockAfterLocked_False() { var tieredLock = new TieredLock <ETestTieredLockEnum>(); tieredLock.Lock(ETestTieredLockEnum.TestReason); tieredLock.Unlock(ETestTieredLockEnum.TestReason); Assert.IsFalse(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()); }
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); } } }
public void Unlock_AlreadyUnlocked_ErrorAndStillUnlocked() { const ETestTieredLockEnum expectedReason = ETestTieredLockEnum.TestReason; LogAssert.Expect(LogType.Error, "Failed to unlock! Not locked with reason " + expectedReason); var tieredLock = new TieredLock <ETestTieredLockEnum>(); 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()); }
protected void Update() { if (_thoughtLock.IsLocked()) { return; } if (ActiveGoal == null) { ActiveGoal = GetMostDesirableGoal(); return; } var deltaTime = GetDeltaTime(); var updateResult = ActiveGoal.Update(deltaTime); switch (updateResult) { case EGoalStatus.Completed: case EGoalStatus.Failed: ActiveGoal.Terminate(); ActiveGoal = GetMostDesirableGoal(); ActiveGoal.Initialise(); break; case EGoalStatus.InProgress: var mostDesirableGoal = GetMostDesirableGoal(); if (mostDesirableGoal != null && mostDesirableGoal != ActiveGoal) { ActiveGoal = mostDesirableGoal; } break; default: break; } }
public void Creation_IsLocked_False() { var tieredLock = new TieredLock <ETestTieredLockEnum>(); Assert.IsFalse(tieredLock.IsLocked()); }
// ~IStaminaInterface private bool CanAdjustStamina() { return(!_staminaLock.IsLocked()); }