void Update() { float fRatio; switch (m_iState) { // Case fall-through does work in C# case Types.EDoorwayCollisionState._IDLE_OPEN: case Types.EDoorwayCollisionState._IDLE_CLOSED: break; case Types.EDoorwayCollisionState._OPENING: fRatio = (TimerManager.fGameTime - m_fEventTime) / Types.s_fDUR_DoorCloseDuration; transform.position = Vector3.Lerp(m_vClosedPosition, m_vOpenPosition, Easing.EaseOut(fRatio, EEasingType.Quartic)); if (fRatio >= 1.0f) { m_iState = Types.EDoorwayCollisionState._IDLE_OPEN; GameInstance.Object.GetAudioManager().PlayAudioAtLocation(transform.position, EGameSFX._SFX_DOOR_SHUT); } break; case Types.EDoorwayCollisionState._CLOSING: fRatio = (TimerManager.fGameTime - m_fEventTime) / Types.s_fDUR_DoorCloseDuration; transform.position = Vector3.Lerp(m_vOpenPosition, m_vClosedPosition, Easing.EaseOut(fRatio, EEasingType.Quartic)); if (fRatio >= 1.0f) { m_iState = Types.EDoorwayCollisionState._IDLE_CLOSED; GameInstance.Object.GetAudioManager().PlayAudioAtLocation(transform.position, EGameSFX._SFX_DOOR_SHUT); } break; } }
public void Close() { m_fEventTime = TimerManager.fGameTime; m_iState = Types.EDoorwayCollisionState._CLOSING; GameInstance.Object.GetAudioManager().PlayAudioAtLocation(transform.position, EGameSFX._SFX_DOOR_SLIDE_DOWN); }