diff --git a/Assets/2_Chair/Chair.prefab b/Assets/2_Chair/Chair.prefab index eba797c..72e0ce7 100644 --- a/Assets/2_Chair/Chair.prefab +++ b/Assets/2_Chair/Chair.prefab @@ -1183,6 +1183,37 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 771e78c5e980e440e8cd19716b55075f, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &3802945617161129706 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4153334373288207407} + m_Layer: 0 + m_Name: Controller Target + m_TagString: Untagged + m_Icon: {fileID: 5132851093641282708, guid: 0000000000000000d000000000000000, type: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4153334373288207407 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3802945617161129706} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 5.06} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 6618138482202815428} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &4300977326172810481 GameObject: m_ObjectHideFlags: 0 @@ -1776,6 +1807,38 @@ MonoBehaviour: rayMissColor: {r: 0.11090793, g: 0.13207549, b: 0.110270575, a: 1} m_StartVerticalOffset: 4.4 m_EndVerticalOffset: -1.91 +--- !u!1 &5336058561618412712 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6618138482202815428} + m_Layer: 0 + m_Name: Controller + m_TagString: Untagged + m_Icon: {fileID: 2974397684917235467, guid: 0000000000000000d000000000000000, type: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6618138482202815428 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5336058561618412712} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0.44072258, z: -0, w: 0.8976433} + m_LocalPosition: {x: -30.195412, y: -1.1399994, z: 16.027393} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4153334373288207407} + m_Father: {fileID: 2722580235232797026} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &5771439526206961800 GameObject: m_ObjectHideFlags: 0 @@ -2018,6 +2081,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 6618138482202815428} - {fileID: 5732046185206465305} - {fileID: 3760912995002528423} - {fileID: 2606659236387519094} @@ -2080,7 +2144,8 @@ MonoBehaviour: m_SwitchModelAfterFalling: 0 m_StepCountAtLastMeter: 0 m_LastXPosition: 0 - m_FinishedSwap: 0 + m_FinishedSwapGetup: 0 + m_FinishedSwapSit: 0 m_ModelSwapper: {fileID: 0} target: {fileID: 0} rest: {fileID: 9148272401270991874} diff --git a/Assets/6_Scenes/Beep.unity b/Assets/6_Scenes/Beep.unity index 40b21b8..c7feb22 100644 --- a/Assets/6_Scenes/Beep.unity +++ b/Assets/6_Scenes/Beep.unity @@ -234,7 +234,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 83569712} serializedVersion: 2 - m_LocalRotation: {x: -0.092318505, y: 0.4670565, z: -0.049108025, w: -0.8780228} + m_LocalRotation: {x: -0.092318326, y: 0.46705723, z: -0.049108017, w: -0.87802243} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -392,7 +392,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 155411616} serializedVersion: 2 - m_LocalRotation: {x: -0.15752463, y: 0.4620952, z: -0.083793834, w: -0.868696} + m_LocalRotation: {x: -0.1575244, y: 0.46209592, z: -0.08379388, w: -0.8686956} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -1069,7 +1069,7 @@ MonoBehaviour: LensShift: {x: 0, y: 0} GateFit: 1 FocusDistance: 8.93528 - m_SensorSize: {x: 70.41, y: 52.63} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.0005 Aperture: 2.2 @@ -1085,6 +1085,56 @@ MonoBehaviour: m_Calls: [] m_LegacyBlendHint: 0 m_ComponentOwner: {fileID: 701091197} +--- !u!1 &376869429 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 376869430} + - component: {fileID: 376869431} + m_Layer: 0 + m_Name: Controller Manager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &376869430 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 376869429} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1633830349} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &376869431 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 376869429} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 494dd9677a9308d48ab3ea7b149d6fce, type: 3} + m_Name: + m_EditorClassIdentifier: + m_CurrentControllerType: 0 + m_Target: {fileID: 387060610} + m_ControllerTargetRoot: {fileID: 1484385545} + m_ControllerTarget: {fileID: 1588877744} + m_Chair: {fileID: 1412792148} + m_Offset: 0 --- !u!1 &377437129 GameObject: m_ObjectHideFlags: 0 @@ -1112,7 +1162,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 377437129} serializedVersion: 2 - m_LocalRotation: {x: -0.037838772, y: 0.8817097, z: -0.071784794, w: -0.46476156} + m_LocalRotation: {x: -0.03783877, y: 0.8817097, z: -0.07178479, w: -0.46476156} m_LocalPosition: {x: -128.4, y: 13, z: -248.6} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -1150,7 +1200,7 @@ MonoBehaviour: LensShift: {x: 0, y: 0} GateFit: 1 FocusDistance: 0.01 - m_SensorSize: {x: 70.41, y: 52.63} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.0005 Aperture: 1.9 @@ -1353,6 +1403,11 @@ PrefabInstance: propertyPath: m_Name value: Target_Cube objectReference: {fileID: 0} + - target: {fileID: 9113762406916612572, guid: 263d8cea838224448bdfd0e71bc2dce4, + type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_RemovedGameObjects: [] m_AddedGameObjects: [] @@ -1571,14 +1626,14 @@ Camera: m_projectionMatrixMode: 2 m_GateFitMode: 1 m_FOVAxisMode: 0 - m_Iso: 50 - m_ShutterSpeed: 0.002 - m_Aperture: 3.6 - m_FocusDistance: 8.544005 - m_FocalLength: 35.000004 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 72.29987 m_BladeCount: 5 - m_Curvature: {x: 26.748837, y: 32} - m_BarrelClipping: 0.683 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 m_Anamorphism: 0 m_SensorSize: {x: 70.41, y: 52.63} m_LensShift: {x: 0, y: 0} @@ -1588,9 +1643,9 @@ Camera: y: 0 width: 1 height: 1 - near clip plane: 0.01 - far clip plane: 6707 - field of view: 73.87587 + near clip plane: 0.1 + far clip plane: 5000 + field of view: 40 orthographic: 0 orthographic size: 10 m_Depth: 0 @@ -1616,8 +1671,8 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 470663197} serializedVersion: 2 - m_LocalRotation: {x: 0.20631877, y: 0.13953522, z: -0.029739583, w: 0.96802795} - m_LocalPosition: {x: 5.837906, y: -3.307354, z: 9.716858} + m_LocalRotation: {x: 0.10779748, y: 0.7760193, z: -0.60589767, w: 0.13806446} + m_LocalPosition: {x: 6.542618, y: 33.692642, z: 12.266113} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -1738,7 +1793,7 @@ MonoBehaviour: LensShift: {x: 0, y: 0} GateFit: 1 FocusDistance: 8.93528 - m_SensorSize: {x: 70.41, y: 52.63} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.0005 Aperture: 2.2 @@ -1891,7 +1946,7 @@ MonoBehaviour: LensShift: {x: 0, y: 0} GateFit: 1 FocusDistance: 10 - m_SensorSize: {x: 70.41, y: 52.63} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.0005 Aperture: 2.2 @@ -2032,6 +2087,85 @@ MonoBehaviour: m_ModelName: Walker m_Index: 4 m_Touched: 0 +--- !u!1 &562470283 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 562470284} + - component: {fileID: 562470285} + m_Layer: 0 + m_Name: Controller + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &562470284 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 562470283} + serializedVersion: 2 + m_LocalRotation: {x: 0.10779748, y: 0.7760193, z: -0.60589767, w: 0.13806446} + m_LocalPosition: {x: 6.542618, y: 33.692642, z: 12.266113} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 1148289870} + m_Father: {fileID: 953333220} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &562470285 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 562470283} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45e653bab7fb20e499bda25e1b646fea, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ExcludedPropertiesInInspector: + - m_Script + m_LockStageInInspector: + m_StreamingVersion: 20170927 + m_Priority: 10 + m_StandbyUpdate: 2 + m_LookAt: {fileID: 1412792148} + m_Follow: {fileID: 1412792148} + m_Lens: + FieldOfView: 40 + OrthographicSize: 10 + NearClipPlane: 0.1 + FarClipPlane: 5000 + Dutch: 0 + ModeOverride: 0 + LensShift: {x: 0, y: 0} + GateFit: 1 + FocusDistance: 10 + m_SensorSize: {x: 70.41, y: 52.63} + Iso: 200 + ShutterSpeed: 0.005 + Aperture: 16 + BladeCount: 5 + Curvature: {x: 2, y: 11} + BarrelClipping: 0.25 + Anamorphism: 0 + m_Transitions: + m_BlendHint: 0 + m_InheritPosition: 0 + m_OnCameraLive: + m_PersistentCalls: + m_Calls: [] + m_LegacyBlendHint: 0 + m_ComponentOwner: {fileID: 1148289870} --- !u!1 &564168001 GameObject: m_ObjectHideFlags: 0 @@ -2185,7 +2319,7 @@ MonoBehaviour: LensShift: {x: 0, y: 0} GateFit: 1 FocusDistance: 8.93528 - m_SensorSize: {x: 70.41, y: 52.63} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.0005 Aperture: 2.2 @@ -3103,6 +3237,7 @@ Transform: - {fileID: 604918582} - {fileID: 1974800728} - {fileID: 372183240} + - {fileID: 562470284} m_Father: {fileID: 2110284874} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &955235046 @@ -3314,7 +3449,7 @@ Transform: m_GameObject: {fileID: 1124157896} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0.97678393, z: -0, w: 0.21422696} - m_LocalPosition: {x: 5.837906, y: -3.307354, z: 9.716858} + m_LocalPosition: {x: 5.8378906, y: -3.307354, z: 9.716858} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -3354,7 +3489,7 @@ MonoBehaviour: LensShift: {x: 0, y: 0} GateFit: 1 FocusDistance: 0.01 - m_SensorSize: {x: 70.41, y: 52.63} + m_SensorSize: {x: 1, y: 1} Iso: 50 ShutterSpeed: 0.002 Aperture: 3.6 @@ -3482,6 +3617,86 @@ MonoBehaviour: m_FocusTarget: {fileID: 0} m_FocusOffset: 0 m_Profile: {fileID: 11400000, guid: 14b392ee213d25a48b1feddbd9f5a9be, type: 2} +--- !u!1 &1148289869 +GameObject: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1148289870} + - component: {fileID: 1148289873} + - component: {fileID: 1148289874} + - component: {fileID: 1148289875} + m_Layer: 0 + m_Name: cm + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1148289870 +Transform: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1148289869} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 257.3517, y: -12.767355, z: -515.5802} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 562470284} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1148289873 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1148289869} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1148289874 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1148289869} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1e8b78ac948f05a46a6d8339a503172b, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &1148289875 +MonoBehaviour: + m_ObjectHideFlags: 3 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1148289869} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fa7155796051b734daa718462081dc5f, type: 3} + m_Name: + m_EditorClassIdentifier: + m_BindingMode: 1 + m_FollowOffset: {x: 0, y: 40, z: -10} + m_XDamping: 1 + m_YDamping: 20 + m_ZDamping: 1 + m_AngularDampingMode: 0 + m_PitchDamping: 0 + m_YawDamping: 0 + m_RollDamping: 0 + m_AngularDamping: 0 --- !u!1 &1178814724 GameObject: m_ObjectHideFlags: 3 @@ -3507,7 +3722,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1178814724} serializedVersion: 2 - m_LocalRotation: {x: 0.015149893, y: 0.97544634, z: -0.20789988, w: 0.07108192} + m_LocalRotation: {x: 0.015149891, y: 0.9754463, z: -0.20789987, w: 0.071081914} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 @@ -4174,6 +4389,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ac0b09e7857660247b1477e93731de29, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!4 &1484385545 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 6618138482202815428, guid: f03606b436da1d94e977c8ffa2825bd9, + type: 3} + m_PrefabInstance: {fileID: 1412792145} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1503240170 PrefabInstance: m_ObjectHideFlags: 0 @@ -4361,6 +4582,12 @@ MonoBehaviour: m_ModelName: Walker m_Index: 19 m_Touched: 0 +--- !u!4 &1588877744 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 4153334373288207407, guid: f03606b436da1d94e977c8ffa2825bd9, + type: 3} + m_PrefabInstance: {fileID: 1412792145} + m_PrefabAsset: {fileID: 0} --- !u!1 &1633830348 GameObject: m_ObjectHideFlags: 0 @@ -4393,6 +4620,7 @@ Transform: - {fileID: 219793650} - {fileID: 699570148} - {fileID: 1793470376} + - {fileID: 376869430} m_Father: {fileID: 160784038} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1637099438 @@ -4764,6 +4992,7 @@ MonoBehaviour: - {fileID: 372183242} - {fileID: 377437131} - {fileID: 513050373} + - {fileID: 562470285} m_CMBrain: {fileID: 470663204} --- !u!1 &1882797708 GameObject: @@ -5326,6 +5555,11 @@ PrefabInstance: propertyPath: m_Name value: Waypoints objectReference: {fileID: 0} + - target: {fileID: 4823915812732403376, guid: 796c0c7bfd2e89547bd866eedcc6d386, + type: 3} + propertyPath: m_IsActive + value: 1 + objectReference: {fileID: 0} - target: {fileID: 5682263026450292309, guid: 796c0c7bfd2e89547bd866eedcc6d386, type: 3} propertyPath: m_Index diff --git a/Assets/7_Scripts/Controller.meta b/Assets/7_Scripts/Controller.meta new file mode 100644 index 0000000..383983a --- /dev/null +++ b/Assets/7_Scripts/Controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c987654204484064897a7f1f98bf68e1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/7_Scripts/Controller/ControllerManager.cs b/Assets/7_Scripts/Controller/ControllerManager.cs new file mode 100644 index 0000000..a707b28 --- /dev/null +++ b/Assets/7_Scripts/Controller/ControllerManager.cs @@ -0,0 +1,166 @@ +using System.Collections; +using System.Collections.Generic; +using Unity.MLAgents; +using Unity.VisualScripting; +using UnityEngine; +using UnityEngine.Rendering; + +public class ControllerManager : MonoBehaviour +{ + public static ControllerManager Instance { get; private set; } + + public enum ControllerType { + Controller, + Waypoints + } + + public ControllerType m_CurrentControllerType; + + private GameObject m_WpManager; + + public Transform m_Target; + + public Transform m_ControllerTargetRoot; + + public Transform m_ControllerTarget; + + public Transform m_Chair; + + private GameObject m_Agent; + + public float m_Offset; + + private void Awake() + { + if (Instance != null && Instance != this) + { + Destroy(this); + } + else + { + Instance = this; + } + + SetControllerType(m_CurrentControllerType); + m_Agent = m_ControllerTargetRoot.transform.parent.gameObject; + } + + private void SetControllerType(ControllerType type) + { + m_CurrentControllerType = type; + + m_WpManager = FindFirstObjectByType().gameObject; + + if (m_CurrentControllerType == ControllerType.Waypoints) + { + m_WpManager.SetActive(true); + } + else + { + m_WpManager.SetActive(false); + } + } + + private void Update() + { + if (m_CurrentControllerType == ControllerType.Controller) + { + if (m_Target != null) + { + ProcessInput(); + } + } + } + + private void ProcessInput() + { + RotateControllerRoot(); + SetWalkingSpeed(); + CheckIfClimbing(); + SetTargetCubeTransform(); + } + + private void SetTargetCubeTransform() + { + Vector3 chairPosition = new Vector3(m_Chair.position.x, m_Chair.position.y + m_Offset, m_Chair.position.z + m_Offset); + m_ControllerTargetRoot.transform.position = chairPosition; + + Vector3 controllerTargetPosition = m_ControllerTarget.transform.position; + m_Target.position = controllerTargetPosition; + + } + + private void RotateControllerRoot() + { + var rotation = 0; + var rotationIncrement = 5; + + if(Input.GetKey(KeyCode.A)) + { + rotation -= rotationIncrement; + } + + if(Input.GetKey(KeyCode.D)) + { + rotation += rotationIncrement; + } + + m_ControllerTargetRoot.Rotate(new Vector3(0, rotation, 0)); + } + + private void SetWalkingSpeed() + { + + string currentModel = m_Agent.GetComponent().m_currentModelName; + + if (Input.GetKey(KeyCode.W) && Input.GetKey(KeyCode.LeftShift)) + { + m_Agent.GetComponent().MTargetWalkingSpeed = 8f; + + } + else if (Input.GetKey(KeyCode.W) && !Input.GetKey(KeyCode.LeftShift)) + { + m_Agent.GetComponent().MTargetWalkingSpeed = 4f; + + } + else + { + m_Agent.GetComponent().MTargetWalkingSpeed = 0.1f; + } + + //Debug.Log($"{m_Agent.GetComponent().MTargetWalkingSpeed}"); + } + + private void CheckIfClimbing() + { + if (Input.GetKeyDown(KeyCode.Space)) + { + if(m_Agent.GetComponent().m_currentModelName != "Stairs") + { + // Swap to new model + m_Agent.GetComponent().SwitchModel("Stairs", m_Agent.GetComponent()); + } + else + { + m_Agent.GetComponent().SwitchModel("Walker", m_Agent.GetComponent()); + } + } + + if (m_Agent.GetComponent().m_currentModelName == "Stairs") + { + // Adjust height of controller target + m_Offset = 2f; + m_Agent.GetComponent().MTargetWalkingSpeed = 8f; + } + else + { + m_Offset = 0; + } + + if (m_Agent.GetComponent().m_currentModelName == "Getup") + { + m_Agent.GetComponent().MTargetWalkingSpeed = 8f; + } + } + +} diff --git a/Assets/7_Scripts/Controller/ControllerManager.cs.meta b/Assets/7_Scripts/Controller/ControllerManager.cs.meta new file mode 100644 index 0000000..c30cef9 --- /dev/null +++ b/Assets/7_Scripts/Controller/ControllerManager.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 494dd9677a9308d48ab3ea7b149d6fce \ No newline at end of file diff --git a/Assets/ML-Agents/Timers/Beep_timers.json b/Assets/ML-Agents/Timers/Beep_timers.json index f87921c..db5d61e 100644 --- a/Assets/ML-Agents/Timers/Beep_timers.json +++ b/Assets/ML-Agents/Timers/Beep_timers.json @@ -1 +1 @@ -{"count":1,"self":27.504924799999998,"total":27.816705199999998,"children":{"InitializeActuators":{"count":1,"self":0.0009989,"total":0.0009989,"children":null},"InitializeSensors":{"count":1,"self":0.0030057,"total":0.0030057,"children":null},"AgentSendState":{"count":1053,"self":0.016508699999999998,"total":0.046900399999999995,"children":{"CollectObservations":{"count":211,"self":0.0088525,"total":0.0088525,"children":null},"WriteActionMask":{"count":211,"self":0.0015241,"total":0.0015241,"children":null},"RequestDecision":{"count":211,"self":0.020015099999999997,"total":0.020015099999999997,"children":null}}},"DecideAction":{"count":1053,"self":0.2454862,"total":0.2496176,"children":{"RayPerceptionSensor.Perceive":{"count":211,"self":0.0041313999999999995,"total":0.0041313999999999995,"children":null}}},"AgentAct":{"count":1053,"self":0.0107549,"total":0.0107549,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1711459812","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_03-Beep\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1711459840"}} \ No newline at end of file +{"count":1,"self":160.07833599999998,"total":161.7581979,"children":{"InitializeActuators":{"count":1,"self":0.0016497999999999999,"total":0.0016497999999999999,"children":null},"InitializeSensors":{"count":1,"self":0.004039,"total":0.004039,"children":null},"AgentSendState":{"count":7589,"self":0.10136389999999999,"total":0.1957705,"children":{"CollectObservations":{"count":1518,"self":0.0520992,"total":0.0520992,"children":null},"WriteActionMask":{"count":1518,"self":0,"total":0,"children":null},"RequestDecision":{"count":1518,"self":0.042307399999999995,"total":0.042307399999999995,"children":null}}},"DecideAction":{"count":7589,"self":1.4234396999999999,"total":1.4318741,"children":{"RayPerceptionSensor.Perceive":{"count":1518,"self":0.0084344,"total":0.0084344,"children":null}}},"AgentAct":{"count":7589,"self":0.0455219,"total":0.0455219,"children":null}},"gauges":{},"metadata":{"timer_format_version":"0.1.0","start_time_seconds":"1711470994","unity_version":"2023.2.8f1","command_line_arguments":"C:\\Program Files\\Unity\\Hub\\Editor\\2023.2.8f1\\Editor\\Unity.exe -projectpath C:\\Users\\caile\\Desktop\\Projects\\24_03-Beep\\beep-final -useHub -hubIPC -cloudEnvironment production","communication_protocol_version":"1.5.0","com.unity.ml-agents_version":"2.3.0-exp.3","scene_name":"Beep","end_time_seconds":"1711471155"}} \ No newline at end of file diff --git a/Assets/Settings/HDRPDefaultResources/C Default.asset b/Assets/Settings/HDRPDefaultResources/C Default.asset index fa3a579..4561a04 100644 --- a/Assets/Settings/HDRPDefaultResources/C Default.asset +++ b/Assets/Settings/HDRPDefaultResources/C Default.asset @@ -337,7 +337,7 @@ MonoBehaviour: active: 1 shadows: m_OverrideState: 1 - m_Value: {x: 1, y: 0.94549036, z: 0.7819653, w: 0.122889616} + m_Value: {x: 1, y: 0.945, z: 0.78, w: 0.122889616} midtones: m_OverrideState: 1 m_Value: {x: 1, y: 1, z: 1, w: 0.05115768}