Commit d4ffe0b9 authored by Pinguin's avatar Pinguin
Browse files

better doorsounds in the lab

parent fb9c4b2f
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Door))]
[CanEditMultipleObjects]
public class DoorEditor : Editor
{
Door component;
SerializedProperty doorMode, anchorOpen, anchorClosed, slammdistance, duration, open, openSFX, closeSFX, slammSFX, deactivatable;
private void OnEnable()
{
doorMode = serializedObject.FindProperty("doorMode");
anchorOpen = serializedObject.FindProperty("anchorOpen");
anchorClosed = serializedObject.FindProperty("anchorClosed");
slammdistance = serializedObject.FindProperty("slammdistance");
duration = serializedObject.FindProperty("duration");
open = serializedObject.FindProperty("open");
openSFX = serializedObject.FindProperty("openSFX");
closeSFX = serializedObject.FindProperty("closeSFX");
slammSFX = serializedObject.FindProperty("slammSFX");
deactivatable = serializedObject.FindProperty("deactivate");
component = (Door)target;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
EditorGUILayout.PropertyField(doorMode);
switch (component.doorMode)
{
case Door.DoorMode.INTERACTABLE:
EditorGUILayout.PropertyField(anchorOpen);
EditorGUILayout.PropertyField(openSFX);
EditorGUILayout.PropertyField(closeSFX);
break;
case Door.DoorMode.SLAMMSHUT:
EditorGUILayout.PropertyField(slammdistance);
EditorGUILayout.PropertyField(slammSFX);
break;
case Door.DoorMode.INTERANDCLOSE:
EditorGUILayout.PropertyField(anchorOpen);
EditorGUILayout.PropertyField(openSFX);
EditorGUILayout.PropertyField(closeSFX);
EditorGUILayout.PropertyField(slammSFX);
EditorGUILayout.PropertyField(deactivatable);
break;
}
EditorGUILayout.PropertyField(anchorClosed);
EditorGUILayout.PropertyField(duration);
EditorGUILayout.PropertyField(open);
serializedObject.ApplyModifiedProperties();
}
}
fileFormatVersion: 2
guid: aecf746f2882b9d49a7834bf3b65750e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -9,8 +9,8 @@ public class Door : MonoBehaviour, IInteractable
public DoorMode doorMode;
public Transform anchorOpen, anchorClosed;
public AudioClip closeSFX, openSFX, slammSFX;
public float duration = 1f, slammdistance = 5f, closedoorDelay = .7f;
public AudioClip closeSFX, closeSFX2, closeSFX3, openSFX, slammSFX;
public float duration = 1f, slammdistance = 5f, closedoorDelay = .2f, closedoorDelay2 = .4f, closedoorDelay3 = .7f;
public bool open, iacDone;
public GameObject deactivate;
......@@ -41,6 +41,8 @@ public class Door : MonoBehaviour, IInteractable
mover?.Kill();
mover = DOTween.Sequence().Append(transform.DOLocalRotate(anchorClosed.localEulerAngles, duration).SetEase(Ease.OutBounce));
audio = DOTween.Sequence().AppendInterval(closedoorDelay).AppendCallback(() => { auds.PlayOneShot(closeSFX); });
DOTween.Sequence().AppendInterval(closedoorDelay2).AppendCallback(() => { auds.PlayOneShot(closeSFX2); });
DOTween.Sequence().AppendInterval(closedoorDelay3).AppendCallback(() => { auds.PlayOneShot(closeSFX3); });
if (doorMode == DoorMode.INTERANDCLOSE && deactivate) deactivate.SetActive(false);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment