diff --git a/.gitignore b/.gitignore index 106dbad..4cfb8f9 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,8 @@ /Assets/gmcs.rsp.meta /Assets/smcs.rsp.meta /Assets/us.rsp.meta +/Assets/PATimeRefactor/Library/ + # Autogenerated VS/MD solution and project files ExportedObj/ @@ -27,6 +29,7 @@ ExportedObj/ *.pidb *.booproj *.svd +*.gitignore # Unity3D generated meta files diff --git a/Assets/PATimeRefactor/Assets/Materials/Bolt.mat b/Assets/PATimeRefactor/Assets/Materials/Bolt.mat new file mode 100644 index 0000000..96bf368 --- /dev/null +++ b/Assets/PATimeRefactor/Assets/Materials/Bolt.mat @@ -0,0 +1,130 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: Bolt + m_Shader: {fileID: 202, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: _ALPHAPREMULTIPLY_ON _EMISSION + m_LightmapFlags: 1 + m_CustomRenderQueue: -1 + stringTagMap: {} + m_SavedProperties: + serializedVersion: 2 + m_TexEnvs: + - first: + name: _BumpMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailAlbedoMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailMask + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _DetailNormalMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _EmissionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _MainTex + second: + m_Texture: {fileID: 2800000, guid: 917df88c3872d05428ad7d65fc2e64a2, type: 3} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _MetallicGlossMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _OcclusionMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - first: + name: _ParallaxMap + second: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - first: + name: _BumpScale + second: 1 + - first: + name: _Cutoff + second: 0.5 + - first: + name: _DetailNormalMapScale + second: 1 + - first: + name: _DstBlend + second: 10 + - first: + name: _GlossMapScale + second: 1 + - first: + name: _Glossiness + second: 0.5 + - first: + name: _GlossyReflections + second: 1 + - first: + name: _InvFade + second: 1 + - first: + name: _Metallic + second: 0 + - first: + name: _Mode + second: 3 + - first: + name: _OcclusionStrength + second: 1 + - first: + name: _Parallax + second: 0.02 + - first: + name: _SmoothnessTextureChannel + second: 0 + - first: + name: _SpecularHighlights + second: 1 + - first: + name: _SrcBlend + second: 1 + - first: + name: _UVSec + second: 0 + - first: + name: _ZWrite + second: 0 + m_Colors: + - first: + name: _Color + second: {r: 1, g: 1, b: 1, a: 1} + - first: + name: _EmissionColor + second: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/PATimeRefactor/Assets/Materials/Bolt.mat.meta b/Assets/PATimeRefactor/Assets/Materials/Bolt.mat.meta new file mode 100644 index 0000000..3afc9a6 --- /dev/null +++ b/Assets/PATimeRefactor/Assets/Materials/Bolt.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d65ebee22e82b0841a319fae44ee3e77 +timeCreated: 1489368450 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PATimeRefactor/Assets/Models/Materials.meta b/Assets/PATimeRefactor/Assets/Models/Materials.meta new file mode 100644 index 0000000..43b619c --- /dev/null +++ b/Assets/PATimeRefactor/Assets/Models/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 0bdb1965007dfdd4ca66780da536d429 +folderAsset: yes +timeCreated: 1489102865 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PATimeRefactor/Assets/Prefabs/Clone.prefab b/Assets/PATimeRefactor/Assets/Prefabs/Clone.prefab index c3d08af..2722854 100644 --- a/Assets/PATimeRefactor/Assets/Prefabs/Clone.prefab +++ b/Assets/PATimeRefactor/Assets/Prefabs/Clone.prefab @@ -1359,13 +1359,14 @@ Transform: m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 149790} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 4.07, y: 4.3, z: 5.044979} + m_LocalPosition: {x: -1.7934971, y: 0.5, z: 2.5302665} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 469942} - {fileID: 448028} - {fileID: 4966505376668596} - {fileID: 4391902850973756} + - {fileID: 4429201076807062} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -2381,7 +2382,7 @@ Transform: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 100100000} m_GameObject: {fileID: 100098} - m_LocalRotation: {x: 0.53267515, y: 0.07034045, z: 0.83613265, w: -0.11041513} + m_LocalRotation: {x: 0.5326752, y: 0.070340455, z: 0.83613276, w: -0.110415146} m_LocalPosition: {x: 0.000022271464, y: -0.00006150465, z: 0.026027026} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: @@ -2627,6 +2628,22 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 +--- !u!1 &1710866932611048 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4429201076807062} + - component: {fileID: 20990877827596502} + m_Layer: 19 + m_Name: Camera + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 --- !u!4 &4391902850973756 Transform: m_ObjectHideFlags: 1 @@ -2640,6 +2657,19 @@ Transform: m_Father: {fileID: 408730} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!4 &4429201076807062 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1710866932611048} + m_LocalRotation: {x: 0.1507789, y: 0, z: 0, w: 0.98856753} + m_LocalPosition: {x: 0, y: 1.34, z: -1.77} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 408730} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!4 &4966505376668596 Transform: m_ObjectHideFlags: 1 @@ -2653,6 +2683,40 @@ Transform: m_Father: {fileID: 408730} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!20 &20990877827596502 +Camera: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1710866932611048} + m_Enabled: 0 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 --- !u!23 &23291982028441632 MeshRenderer: m_ObjectHideFlags: 1 @@ -2813,6 +2877,7 @@ MonoBehaviour: m_EditorClassIdentifier: timeManagerObject: {fileID: 0} m_BlockingParadoxRange: 4 + m_EnablePuppyParadox: 0 --- !u!114 &114828841032397870 MonoBehaviour: m_ObjectHideFlags: 1 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 56a7ee6..b79be17 100644 --- a/Assets/PATimeRefactor/Assets/Prefabs/TimeManager.prefab +++ b/Assets/PATimeRefactor/Assets/Prefabs/TimeManager.prefab @@ -51,14 +51,21 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 56ee9fea925a71a4aa590cd5774dd7da, type: 3} m_Name: m_EditorClassIdentifier: - playerLayer: Player - cloneLayer: Clone - doorLayer: Door DELETEME - aiLayer: Puppy AI - cloneColorCodes: + 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.37931037, b: 1, a: 0} - - {r: 0.94482756, g: 1, b: 0, a: 0} + - {r: 0, g: 0, b: 1, a: 0} + - {r: 0, g: 1, b: 0, a: 0} sampleRate: 3 m_Player: {fileID: 0} m_ClonePrefab: {fileID: 149790, guid: 3a65e8fe82479404e96efe155a409605, type: 2} diff --git a/Assets/PATimeRefactor/Assets/Prefabs/WarpBubble.prefab b/Assets/PATimeRefactor/Assets/Prefabs/WarpBubble.prefab new file mode 100644 index 0000000..6780fdb --- /dev/null +++ b/Assets/PATimeRefactor/Assets/Prefabs/WarpBubble.prefab @@ -0,0 +1,96 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 1233483338614074} + m_IsPrefabParent: 1 +--- !u!1 &1233483338614074 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 5 + m_Component: + - component: {fileID: 4272443431116150} + - component: {fileID: 33222267568471874} + - component: {fileID: 23705518616939126} + - component: {fileID: 114559152340339248} + m_Layer: 0 + m_Name: WarpBubble + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4272443431116150 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1233483338614074} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -2.0589602, y: 1, z: 0.8724208} + m_LocalScale: {x: 2, y: 2, z: 2} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!23 &23705518616939126 +MeshRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1233483338614074} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_Materials: + - {fileID: 2100000, guid: d65ebee22e82b0841a319fae44ee3e77, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 +--- !u!33 &33222267568471874 +MeshFilter: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1233483338614074} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!114 &114559152340339248 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 1233483338614074} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2fd4765b167bfbc44afdc067f80d8b86, type: 3} + m_Name: + m_EditorClassIdentifier: + m_MaxXTiling: 3 + m_MaxYTiling: 5 + m_LifeTime: 20 diff --git a/Assets/PATimeRefactor/Assets/Prefabs/WarpBubble.prefab.meta b/Assets/PATimeRefactor/Assets/Prefabs/WarpBubble.prefab.meta new file mode 100644 index 0000000..04a089b --- /dev/null +++ b/Assets/PATimeRefactor/Assets/Prefabs/WarpBubble.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 70076f1ff7aa7d94dab217b667f7cb13 +timeCreated: 1489446991 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PATimeRefactor/Assets/Scripts/CloneTimeAttachment.cs b/Assets/PATimeRefactor/Assets/Scripts/CloneTimeAttachment.cs index 12fdf0f..2433705 100644 --- a/Assets/PATimeRefactor/Assets/Scripts/CloneTimeAttachment.cs +++ b/Assets/PATimeRefactor/Assets/Scripts/CloneTimeAttachment.cs @@ -20,8 +20,10 @@ public class CloneTimeAttachment : MonoBehaviour [HideInInspector] public GameObject timeManagerObject; + private PressurePlate m_PressurePlate; + public TimeManager manager { get; set; } - public int timelineID { get; set; } + public int m_TimelineID { get; set; } public float m_BlockingParadoxRange; @@ -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 @@ -44,7 +47,7 @@ private void LateUpdate() // Blocking Paradox if (m_Agent.remainingDistance > m_BlockingParadoxRange && m_Agent.remainingDistance != Mathf.Infinity) { - manager.handleParadox(timelineID, m_Transform); + manager.handleParadox(m_TimelineID, m_Transform); } } @@ -53,9 +56,28 @@ private void OnTriggerEnter(Collider other) { if (other.tag == "Player" || (m_EnablePuppyParadox && other.tag == "Puppy") ) { - manager.handleParadox(timelineID); + 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/PlayerTimeAttachment.cs b/Assets/PATimeRefactor/Assets/Scripts/PlayerTimeAttachment.cs deleted file mode 100644 index 0a27e8d..0000000 --- a/Assets/PATimeRefactor/Assets/Scripts/PlayerTimeAttachment.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityStandardAssets.CrossPlatformInput; - -public class PlayerTimeAttachment : MonoBehaviour { - - public GameObject m_TimeManager; - public float scrubSpeed; - - private TimeManager m_Manager; - private Character m_Player; - public bool m_HasPuppy { get; set; } - - void Start () { - m_Manager = m_TimeManager.GetComponent(); - m_Player = gameObject.GetComponent(); - m_HasPuppy = false; - } - - void Update () { - - float FF = CrossPlatformInputManager.GetAxis("FF"); - float RW = CrossPlatformInputManager.GetAxis("RW"); - - // Prevent the dog from stopping time if there is a puppy with him - - if (Input.GetButtonDown("Ground Stop Time") && !m_HasPuppy) - { - m_Manager.timeStopToggle(); - } - if (Input.GetButtonUp("Ground Stop Time") && !m_HasPuppy) - { - m_Manager.timeStopToggle(); - } - - if (FF != RW) m_Manager.masterScrub((int)((FF - RW) * scrubSpeed)); - - } - -} diff --git a/Assets/PATimeRefactor/Assets/Scripts/PlayerUserController.cs b/Assets/PATimeRefactor/Assets/Scripts/PlayerUserController.cs index 8cb82d3..2b85789 100644 --- a/Assets/PATimeRefactor/Assets/Scripts/PlayerUserController.cs +++ b/Assets/PATimeRefactor/Assets/Scripts/PlayerUserController.cs @@ -5,81 +5,104 @@ public class PlayerUserController : MonoBehaviour { - private bool m_disableMovement = false; - private Character m_Character; // A reference to the ThirdPersonCharacter on the object - public Transform m_Cam; // A reference to the main camera in the scenes transform - private Vector3 m_CamForward; // The current forward direction of the camera + public Transform m_Cam; // A reference to the main camera in the scenes transform + private Vector3 m_CamForward; // The current forward direction of the camera + private Vector3 m_Move; - public bool m_Paradoxing { get; set; } + public TimeManager m_TimeManager; + public float m_ScrubSpeed; + + public bool m_IsRewindController; + public bool m_DisableRewindWhenLatched; + public bool m_HasPuppy { get; set; } + private void Start() { m_Character = GetComponent(); - m_Paradoxing = false; + m_HasPuppy = false; } // Fixed update is called in sync with physics private void FixedUpdate() { - if (m_Paradoxing) return; - - // read inputs + // Read inputs float h = CrossPlatformInputManager.GetAxis("Horizontal"); float v = CrossPlatformInputManager.GetAxis("Vertical"); bool crouch = Input.GetButton("Ground Stop Time"); - m_Move = v * Vector3.forward + h * Vector3.right; + float FF = CrossPlatformInputManager.GetAxis("FF"); + float RW = CrossPlatformInputManager.GetAxis("RW"); + + // Compute move vector if (crouch) { - m_Move = 0 * Vector3.forward + 0 * Vector3.right; + m_Move = Vector3.zero; + } + else if (m_Cam != null) + { + // calculate camera relative direction to move: + m_CamForward = Vector3.Scale(m_Cam.forward, new Vector3(1, 0, 1)).normalized; + m_Move = v * m_CamForward + h * m_Cam.right; + } + else + { + // we use world-relative directions in the case of no main camera + m_Move = v * Vector3.forward + h * Vector3.right; } - //This is the original script for Ethan's movement. The actual controller should use something relative - - //to the attached camera on the player(like what they are doing here). - //The current version uses world space to figure out where to go. - - // calculate move direction to pass to character - if (m_Cam != null) - { - // calculate camera relative direction to move: - m_CamForward = Vector3.Scale(m_Cam.forward, new Vector3(1, 0, 1)).normalized; - m_Move = v * m_CamForward + h * m_Cam.right; - } - else - { - // we use world-relative directions in the case of no main camera - m_Move = v * Vector3.forward + h * Vector3.right; - } -#if !MOBILE_INPUT - // walk speed multiplier - if (Input.GetKey(KeyCode.LeftShift)) m_Move *= 0.5f; -#endif + // Switch to send user input depending on game state + switch (m_TimeManager.m_GameState) + { + // Do not consider any user input if the game state is in paradox or revert mode + case TimeManager.GameState.PARADOX: + case TimeManager.GameState.REVERT: + break; + + case TimeManager.GameState.NORMAL: + m_Character.Move(m_Move, crouch); + if (crouch && !(m_DisableRewindWhenLatched && m_HasPuppy)) + { + m_TimeManager.timeStopToggle(crouch); + } + break; - //pass all parameters to the character control script - if (!m_disableMovement) - m_Character.Move(m_Move, crouch); - else - // We still pass the crouch if the player isn't moving - m_Character.Move(new Vector3(0, 0, 0), crouch); - } + case TimeManager.GameState.REWIND: - /// - /// Turn movement for this character on or off - /// - public void ToggleMovement() - { - m_disableMovement = !m_disableMovement; - } + switch (m_TimeManager.m_RewindMode) + { + case TimeManager.RewindType.SCRUB: + m_Character.Move(m_Move, crouch); + if (!crouch) + m_TimeManager.timeStopToggle(crouch); + if (m_IsRewindController) + { + if (FF != RW) + { + m_TimeManager.masterScrub((int)((FF - RW) * m_ScrubSpeed)); + } + } + break; + case TimeManager.RewindType.HOLD_AND_RELEASE: + m_Character.Move(m_Move, crouch); + if (!crouch) + m_TimeManager.timeStopToggle(crouch); + break; + case TimeManager.RewindType.TO_ZERO: + if (m_TimeManager.m_WaitingForPlayer) + { + m_Character.Move(m_Move, crouch); + if (!crouch) + { + m_TimeManager.timeStopToggle(crouch); + } + } + break; + } - /// - /// Overload where you can specify the state of the movement flag - /// - /// True for on, flase for off - public void ToggleMovement(bool flag) - { - m_disableMovement = !flag; + break; + } } } 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 7fd24de..2aae62a 100644 --- a/Assets/PATimeRefactor/Assets/Scripts/TimeManager.cs +++ b/Assets/PATimeRefactor/Assets/Scripts/TimeManager.cs @@ -14,16 +14,41 @@ public class TimeManager : MonoBehaviour // Apparently, toggling the Physics collision off sends an OnTriggerEnter/Exit event, // paradoxes have to be disabled in order to prevent misfire - public string playerLayer; - public string cloneLayer; - public string doorLayer; - public string aiLayer; + public enum RewindType + { + SCRUB, + HOLD_AND_RELEASE, + TO_ZERO + }; + + public enum GameState + { + PARADOX, + REVERT, + NORMAL, + REWIND, + }; + + public RewindType m_RewindMode; + + public bool m_SnapCameraToClone; + + public Camera m_PlayerCamera; + + public GameObject m_WarpInPrefab; + public int m_WarpBubbleLife; + + public GameState m_GameState { get; private set; } - public bool m_EnableRewindToZero; - private bool m_AutoRewinding; + public string m_PlayerLayer; + public string m_CloneLayer; + public string m_DoorLayer; + public string m_AILayer; + public string m_PlateLayer; - public Color[] cloneColorCodes; // Currently being applied to the trails at runtime - private int cloneColorCodesIndex = 0; // NOTE FOR PIERRE: maybe this index is uncessesary/dirty depending on how you keep track of clones, let me know + public bool m_WaitingForPlayer { get; set; } + + public Color[] m_CloneColorCodes; // Currently being applied to the trails at runtime public int sampleRate; @@ -78,17 +103,22 @@ private class Timeline GameObject m_WarpOutPrefab; TimeManager m_TimeManager; List m_MasterArrayRef; + int m_WarpBubbleLife; + Color m_colorCode; + GameObject m_WarpInInstance; + // This is set at runtime whenever clones pop in or out of a timeline GameObject m_CloneInstance; + Camera m_CloneCam; // I think these need to be set at runtime since instances are going to pop in and out CloneTimeAttachment m_CloneTimeAttachment; CloneCharacterController m_CloneController; Transform m_CloneTransform; - public Timeline(int start, GameObject clonePrefab, int id, List masterArray, TimeManager timeManager, Color colorCode, GameObject warpIn = null, GameObject warpOut = null) + public Timeline(int start, GameObject clonePrefab, int id, List masterArray, TimeManager timeManager, GameObject warpIn = null, int warpBubbleLife = 0, GameObject warpOut = null) { m_Start = start; m_End = -1; @@ -99,7 +129,8 @@ public Timeline(int start, GameObject clonePrefab, int id, List masterArr m_TimeManager = timeManager; m_WarpInPrefab = warpIn; m_WarpOutPrefab = warpOut; - m_colorCode = colorCode; + m_colorCode = timeManager.m_CloneColorCodes[id % timeManager.m_CloneColorCodes.Length]; + m_WarpBubbleLife = warpBubbleLife; } // Mini helper methods for creating and cleaning up instances @@ -111,11 +142,12 @@ private void create(bool rewinding = false) m_CloneInstance = Instantiate(m_ClonePrefab, state.m_DogPosition, state.m_DogRotation); m_CloneTimeAttachment = m_CloneInstance.GetComponent(); - m_CloneTimeAttachment.timelineID = m_TimelineID; + m_CloneTimeAttachment.m_TimelineID = m_TimelineID; m_CloneTimeAttachment.manager = m_TimeManager; m_CloneController = m_CloneInstance.GetComponent(); m_CloneTransform = m_CloneInstance.GetComponent(); + m_CloneCam = m_CloneInstance.GetComponentInChildren(); // Texture the trail m_CloneController.ColorCode(m_colorCode); @@ -125,12 +157,22 @@ private void create(bool rewinding = false) haltClones(); } } - public void trash() + public void trashClone(bool onOpen = false) { + if (!onOpen && m_CloneTimeAttachment != null) + { + m_CloneTimeAttachment.pressureOff(); + } Destroy(m_CloneInstance); m_CloneTimeAttachment = null; m_CloneController = null; m_CloneTransform = null; + m_CloneCam = null; + } + + public void trashBubble() + { + Destroy(m_WarpInInstance); } // Called when scrubbing to close a timeline or when a paradox occurs @@ -144,13 +186,18 @@ public void close(int end) public void open(int index) { m_End = -1; - trash(); + trashClone(true); + trashBubble(); m_TimelineIndex = index; } public void inc() { m_TimelineIndex++; + if (m_WarpInInstance != null) + { + m_WarpInInstance.GetComponent().scrub(1); + } } public void haltClones() @@ -174,6 +221,15 @@ public void resumeClones() public void timelineScrub(int amount, int flipOffset = 0) { m_TimelineIndex += amount + flipOffset; + if (m_WarpInInstance != null) + { + m_WarpInInstance.GetComponent().scrub(amount); + } + } + + public void activateCamera(bool active = true) + { + m_CloneCam.enabled = active; } public void runClones(bool rewinding = false) @@ -190,21 +246,22 @@ public void runClones(bool rewinding = false) // are blurred. I spend a while trying to figure out how to make the animation look good while rewinding and I don't think it can // be done if we allow the players to scrub through the timelines + + // Deal with clone instantiation if (m_TimelineIndex < m_Start || m_TimelineIndex > m_End) { if (m_CloneInstance != null) { - // NOTE TO SELF JESUS: WARP IN/OUT EFFECT HERE(?) - trash(); + trashClone(); } } else { State currentState = m_MasterArrayRef[m_TimelineIndex]; + if (m_CloneInstance == null) { // Create instance and assign references - // NOTE TO SELF JESUS: WARP IN/OUT EFFECT HERE(?) create(rewinding); } @@ -216,6 +273,31 @@ public void runClones(bool rewinding = false) m_CloneTransform.rotation = currentState.m_DogRotation; } } + + // Deal with warp in bubble instantiation + if (m_TimelineIndex >= m_Start && m_TimelineIndex <= m_Start + m_WarpBubbleLife && m_TimelineID != 0) + { + if (m_WarpInInstance == null) + { + 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; + } + else if (m_TimelineIndex >= m_End && m_TimelineIndex <= m_End + m_WarpBubbleLife) + { + if (m_WarpInInstance == null) + { + 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; + } + else + { + if (m_WarpInInstance != null) + { + trashBubble(); + } + } } } @@ -227,17 +309,19 @@ public void runClones(bool rewinding = false) private int m_ActiveTimeline; private int m_Frameticker; - private bool m_TimeStopped; - private bool m_DisableParadoxes; private PlayerUserController m_UserController; private PuppyCharacterController m_PuppyController; - private bool m_Paradoxing; private int m_RevertTimeline; private int m_RevertIndex; private Transform m_PlayerTransform; private Transform m_PuppyTransform; - private bool m_Reverting; + + private bool m_RestoreControlOnNextFrame; + + // duct tape - will remove soon + private int m_CurrentCamera; + void Start() { @@ -246,28 +330,28 @@ void Start() m_MasterPointer = 0; m_PuppyPointer = 0; m_ActiveTimeline = 0; - m_Timelines.Add(new Timeline(0, m_ClonePrefab, 0, m_MasterArray, this, GetNextColorCode())); + m_Timelines.Add(new Timeline(0, m_ClonePrefab, 0, m_MasterArray, this, m_WarpInPrefab, m_WarpBubbleLife)); m_Frameticker = sampleRate; - m_TimeStopped = false; m_UserController = m_Player.GetComponent(); m_PuppyController = m_Puppy.GetComponent(); - m_DisableParadoxes = false; - - m_Paradoxing = false; m_RevertTimeline = 0; m_RevertIndex = 0; m_PlayerTransform = m_Player.GetComponent(); m_PuppyTransform = m_Puppy.GetComponent(); - m_Reverting = false; + m_GameState = GameState.NORMAL; + m_RestoreControlOnNextFrame = false; + m_WaitingForPlayer = false; + + 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) private void FixedUpdate() { - if (!m_TimeStopped) + if (m_GameState == GameState.NORMAL) { if (m_Frameticker == sampleRate) { @@ -282,26 +366,43 @@ private void FixedUpdate() void Update() { - + if (m_RestoreControlOnNextFrame) + { + 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; + } if (m_Text != null) { m_Text.text = (m_Timelines[0].m_TimelineIndex).ToString(); } - if (m_AutoRewinding) + #region Rewind + if (m_GameState == GameState.REWIND) { - if (m_Timelines[0].m_TimelineIndex == 0) + if (m_RewindMode == RewindType.TO_ZERO) { - m_AutoRewinding = false; + if (m_Timelines[0].m_TimelineIndex == 0) + { + m_WaitingForPlayer = true; + } + else + { + masterScrub(-1); + } } - else + if (m_RewindMode == RewindType.HOLD_AND_RELEASE) { masterScrub(-1); } } - #region ParadoxForcedRewind + #endregion + + #region Paradox // When doing the paradox/reverting from the paradox, everything gets bypassed and this happens - if (m_Paradoxing && !m_Reverting) + if (m_GameState == GameState.PARADOX) { // The forced rewind will try to reach a few seconds before the paradox actually happened // in order to show the player the sequence of events that lead to the paradox @@ -332,13 +433,13 @@ void Update() // happened, we start reverting and on next update the first portion will be skipped else { - if (!m_Reverting) m_Reverting = true; + m_GameState = GameState.REVERT; } } #endregion - #region ParadoxRevert - else if (m_Reverting) + #region Revert + if (m_GameState == GameState.REVERT) { // Start forward playback if (m_MasterPointer < m_RevertIndex) @@ -352,24 +453,25 @@ void Update() m_MasterArray.RemoveRange(m_MasterPointer + 1, m_MasterArray.Count - m_MasterPointer - 1); for (int i = m_RevertTimeline + 1; i < m_Timelines.Count; i++) { - m_Timelines[i].trash(); + m_Timelines[i].trashClone(); } m_ActiveTimeline = m_RevertTimeline; m_Timelines[m_ActiveTimeline].open(m_MasterPointer); m_Timelines.RemoveRange(m_RevertTimeline + 1, m_Timelines.Count - m_RevertTimeline - 1); // Restore control - m_Paradoxing = false; - m_TimeStopped = false; - m_UserController.m_Paradoxing = false; - m_Reverting = false; + m_RestoreControlOnNextFrame = true; - // Enable collisions - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(playerLayer), false); - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(doorLayer), false); + // Restore Puppy State + m_PuppyController.restoreState(m_MasterArray[m_MasterPointer]); - // Enable paradoxes - m_DisableParadoxes = false; + // Nudge pointers up + // Place pointers to next position + m_MasterPointer++; + for (int i = 0; i < m_Timelines.Count; i++) + { + m_Timelines[i].inc(); + } // Snap puppy pointer to master m_PuppyPointer = m_MasterPointer; @@ -377,11 +479,11 @@ void Update() } #endregion - #region NormalPlayBack + #region Normal // Update clones normally only when time is not stopped // The run() method is called at each rewind call - rewind is called on Update() by the // player who controls the time FF and RW mechanisms - else if (!m_TimeStopped) + else if (m_GameState == GameState.NORMAL) { // For each timeline that is not the active one, call run for (int i = 0; i < m_ActiveTimeline; i++) @@ -418,116 +520,121 @@ private void incrementPointers() } } - public void timeStopToggle() + public void timeStopToggle(bool stopTime) { #region TurnTimeStopOff - if (m_TimeStopped) + if (!stopTime) { - // Enable collisions - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(playerLayer), false); - Physics.IgnoreLayerCollision(LayerMask.NameToLayer(cloneLayer), LayerMask.NameToLayer(doorLayer), false); + if (m_GameState == GameState.REWIND) + { - // Re-enable paradoxes - m_DisableParadoxes = false; + // Switch camera + if (m_SnapCameraToClone) + { + m_Timelines[m_CurrentCamera].activateCamera(false); + m_PlayerCamera.enabled = true; + } - // Resume AIs - for (int i = 0; i < m_ActiveTimeline; i++) - { - m_Timelines[i].resumeClones(); - } + m_WaitingForPlayer = false; + bool bangThePuppy = true; + // If the time stop did not result in a rewind, clean-up + if (m_Timelines[m_ActiveTimeline - 1].m_TimelineIndex == m_MasterPointer) + { + bangThePuppy = false; + m_Timelines[m_ActiveTimeline - 1].open(m_MasterPointer); + m_Timelines.RemoveAt(m_ActiveTimeline); + m_ActiveTimeline--; + } - m_PuppyController.resumeAI(); - m_Player.GetComponent().ToggleMovement(true); + // Resume AIs + for (int i = 0; i < m_ActiveTimeline; i++) + { + m_Timelines[i].resumeClones(); + } + m_PuppyController.resumeAI(); + + // Signal the puppy (if there was an actual rewind) + if (bangThePuppy) + { + m_PuppyController.hearNoise(m_PlayerTransform.position); + } - bool bangThePuppy = true; - // If the time stop did not result in a rewind, clean-up - // The timelines do the actual deleting and cleaning up, we just call it here with the open() - if (m_Timelines[m_ActiveTimeline - 1].m_TimelineIndex == m_MasterPointer) - { - bangThePuppy = false; - m_Timelines[m_ActiveTimeline - 1].open(m_MasterPointer); - m_Timelines.RemoveAt(m_ActiveTimeline); - m_ActiveTimeline--; - // Also replace the pointers (for reasons) + // Place pointers to next position m_MasterPointer++; - m_PuppyPointer++; + + // Snap back puppy pointer to master + m_PuppyPointer = m_MasterPointer; + for (int i = 0; i < m_Timelines.Count; i++) { m_Timelines[i].inc(); } - } - // Signal the puppy (if there was an actual rewind) - if (bangThePuppy) - { - m_PuppyController.hearNoise(m_PlayerTransform.position); - } + // Enable collisions and control + m_RestoreControlOnNextFrame = true; - // Snap back puppy pointer to master - m_PuppyPointer = m_MasterPointer; - - // Unfreeze time - m_TimeStopped = false; + if (m_SnapCameraToClone) + { + m_CurrentCamera = m_ActiveTimeline; + } - if (m_EnableRewindToZero) - m_AutoRewinding = false; + } } #endregion #region TurnTimeStopOn - else + else if (m_GameState == GameState.NORMAL && stopTime == true) { - // Disable paradoxes - m_DisableParadoxes = true; + // Set current state + 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++) { m_Timelines[i].haltClones(); } - m_PuppyController.haltAI(); - m_Player.GetComponent().ToggleMovement(false); - // Freeze time and close the current timeline - // Need also the move the pointers one notch back (for reasons) - m_TimeStopped = true; + // Nudge pointers to next reading position m_MasterPointer--; m_PuppyPointer--; for (int i = 0; i < m_Timelines.Count; i++) { m_Timelines[i].timelineScrub(-1); } + + // Close the current timeline m_Timelines[m_ActiveTimeline].close(m_MasterPointer); m_ActiveTimeline++; - m_Timelines.Add(new Timeline(m_MasterPointer, m_ClonePrefab, m_ActiveTimeline, m_MasterArray, this,GetNextColorCode(true))); + m_Timelines.Add(new Timeline(m_MasterPointer, m_ClonePrefab, m_ActiveTimeline, m_MasterArray, this, m_WarpInPrefab, m_WarpBubbleLife)); + - if (m_EnableRewindToZero) - m_AutoRewinding = true; + // Switch camera + if (m_SnapCameraToClone) + { + m_PlayerCamera.enabled = false; + m_CurrentCamera = m_ActiveTimeline - 1; + m_Timelines[m_CurrentCamera].activateCamera(true); + } } #endregion } - private void autoRewind() { } - public void masterScrub(int amount, int flipOffset = 0) { - #region TimeStoppedCheck - // Only allow scrubbing timelines while time is stopped (dog is sitting or paradoxing) - if (!m_TimeStopped) return; - #endregion - #region ValidScrubCheck // Check to make sure the rewind is legal, otherwise apply max value (positive or negative) // We only check this if there is not in a paradox or reverting mode, in those modes all // scrubs are managed by the system and should be valid - if (!m_Paradoxing) + if (m_GameState == GameState.REWIND) { int maxRewind = -1 * m_Timelines[0].m_TimelineIndex; int maxForward = m_MasterPointer - m_Timelines[m_ActiveTimeline - 1].m_TimelineIndex; @@ -543,7 +650,7 @@ public void masterScrub(int amount, int flipOffset = 0) // Move clones (except the one in the active timeline) for (int i = 0; i < m_Timelines.Count; i++) { - if (m_Paradoxing || i != m_ActiveTimeline) + if (m_GameState == GameState.PARADOX || i != m_ActiveTimeline) { m_Timelines[i].timelineScrub(amount, flipOffset); } @@ -551,18 +658,21 @@ public void masterScrub(int amount, int flipOffset = 0) if (m_ActiveTimeline != i) m_Timelines[i].runClones(true); else - m_Timelines[i].trash(); + m_Timelines[i].trashClone(true); } #endregion #region MovePuppy - m_PuppyPointer += amount; - m_PuppyController.restoreState(m_MasterArray[m_PuppyPointer]); + if (m_GameState != GameState.NORMAL) + { + m_PuppyPointer += amount; + m_PuppyController.restoreState(m_MasterArray[m_PuppyPointer]); + } #endregion #region MovePlayer (if needed) // Also move the main timeline while paradoxing and the puppy - if (m_Paradoxing || m_Reverting) + if (m_GameState == GameState.PARADOX || m_GameState == GameState.REVERT) { m_MasterPointer += amount; @@ -571,6 +681,26 @@ public void masterScrub(int amount, int flipOffset = 0) m_PlayerTransform.rotation = nextState.m_DogRotation; } #endregion + + // Special case when rewinding (duct tape used here, more robust solution will follow) + if (m_SnapCameraToClone && m_GameState == GameState.REWIND) + { + // Find the "latest" running timeline + for (int i = m_ActiveTimeline - 1; i >= 0; i--) + { + if ( + (m_Timelines[i].m_TimelineIndex <= m_Timelines[i].m_End - 1) + && + (m_Timelines[i].m_TimelineIndex >= m_Timelines[i].m_Start + 1) + ) + { + m_Timelines[m_CurrentCamera].activateCamera(false); + m_CurrentCamera = i; + m_Timelines[m_CurrentCamera].activateCamera(true); + break; + } + } + } } /// @@ -581,34 +711,28 @@ public void masterScrub(int amount, int flipOffset = 0) public void handleParadox(int idToRevert, Transform lastPos = null) { - // Paradoxes can't occur when time is stopped - if (m_DisableParadoxes) return; + // Paradoxes can only occur on NORMAL game state + if (m_GameState != GameState.NORMAL) return; - // Slight variation on the code used on time stop toggle on - m_TimeStopped = true; - m_Paradoxing = true; - m_RevertTimeline = idToRevert; - - // Disable paradoxes - m_DisableParadoxes = true; + // Otherwise deal with the paradox... + 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; // Blocking paradox require an override in order to revert to the clone's // last valid position and not spawn through a door // Find the closest position and revert to that - m_RevertIndex = m_Timelines[m_RevertTimeline].m_TimelineIndex; if (lastPos != null) { - -#if DEBUG_VERBOSE - Debug.Log("Blocking Paradox Detected"); -#endif - float currentDistance = (lastPos.position - m_MasterArray[m_RevertIndex].m_DogPosition).magnitude; m_RevertIndex--; float nextDistance = (lastPos.position - m_MasterArray[m_RevertIndex].m_DogPosition).magnitude; @@ -620,11 +744,9 @@ public void handleParadox(int idToRevert, Transform lastPos = null) nextDistance = (lastPos.position - m_MasterArray[m_RevertIndex].m_DogPosition).magnitude; } } - else -#if DEBUG_VERBOSE - Debug.Log("Proximity Paradox Detected"); -#endif + // Nudge back pointers to reading position + else m_MasterPointer--; m_PuppyPointer--; for (int i = 0; i < m_Timelines.Count; i++) @@ -633,18 +755,6 @@ public void handleParadox(int idToRevert, Transform lastPos = null) } m_Timelines[m_ActiveTimeline].close(m_MasterPointer); - // Block the user controller - m_UserController.m_Paradoxing = true; - } - - // This was a quick and dirty fix, take a closer look at this - private Color GetNextColorCode(bool increment = false) - { - if (increment) - cloneColorCodesIndex++; - - cloneColorCodesIndex = cloneColorCodesIndex % cloneColorCodes.Length; - - return cloneColorCodes[cloneColorCodesIndex]; + // On update, will execute portion of code for paradox state } -} +} \ No newline at end of file diff --git a/Assets/PATimeRefactor/Assets/Scripts/WarpBubble.cs b/Assets/PATimeRefactor/Assets/Scripts/WarpBubble.cs new file mode 100644 index 0000000..39fc310 --- /dev/null +++ b/Assets/PATimeRefactor/Assets/Scripts/WarpBubble.cs @@ -0,0 +1,35 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class WarpBubble : MonoBehaviour { + + private Material m_Bolt; + public int m_CurrentIndex { get; set; } + + public float m_MaxXTiling; + public float m_MaxYTiling; + + // This must be set at the same amount as the one in TimeLineManager script, will bake it in eventually but for testing we need to set it manually + public int m_LifeTime; + + + // Use this for initialization + void Start () { + m_Bolt = GetComponent().material; + m_CurrentIndex = 0; + } + + public void scrub(int amount) + { + m_CurrentIndex += amount; + if (m_CurrentIndex >= m_LifeTime/2) + { + m_CurrentIndex = Mathf.Abs(m_CurrentIndex - m_LifeTime); + } + float x = (float)m_CurrentIndex / m_LifeTime * m_MaxXTiling; + float y = (float)m_CurrentIndex / m_LifeTime * m_MaxYTiling; + m_Bolt.SetTextureScale("_MainTex", new Vector2(x, y)); + } + +} diff --git a/Assets/PATimeRefactor/Assets/Scripts/PlayerTimeAttachment.cs.meta b/Assets/PATimeRefactor/Assets/Scripts/WarpBubble.cs.meta similarity index 76% rename from Assets/PATimeRefactor/Assets/Scripts/PlayerTimeAttachment.cs.meta rename to Assets/PATimeRefactor/Assets/Scripts/WarpBubble.cs.meta index 3496651..2a49f4b 100644 --- a/Assets/PATimeRefactor/Assets/Scripts/PlayerTimeAttachment.cs.meta +++ b/Assets/PATimeRefactor/Assets/Scripts/WarpBubble.cs.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 6479b1f1ba44d4e47997fb62f46d13ef -timeCreated: 1488252793 +guid: 2fd4765b167bfbc44afdc067f80d8b86 +timeCreated: 1489368806 licenseType: Free MonoImporter: serializedVersion: 2 diff --git a/Assets/PATimeRefactor/Assets/Textures/Bolt.png b/Assets/PATimeRefactor/Assets/Textures/Bolt.png new file mode 100644 index 0000000..d451cd1 Binary files /dev/null and b/Assets/PATimeRefactor/Assets/Textures/Bolt.png differ diff --git a/Assets/PATimeRefactor/Assets/Textures/Bolt.png.meta b/Assets/PATimeRefactor/Assets/Textures/Bolt.png.meta new file mode 100644 index 0000000..5dd9974 --- /dev/null +++ b/Assets/PATimeRefactor/Assets/Textures/Bolt.png.meta @@ -0,0 +1,76 @@ +fileFormatVersion: 2 +guid: 917df88c3872d05428ad7d65fc2e64a2 +timeCreated: 1489367700 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PATimeRefactor/Assets/_Scenes/ProtoDemo.unity b/Assets/PATimeRefactor/Assets/_Scenes/ProtoDemo.unity index e7bbe34..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: 3 + 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,13 +2829,8 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 408730, guid: 160f96e74f524c04997050bb5bed7e41, type: 2} propertyPath: m_RootOrder - value: 7 + value: 5 objectReference: {fileID: 0} - - target: {fileID: 114755739237096388, guid: 160f96e74f524c04997050bb5bed7e41, - type: 2} - propertyPath: m_TimeManager - value: - objectReference: {fileID: 1001579339} - target: {fileID: 496262, guid: 160f96e74f524c04997050bb5bed7e41, type: 2} propertyPath: m_LocalRotation.x value: 0.5326752 @@ -2832,21 +2847,44 @@ Prefab: propertyPath: m_LocalRotation.w value: -0.110415146 objectReference: {fileID: 0} - - target: {fileID: 9579096, guid: 160f96e74f524c04997050bb5bed7e41, type: 2} - propertyPath: m_Controller - value: - objectReference: {fileID: 9100000, guid: 831fc5957fcc6e84590bd54538b9ee24, type: 2} - - target: {fileID: 13783410, guid: 160f96e74f524c04997050bb5bed7e41, type: 2} - propertyPath: m_Mesh + - target: {fileID: 114896590231832898, guid: 160f96e74f524c04997050bb5bed7e41, + type: 2} + propertyPath: m_TimeManager value: - objectReference: {fileID: 4300006, guid: 3a683869573abb142839889fdd407e64, type: 3} - - target: {fileID: 13783410, guid: 160f96e74f524c04997050bb5bed7e41, type: 2} + objectReference: {fileID: 1001579340} + - target: {fileID: 13736924, guid: 160f96e74f524c04997050bb5bed7e41, type: 2} propertyPath: m_Materials.Array.data[0] value: - objectReference: {fileID: 2100000, guid: c78d8aa945ad43346b65f606cec61e10, type: 2} - m_RemovedComponents: [] + objectReference: {fileID: 2100000, guid: 0dec6b6597e6565408d73421e9c33492, type: 2} + - 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 @@ -4652,23 +4690,18 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 4658824392053904, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, type: 2} propertyPath: m_RootOrder - value: 6 + value: 3 objectReference: {fileID: 0} - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, type: 2} - propertyPath: m_Player + propertyPath: m_PlayerCamera value: - objectReference: {fileID: 1730884332} + objectReference: {fileID: 562300695} - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, type: 2} - propertyPath: m_Text + propertyPath: m_Player value: - objectReference: {fileID: 487745951} - - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, - type: 2} - propertyPath: sampleRate - value: 3 - objectReference: {fileID: 0} + objectReference: {fileID: 1730884332} - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, type: 2} propertyPath: m_Puppy @@ -4676,17 +4709,12 @@ Prefab: objectReference: {fileID: 490939858} - target: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, type: 2} - propertyPath: playerLayer - value: Player - objectReference: {fileID: 0} + propertyPath: m_Text + value: + objectReference: {fileID: 126994619} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, type: 2} m_IsPrefabParent: 0 ---- !u!1 &1001579339 stripped -GameObject: - m_PrefabParentObject: {fileID: 1398763258217824, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, - type: 2} - m_PrefabInternal: {fileID: 1001579338} --- !u!114 &1001579340 stripped MonoBehaviour: m_PrefabParentObject: {fileID: 114418653402867576, guid: e5a7480f3b45b014b8ea6dc91b24b1ef, @@ -4749,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 @@ -4963,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, @@ -5788,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: @@ -5796,33 +5872,6 @@ Prefab: m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: 868df6ca073273b46b0d14bf91e88925, type: 2} m_IsPrefabParent: 0 ---- !u!1 &1436152390 stripped -GameObject: - m_PrefabParentObject: {fileID: 1501847329513510, guid: c465d0ed2fba9054fab593e5b852b034, - type: 2} - m_PrefabInternal: {fileID: 1937865835} ---- !u!4 &1436152391 stripped -Transform: - m_PrefabParentObject: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, - type: 2} - m_PrefabInternal: {fileID: 1937865835} ---- !u!95 &1436152392 -Animator: - serializedVersion: 3 - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1436152390} - m_Enabled: 1 - m_Avatar: {fileID: 0} - m_Controller: {fileID: 22100000, guid: 523de2004da50a543b3d8532fad46202, type: 2} - m_CullingMode: 0 - m_UpdateMode: 0 - m_ApplyRootMotion: 0 - m_LinearVelocityBlending: 0 - m_WarningMessage: - m_HasTransformHierarchy: 1 - m_AllowConstantClipSamplingOptimization: 1 --- !u!1 &1445976519 GameObject: m_ObjectHideFlags: 0 @@ -6093,7 +6142,6 @@ Transform: m_Children: - {fileID: 388322132} - {fileID: 1271397057} - - {fileID: 1436152391} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -6248,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: @@ -8372,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: 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: 4 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: 830eaf2f6e360bf428bd57f4ca1780de, type: 2} - m_IsPrefabParent: 0 --- !u!1 &1783550391 GameObject: m_ObjectHideFlags: 0 @@ -9093,82 +9099,6 @@ MeshFilter: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 1921566718} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} ---- !u!1001 &1937865835 -Prefab: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 1453739477} - m_Modifications: - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_LocalPosition.z - value: 22.7 - objectReference: {fileID: 0} - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_RootOrder - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_LocalScale.x - value: 1.8973099 - objectReference: {fileID: 0} - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_LocalScale.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 4824384813337996, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_LocalScale.z - value: 0.99999946 - objectReference: {fileID: 0} - - target: {fileID: 0} - propertyPath: openByDefault - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1115433472075232, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_Name - value: Gate - objectReference: {fileID: 0} - - target: {fileID: 114781149173441670, guid: c465d0ed2fba9054fab593e5b852b034, - type: 2} - propertyPath: animOpenCloseDoorSpeed - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 114781149173441670, guid: c465d0ed2fba9054fab593e5b852b034, - type: 2} - propertyPath: hackDoors - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 1501847329513510, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - propertyPath: m_Name - value: Door (1) - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_ParentPrefab: {fileID: 100100000, guid: c465d0ed2fba9054fab593e5b852b034, type: 2} - m_IsPrefabParent: 0 --- !u!1 &1938080336 GameObject: m_ObjectHideFlags: 0 @@ -9235,7 +9165,7 @@ Transform: - {fileID: 16410244} - {fileID: 73675885} m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 6 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1947853498 GameObject: diff --git a/Assets/PATimeRefactor/Library.meta b/Assets/PATimeRefactor/Library.meta new file mode 100644 index 0000000..b481e4c --- /dev/null +++ b/Assets/PATimeRefactor/Library.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: e85a2b56027f80a4ab862688a29c271f +folderAsset: yes +timeCreated: 1489102864 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/PATimeRefactor/ProjectSettings.meta b/Assets/PATimeRefactor/ProjectSettings.meta new file mode 100644 index 0000000..f0db715 --- /dev/null +++ b/Assets/PATimeRefactor/ProjectSettings.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 11988ff40561d544fb7634066bee6528 +folderAsset: yes +timeCreated: 1489102863 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: 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/InputManager.asset b/ProjectSettings/InputManager.asset index e55c818..c25f3bc 100644 --- a/ProjectSettings/InputManager.asset +++ b/ProjectSettings/InputManager.asset @@ -611,7 +611,7 @@ InputManager: snap: 0 invert: 0 type: 2 - axis: 9 + axis: 8 joyNum: 0 - serializedVersion: 3 m_Name: FF @@ -627,7 +627,7 @@ InputManager: snap: 0 invert: 0 type: 2 - axis: 8 + axis: 9 joyNum: 0 - serializedVersion: 3 m_Name: Ground Stop Time diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 8574a23..9543f9f 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -26,8 +26,7 @@ TagManager: - TimeLine - CanvasGroundCharacter - PlayerTimeLine - - Tutorial Canvas Ground Player - - Tutorial Canvas Overseer + - PressurePlateCollider layers: - Default - TransparentFX @@ -53,7 +52,7 @@ TagManager: - Door DELETEME - Puppy AI - OSPointer - - Tutorial Triggers + - PressurePlateCollider - - -