From de003cb7056c8b332df461e75384ff9ee1dbb3a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Andr=C3=A9=20L=C3=A9ger?= Date: Tue, 14 Mar 2017 00:00:01 -0400 Subject: [PATCH] Mostly Done I merged dev into PA_Tweaks, but I haven't merged "down" to dev yet. Most conflicts should be resolved. Here's a recap of what's been done on this branch. - 3 rewind types selectable from TimeManager script - Fixed clone color code - Snapping camera to earliest clone - TimeManager script requires a reference to the camera assigned to the player - Everything is hardcoded to display 0 (if needed could put a field eventually that allows us to set this at will) - Warp bubble - not applied to main character yet, will do this ASAP but right now I got other stuff to do - there is a lifetime field in TimeManager and WarpBubble script, set those two fields to the same value if it's not done already (should be 20 I think). Will hardcode something once we settle on a value - The warp effect is a prefab whose state is modified by the engine's clock, so it should look/behave as expected when doing stuff "out of time". It's not super pretty but the implementation is robust and if we want to improve we could swap it with something else, as long as it is consistent with the actual interface - Pressure plate - All bugs related to pressure plates should be fixed - Clones will toggle off pressure plate when warping out - Plates will no longer trigger when disabling the LayerCollisions - Added a bool check for robustness As mentioned in #programmers, the lerp for the camera isn't done yet, it will require some reworking of the engine to make it look nice --- .../Assets/Prefabs/PressurePlate.prefab | 27 ++- .../Assets/Prefabs/TimeManager.prefab | 16 +- .../Assets/Scripts/CloneTimeAttachment.cs | 22 ++ .../Scripts/PuppyCharacterController.cs | 8 +- .../Assets/Scripts/TimeManager.cs | 77 ++++--- .../Assets/_Scenes/ProtoDemo.unity | 214 ++++++++++-------- Assets/Scripts/PrototypeDemo/PressurePlate.cs | 33 ++- ProjectSettings/TagManager.asset | 3 +- 8 files changed, 241 insertions(+), 159 deletions(-) diff --git a/Assets/PATimeRefactor/Assets/Prefabs/PressurePlate.prefab b/Assets/PATimeRefactor/Assets/Prefabs/PressurePlate.prefab index dda42f5..70fc5f8 100644 --- a/Assets/PATimeRefactor/Assets/Prefabs/PressurePlate.prefab +++ b/Assets/PATimeRefactor/Assets/Prefabs/PressurePlate.prefab @@ -21,9 +21,11 @@ GameObject: - component: {fileID: 4858338949452850} - component: {fileID: 33562989641879620} - component: {fileID: 23545392253009734} - m_Layer: 21 + - component: {fileID: 136578784881225250} + - component: {fileID: 114696680226765280} + m_Layer: 24 m_Name: Cylinder - m_TagString: Untagged + m_TagString: PressurePlateCollider m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 @@ -36,11 +38,9 @@ GameObject: serializedVersion: 5 m_Component: - component: {fileID: 4094971283816024} - - component: {fileID: 136116629899047188} - - component: {fileID: 114614349883559164} - m_Layer: 21 + m_Layer: 24 m_Name: PressurePlate - m_TagString: Untagged + m_TagString: PressurePlateCollider m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 @@ -52,7 +52,7 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1649229833953150} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 5.21, y: 0.7, z: -20.02} m_LocalScale: {x: 2, y: 1, z: 2} m_Children: - {fileID: 4858338949452850} @@ -110,27 +110,26 @@ MeshFilter: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 1036937098942168} m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!114 &114614349883559164 +--- !u!114 &114696680226765280 MonoBehaviour: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1649229833953150} + m_GameObject: {fileID: 1036937098942168} m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 1731d4eb5ab5db643aa6adfe9ccd22cb, type: 3} m_Name: m_EditorClassIdentifier: - mesh: {fileID: 1036937098942168} - active: {fileID: 2100000, guid: d126514c63e26c648b26342075574ffc, type: 2} - inactive: {fileID: 2100000, guid: 6d5cae7598648574fa97b3d331407a30, type: 2} + active: {fileID: 2100000, guid: 3756c7ca466ec3a4681fa05534341942, type: 2} + inactive: {fileID: 2100000, guid: 8e99a5ec37ac45441a88343e99837c54, type: 2} target: {fileID: 0} ---- !u!136 &136116629899047188 +--- !u!136 &136578784881225250 CapsuleCollider: m_ObjectHideFlags: 1 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 1649229833953150} + m_GameObject: {fileID: 1036937098942168} m_Material: {fileID: 0} m_IsTrigger: 1 m_Enabled: 1 diff --git a/Assets/PATimeRefactor/Assets/Prefabs/TimeManager.prefab b/Assets/PATimeRefactor/Assets/Prefabs/TimeManager.prefab index 78d8498..b79be17 100644 --- a/Assets/PATimeRefactor/Assets/Prefabs/TimeManager.prefab +++ b/Assets/PATimeRefactor/Assets/Prefabs/TimeManager.prefab @@ -51,11 +51,17 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 56ee9fea925a71a4aa590cd5774dd7da, type: 3} m_Name: m_EditorClassIdentifier: - m_RewindMode: 2 - playerLayer: Player - cloneLayer: Clone - doorLayer: Door DELETEME - aiLayer: Puppy AI + m_RewindMode: 0 + m_SnapCameraToClone: 1 + m_PlayerCamera: {fileID: 0} + m_WarpInPrefab: {fileID: 1233483338614074, guid: 70076f1ff7aa7d94dab217b667f7cb13, + type: 2} + m_WarpBubbleLife: 20 + m_PlayerLayer: Player + m_CloneLayer: Clone + m_DoorLayer: Door DELETEME + m_AILayer: Puppy AI + m_PlateLayer: PressurePlateCollider m_CloneColorCodes: - {r: 1, g: 0, b: 0, a: 0} - {r: 0, g: 0, b: 1, a: 0} diff --git a/Assets/PATimeRefactor/Assets/Scripts/CloneTimeAttachment.cs b/Assets/PATimeRefactor/Assets/Scripts/CloneTimeAttachment.cs index 75d33dd..2433705 100644 --- a/Assets/PATimeRefactor/Assets/Scripts/CloneTimeAttachment.cs +++ b/Assets/PATimeRefactor/Assets/Scripts/CloneTimeAttachment.cs @@ -20,6 +20,8 @@ public class CloneTimeAttachment : MonoBehaviour [HideInInspector] public GameObject timeManagerObject; + private PressurePlate m_PressurePlate; + public TimeManager manager { get; set; } public int m_TimelineID { get; set; } @@ -35,6 +37,7 @@ private void Awake() { m_Transform = GetComponent(); m_Agent = GetComponent(); + m_PressurePlate = null; } // Late to make sure that any disabling script has time to run @@ -55,7 +58,26 @@ private void OnTriggerEnter(Collider other) { manager.handleParadox(m_TimelineID); } + if (other.tag == "PressurePlateCollider") + { + m_PressurePlate = other.gameObject.GetComponentInParent(); + } + } + + private void OnTriggerExit(Collider other) + { + if (other.tag == "PressurePlateCollider") + { + m_PressurePlate = null; + } + } + public void pressureOff() + { + if (m_PressurePlate != null) + { + m_PressurePlate.forceExit(); + } } } diff --git a/Assets/PATimeRefactor/Assets/Scripts/PuppyCharacterController.cs b/Assets/PATimeRefactor/Assets/Scripts/PuppyCharacterController.cs index 7cb7c9d..2f5ffc5 100644 --- a/Assets/PATimeRefactor/Assets/Scripts/PuppyCharacterController.cs +++ b/Assets/PATimeRefactor/Assets/Scripts/PuppyCharacterController.cs @@ -48,7 +48,7 @@ public class PuppyCharacterController : MonoBehaviour { public bool m_IsLatched { get; set; } public bool m_IsHome { get; set; } - private PlayerTimeAttachment m_PlayerTimeAttachment; + private PlayerUserController m_PlayerUserController; private Vector3 m_HomePosition; private bool m_HaltPathing; @@ -57,7 +57,7 @@ private void Start() { m_Agent = GetComponent(); m_Character = GetComponent(); - m_PlayerTimeAttachment = m_Player.GetComponent(); + m_PlayerUserController = m_Player.GetComponent(); m_HomePosition = m_Home.GetComponent().position; m_Target = m_HomePosition; m_Agent.updateRotation = true; @@ -95,7 +95,7 @@ private void OnTriggerEnter(Collider other) if (other.tag == "Player") { - m_PlayerTimeAttachment.m_HasPuppy = true; + m_PlayerUserController.m_HasPuppy = true; } m_IsLatched = true; m_IsHome = false; @@ -107,7 +107,7 @@ private void OnTriggerEnter(Collider other) m_IsHome = true; m_IsLatched = false; m_Target = m_HomePosition; - m_PlayerTimeAttachment.m_HasPuppy = false; + m_PlayerUserController.m_HasPuppy = false; } } diff --git a/Assets/PATimeRefactor/Assets/Scripts/TimeManager.cs b/Assets/PATimeRefactor/Assets/Scripts/TimeManager.cs index 02bdc41..2aae62a 100644 --- a/Assets/PATimeRefactor/Assets/Scripts/TimeManager.cs +++ b/Assets/PATimeRefactor/Assets/Scripts/TimeManager.cs @@ -40,10 +40,11 @@ public enum GameState public GameState m_GameState { get; private set; } - public string playerLayer; - public string cloneLayer; - public string doorLayer; - public string aiLayer; + public string m_PlayerLayer; + public string m_CloneLayer; + public string m_DoorLayer; + public string m_AILayer; + public string m_PlateLayer; public bool m_WaitingForPlayer { get; set; } @@ -156,8 +157,12 @@ private void create(bool rewinding = false) haltClones(); } } - public void trashClone() + public void trashClone(bool onOpen = false) { + if (!onOpen && m_CloneTimeAttachment != null) + { + m_CloneTimeAttachment.pressureOff(); + } Destroy(m_CloneInstance); m_CloneTimeAttachment = null; m_CloneController = null; @@ -181,7 +186,7 @@ public void close(int end) public void open(int index) { m_End = -1; - trashClone(); + trashClone(true); trashBubble(); m_TimelineIndex = index; } @@ -274,7 +279,7 @@ public void runClones(bool rewinding = false) { if (m_WarpInInstance == null) { - m_WarpInInstance = Instantiate(m_WarpInPrefab, m_MasterArrayRef[m_TimelineIndex].m_DogPosition + new Vector3(0.0f, 1.0f, 0.0f), m_MasterArrayRef[m_TimelineIndex].m_DogRotation); + m_WarpInInstance = Instantiate(m_WarpInPrefab, m_MasterArrayRef[m_Start].m_DogPosition + new Vector3(0.0f, 1.0f, 0.0f), m_MasterArrayRef[m_Start].m_DogRotation); } m_WarpInInstance.GetComponent().m_CurrentIndex = m_TimelineIndex - m_Start; } @@ -282,7 +287,7 @@ public void runClones(bool rewinding = false) { if (m_WarpInInstance == null) { - m_WarpInInstance = Instantiate(m_WarpInPrefab, m_MasterArrayRef[m_TimelineIndex].m_DogPosition + new Vector3(0.0f, 1.0f, 0.0f), m_MasterArrayRef[m_TimelineIndex].m_DogRotation); + m_WarpInInstance = Instantiate(m_WarpInPrefab, m_MasterArrayRef[m_End].m_DogPosition + new Vector3(0.0f, 1.0f, 0.0f), m_MasterArrayRef[m_End].m_DogRotation); } m_WarpInInstance.GetComponent().m_CurrentIndex = m_TimelineIndex - m_End; } @@ -340,7 +345,7 @@ void Start() m_CurrentCamera = 0; // Disable collisions between clones - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(cloneLayer), true); + Physics.IgnoreLayerCollision(LayerMask.NameToLayer(m_CloneLayer), LayerMask.NameToLayer(m_CloneLayer), true); } // Not sure if this should go in FixedUpdate or Update, Fixed seemed safer and more stable (constant frame rate) @@ -363,8 +368,9 @@ void Update() { if (m_RestoreControlOnNextFrame) { - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(playerLayer), false); - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(doorLayer), false); + Physics.IgnoreLayerCollision(LayerMask.NameToLayer(m_CloneLayer), LayerMask.NameToLayer(m_PlayerLayer), false); + Physics.IgnoreLayerCollision(LayerMask.NameToLayer(m_CloneLayer), LayerMask.NameToLayer(m_DoorLayer), false); + Physics.IgnoreLayerCollision(LayerMask.NameToLayer(m_CloneLayer), LayerMask.NameToLayer(m_PlateLayer), false); m_GameState = GameState.NORMAL; m_RestoreControlOnNextFrame = false; } @@ -456,6 +462,9 @@ void Update() // Restore control m_RestoreControlOnNextFrame = true; + // Restore Puppy State + m_PuppyController.restoreState(m_MasterArray[m_MasterPointer]); + // Nudge pointers up // Place pointers to next position m_MasterPointer++; @@ -581,8 +590,10 @@ public void timeStopToggle(bool stopTime) m_GameState = GameState.REWIND; // Disable collisions - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(playerLayer), true); - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(doorLayer), true); + Physics.IgnoreLayerCollision(LayerMask.NameToLayer(m_CloneLayer), LayerMask.NameToLayer(m_PlayerLayer), true); + Physics.IgnoreLayerCollision(LayerMask.NameToLayer(m_CloneLayer), LayerMask.NameToLayer(m_DoorLayer), true); + Physics.IgnoreLayerCollision(LayerMask.NameToLayer(m_CloneLayer), LayerMask.NameToLayer(m_PlateLayer), true); + // Halt AIs for (int i = 0; i < m_ActiveTimeline; i++) @@ -647,7 +658,7 @@ public void masterScrub(int amount, int flipOffset = 0) if (m_ActiveTimeline != i) m_Timelines[i].runClones(true); else - m_Timelines[i].trashClone(); + m_Timelines[i].trashClone(true); } #endregion @@ -672,28 +683,22 @@ public void masterScrub(int amount, int flipOffset = 0) #endregion // Special case when rewinding (duct tape used here, more robust solution will follow) - if (m_SnapCameraToClone) + if (m_SnapCameraToClone && m_GameState == GameState.REWIND) { - if (m_Timelines[m_CurrentCamera].m_TimelineIndex == m_Timelines[m_CurrentCamera].m_Start + 1 && m_CurrentCamera != 0) + // Find the "latest" running timeline + for (int i = m_ActiveTimeline - 1; i >= 0; i--) { - m_Timelines[m_CurrentCamera].activateCamera(false); - m_CurrentCamera--; - m_Timelines[m_CurrentCamera].activateCamera(true); - - } - else if ( - m_CurrentCamera != m_ActiveTimeline - 1 - && - ( - ( m_Timelines[m_CurrentCamera + 1].m_TimelineIndex <= m_Timelines[m_CurrentCamera + 1].m_End - 1) + if ( + (m_Timelines[i].m_TimelineIndex <= m_Timelines[i].m_End - 1) && - ( m_Timelines[m_CurrentCamera + 1].m_TimelineIndex >= m_Timelines[m_CurrentCamera + 1].m_Start + 1) + (m_Timelines[i].m_TimelineIndex >= m_Timelines[i].m_Start + 1) ) - ) - { - m_Timelines[m_CurrentCamera].activateCamera(false); - m_CurrentCamera++; - m_Timelines[m_CurrentCamera].activateCamera(true); + { + m_Timelines[m_CurrentCamera].activateCamera(false); + m_CurrentCamera = i; + m_Timelines[m_CurrentCamera].activateCamera(true); + break; + } } } } @@ -713,9 +718,11 @@ public void handleParadox(int idToRevert, Transform lastPos = null) m_GameState = GameState.PARADOX; // Disable collisions - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(playerLayer), true); - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(doorLayer), true); - + Physics.IgnoreLayerCollision(LayerMask.NameToLayer(m_CloneLayer), LayerMask.NameToLayer(m_PlayerLayer), true); + Physics.IgnoreLayerCollision(LayerMask.NameToLayer(m_CloneLayer), LayerMask.NameToLayer(m_DoorLayer), true); + Physics.IgnoreLayerCollision(LayerMask.NameToLayer(m_CloneLayer), LayerMask.NameToLayer(m_PlateLayer), true); + + // Fetch revert targert m_RevertTimeline = idToRevert; diff --git a/Assets/PATimeRefactor/Assets/_Scenes/ProtoDemo.unity b/Assets/PATimeRefactor/Assets/_Scenes/ProtoDemo.unity index d6f0adb..16b7be2 100644 --- a/Assets/PATimeRefactor/Assets/_Scenes/ProtoDemo.unity +++ b/Assets/PATimeRefactor/Assets/_Scenes/ProtoDemo.unity @@ -793,6 +793,12 @@ MeshFilter: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 92219059} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!114 &126994619 stripped +MonoBehaviour: + m_PrefabParentObject: {fileID: 114453480206080400, guid: 830eaf2f6e360bf428bd57f4ca1780de, + type: 2} + m_PrefabInternal: {fileID: 1077808750} + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} --- !u!1 &131625008 GameObject: m_ObjectHideFlags: 0 @@ -1256,7 +1262,7 @@ Transform: - {fileID: 810997269} - {fileID: 2000751157} m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &242645884 GameObject: @@ -1382,7 +1388,7 @@ Prefab: propertyPath: m_Name value: PressurePlate (2) objectReference: {fileID: 0} - - target: {fileID: 114614349883559164, guid: 868df6ca073273b46b0d14bf91e88925, + - target: {fileID: 114696680226765280, guid: 868df6ca073273b46b0d14bf91e88925, type: 2} propertyPath: target value: @@ -2352,12 +2358,6 @@ MeshFilter: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 481006215} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!114 &487745951 stripped -MonoBehaviour: - m_PrefabParentObject: {fileID: 114453480206080400, guid: 830eaf2f6e360bf428bd57f4ca1780de, - type: 2} - m_PrefabInternal: {fileID: 1765468880} - m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} --- !u!1 &489868668 stripped GameObject: m_PrefabParentObject: {fileID: 1649229833953150, guid: 868df6ca073273b46b0d14bf91e88925, @@ -2367,6 +2367,26 @@ GameObject: GameObject: m_PrefabParentObject: {fileID: 113348, guid: 2d533fcc5b921e84fb52a950e55bdce1, type: 2} m_PrefabInternal: {fileID: 1009763484} +--- !u!114 &490939859 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 490939858} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5e8262e11a299ef4bbe3fea2436fb6a6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_MovingTurnSpeed: 360 + m_StationaryTurnSpeed: 180 + m_JumpPower: 12 + m_GravityMultiplier: 2 + m_RunCycleLegOffset: 0.2 + m_MoveSpeedMultiplier: 1 + m_GroundCheckDistance: 0.1 + walkingAnimatorSpeed: 0 + loveEmoteAnimatorSpeed: 0 --- !u!1 &498487761 GameObject: m_ObjectHideFlags: 0 @@ -2809,7 +2829,7 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 408730, guid: 160f96e74f524c04997050bb5bed7e41, type: 2} propertyPath: m_RootOrder - value: 6 + value: 5 objectReference: {fileID: 0} - target: {fileID: 496262, guid: 160f96e74f524c04997050bb5bed7e41, type: 2} propertyPath: m_LocalRotation.x @@ -2836,9 +2856,35 @@ Prefab: propertyPath: m_Materials.Array.data[0] value: objectReference: {fileID: 2100000, guid: 0dec6b6597e6565408d73421e9c33492, type: 2} - m_RemovedComponents: [] + - target: {fileID: 20632672145231736, guid: 160f96e74f524c04997050bb5bed7e41, + type: 2} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 20632672145231736, guid: 160f96e74f524c04997050bb5bed7e41, + type: 2} + propertyPath: m_TargetDisplay + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114896590231832898, guid: 160f96e74f524c04997050bb5bed7e41, + type: 2} + propertyPath: m_ScrubSpeed + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114896590231832898, guid: 160f96e74f524c04997050bb5bed7e41, + type: 2} + propertyPath: m_IsRewindController + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: + - {fileID: 114755739237096388, guid: 160f96e74f524c04997050bb5bed7e41, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 160f96e74f524c04997050bb5bed7e41, type: 2} m_IsPrefabParent: 0 +--- !u!20 &562300695 stripped +Camera: + m_PrefabParentObject: {fileID: 20632672145231736, guid: 160f96e74f524c04997050bb5bed7e41, + type: 2} + m_PrefabInternal: {fileID: 555583450} --- !u!1 &605923022 GameObject: m_ObjectHideFlags: 0 @@ -4644,8 +4690,13 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 4658824392053904, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, type: 2} propertyPath: m_RootOrder - value: 4 + value: 3 objectReference: {fileID: 0} + - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, + type: 2} + propertyPath: m_PlayerCamera + value: + objectReference: {fileID: 562300695} - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, type: 2} propertyPath: m_Player @@ -4660,33 +4711,7 @@ Prefab: type: 2} propertyPath: m_Text value: - objectReference: {fileID: 487745951} - - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, - type: 2} - propertyPath: m_RewindMode - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, - type: 2} - propertyPath: m_SnapCameraToClone - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, - type: 2} - propertyPath: m_PlayerCamera - value: - objectReference: {fileID: 1939261668} - - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, - type: 2} - propertyPath: m_WarpInPrefab - value: - objectReference: {fileID: 1233483338614074, guid: 70076f1ff7aa7d94dab217b667f7cb13, - type: 2} - - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, - type: 2} - propertyPath: m_WarpBubbleLife - value: 20 - objectReference: {fileID: 0} + objectReference: {fileID: 126994619} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, type: 2} m_IsPrefabParent: 0 @@ -4752,25 +4777,26 @@ Prefab: objectReference: {fileID: 1467817728} - target: {fileID: 454696, guid: 2d533fcc5b921e84fb52a950e55bdce1, type: 2} propertyPath: m_LocalRotation.x - value: 0.53267515 + value: 0.5326752 objectReference: {fileID: 0} - target: {fileID: 454696, guid: 2d533fcc5b921e84fb52a950e55bdce1, type: 2} propertyPath: m_LocalRotation.y - value: 0.07034045 + value: 0.070340455 objectReference: {fileID: 0} - target: {fileID: 454696, guid: 2d533fcc5b921e84fb52a950e55bdce1, type: 2} propertyPath: m_LocalRotation.z - value: 0.83613265 + value: 0.83613276 objectReference: {fileID: 0} - target: {fileID: 454696, guid: 2d533fcc5b921e84fb52a950e55bdce1, type: 2} propertyPath: m_LocalRotation.w - value: -0.11041513 + value: -0.110415146 objectReference: {fileID: 0} - target: {fileID: 113348, guid: 2d533fcc5b921e84fb52a950e55bdce1, type: 2} propertyPath: m_Name value: Puppy objectReference: {fileID: 0} - m_RemovedComponents: [] + m_RemovedComponents: + - {fileID: 114105686675771950, guid: 2d533fcc5b921e84fb52a950e55bdce1, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 2d533fcc5b921e84fb52a950e55bdce1, type: 2} m_IsPrefabParent: 0 --- !u!1 &1014896409 @@ -4966,6 +4992,53 @@ MeshFilter: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1076416240} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1001 &1077808750 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} + propertyPath: m_LocalPosition.x + value: -20.9 + objectReference: {fileID: 0} + - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} + propertyPath: m_LocalPosition.y + value: 32.01 + objectReference: {fileID: 0} + - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} + propertyPath: m_LocalPosition.z + value: -10.9 + objectReference: {fileID: 0} + - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} + propertyPath: m_LocalRotation.x + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} + propertyPath: m_LocalRotation.w + value: 0.7071068 + objectReference: {fileID: 0} + - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} + propertyPath: m_RootOrder + value: 8 + objectReference: {fileID: 0} + - target: {fileID: 20423056833094536, guid: 830eaf2f6e360bf428bd57f4ca1780de, + type: 2} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} + m_IsPrefabParent: 0 --- !u!1 &1123727625 stripped GameObject: m_PrefabParentObject: {fileID: 1649229833953150, guid: 868df6ca073273b46b0d14bf91e88925, @@ -5791,7 +5864,7 @@ Prefab: propertyPath: m_Name value: PressurePlate (1) objectReference: {fileID: 0} - - target: {fileID: 114614349883559164, guid: 868df6ca073273b46b0d14bf91e88925, + - target: {fileID: 114696680226765280, guid: 868df6ca073273b46b0d14bf91e88925, type: 2} propertyPath: target value: @@ -6223,7 +6296,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 8 + m_RootOrder: 7 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1479098833 GameObject: @@ -6772,7 +6845,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 + m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} --- !u!1 &1544164915 GameObject: @@ -8347,48 +8420,6 @@ MeshFilter: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1750368987} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1001 &1765468880 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} - propertyPath: m_LocalPosition.x - value: -20.9 - objectReference: {fileID: 0} - - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} - propertyPath: m_LocalPosition.y - value: 53.6 - objectReference: {fileID: 0} - - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} - propertyPath: m_LocalPosition.z - value: -10.9 - objectReference: {fileID: 0} - - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} - propertyPath: m_LocalRotation.x - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} - propertyPath: m_LocalRotation.w - value: 0.7071068 - objectReference: {fileID: 0} - - target: {fileID: 4102610720279262, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} - m_IsPrefabParent: 0 --- !u!1 &1783550391 GameObject: m_ObjectHideFlags: 0 @@ -9099,11 +9130,6 @@ Transform: m_Father: {fileID: 1946650929} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} ---- !u!20 &1939261668 stripped -Camera: - m_PrefabParentObject: {fileID: 20423056833094536, guid: 830eaf2f6e360bf428bd57f4ca1780de, - type: 2} - m_PrefabInternal: {fileID: 1765468880} --- !u!1 &1946650928 GameObject: m_ObjectHideFlags: 0 @@ -9139,7 +9165,7 @@ Transform: - {fileID: 16410244} - {fileID: 73675885} m_Father: {fileID: 0} - m_RootOrder: 7 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1947853498 GameObject: diff --git a/Assets/Scripts/PrototypeDemo/PressurePlate.cs b/Assets/Scripts/PrototypeDemo/PressurePlate.cs index 2a757e0..05ee90f 100644 --- a/Assets/Scripts/PrototypeDemo/PressurePlate.cs +++ b/Assets/Scripts/PrototypeDemo/PressurePlate.cs @@ -4,26 +4,47 @@ public class PressurePlate : MonoBehaviour { - public GameObject mesh; public Material active; public Material inactive; public GameObject target; + private bool m_IsActive; void Start() { - mesh.GetComponent().material = inactive; + gameObject.GetComponent().material = inactive; + m_IsActive = false; + } + + public void forceExit() + { + if (m_IsActive) + { + m_IsActive = false; + target.GetComponent().DecCount(); + gameObject.GetComponent().material = inactive; + } } private void OnTriggerEnter(Collider other) { - target.GetComponent().IncCount(); - mesh.GetComponent().material = active; + if (!m_IsActive && (other.tag == "Player" || other.tag == "Clone") ) + { + m_IsActive = true; + target.GetComponent().IncCount(); + gameObject.GetComponent().material = active; + } + } private void OnTriggerExit(Collider other) { - target.GetComponent().DecCount(); - mesh.GetComponent().material = inactive; + if (m_IsActive && (other.tag == "Player" || other.tag == "Clone") ) + { + m_IsActive = false; + target.GetComponent().DecCount(); + gameObject.GetComponent().material = inactive; + } + } } diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 5e450a3..9543f9f 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -26,6 +26,7 @@ TagManager: - TimeLine - CanvasGroundCharacter - PlayerTimeLine + - PressurePlateCollider layers: - Default - TransparentFX @@ -51,7 +52,7 @@ TagManager: - Door DELETEME - Puppy AI - OSPointer - - + - PressurePlateCollider - - -