Exemple #1
0
        public void Lock_MultipleLocks_True()
        {
            var tieredLock = new TieredLock <ETestTieredLockEnum>();

            tieredLock.Lock(ETestTieredLockEnum.TestReason);
            tieredLock.Lock(ETestTieredLockEnum.OtherTestReason);

            Assert.IsTrue(tieredLock.IsLocked());
        }
Exemple #2
0
        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());
        }
Exemple #3
0
        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());
        }
Exemple #4
0
        public void Lock_IsLocked_True()
        {
            var tieredLock = new TieredLock <ETestTieredLockEnum>();

            tieredLock.Lock(ETestTieredLockEnum.TestReason);

            Assert.IsTrue(tieredLock.IsLocked());
        }
Exemple #5
0
        public void Lock_UnlockAfterLocked_False()
        {
            var tieredLock = new TieredLock <ETestTieredLockEnum>();

            tieredLock.Lock(ETestTieredLockEnum.TestReason);
            tieredLock.Unlock(ETestTieredLockEnum.TestReason);

            Assert.IsFalse(tieredLock.IsLocked());
        }
Exemple #6
0
 public void SetHealthChangedEnabled(bool isEnabled, EHealthLockReason inReason)
 {
     if (isEnabled)
     {
         _healthChangeEnabled.Unlock(inReason);
     }
     else
     {
         _healthChangeEnabled.Lock(inReason);
     }
 }
Exemple #7
0
 public void SetStaminaChangeEnabled(bool isEnabled, ELockStaminaReason inReason)
 {
     if (!isEnabled)
     {
         _staminaLock.Lock(inReason);
     }
     else
     {
         _staminaLock.Unlock(inReason);
     }
 }
Exemple #8
0
        private void AlterLock(bool locking, EIntelligenceDisableReason inReason)
        {
            if (locking)
            {
                _thoughtLock.Lock(EIntelligenceDisableReason.Dead);

                if (ActiveGoal != null)
                {
                    ActiveGoal.Terminate();
                }
            }
            else
            {
                _thoughtLock.Unlock(EIntelligenceDisableReason.Dead);
            }
        }
Exemple #9
0
        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);
                }
            }
        }