// Close Lid public void Close(eLockStatus LockStatus) { if (IsOpened()) { Close(m_CloseDuration, LockStatus); } }
// Close Lid public void Close(float time, eLockStatus LockStatus) { // Lid can be closed when it is not between opening or closing if (IsOpened()) { m_CloseDuration = time; m_LidStatus = eState.Close; if (m_LockStatus != LockStatus) { SetLock(LockStatus); } } }
// Set Lock Status public void SetLock(eLockStatus LockStatus) { if (m_ChangingState == false && m_LidStatus == eState.Close) { m_LockStatus = LockStatus; /* * // Display Lock status on Console * if (m_LockStatus != m_LockStatusOld) * { * if(m_LockStatus==eLockStatus.Free) * Debug.Log(this.name + ": Unlocked"); * else * Debug.Log(this.name + ": Locked"); * }*/ } // Play chest open failed bounce animation PlayChestOpenFailedBounceAnimation(m_Main.m_BounceForce / 5); }
// ######################################## // Play Sound Functions // ######################################## #region Playsound Functions // Play Lock/Unlock sound when lock state is changed void PlaySoundWhenLockStateChanged() { if (m_LockStatus != m_LockStatusOld) { // Plack Lock sound if (m_LockStatus == eLockStatus.Locked) { if (m_Main.getSound() != null) { if (m_Main.getSound().enabled == true) { if (m_LidStatus == eState.Close) { m_Main.getSound().PlaySoundSetLock(); } } } } // Play Unlock sound else if (m_LockStatus == eLockStatus.Free) { if (m_Main.getSound() != null) { if (m_Main.getSound().enabled == true) { if (m_LidStatus == eState.Close) { m_Main.getSound().PlaySoundSetUnlock(); } } } } // Replace old lock status with current status m_LockStatusOld = m_LockStatus; } }