diff --git a/Assets/Prefabs/Gravity Changer.prefab b/Assets/Prefabs/Gravity Changer.prefab new file mode 100644 index 0000000..5dce29e --- /dev/null +++ b/Assets/Prefabs/Gravity Changer.prefab @@ -0,0 +1,171 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3680835022977216242 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5300185106086715317} + - component: {fileID: 2919080977001261938} + - component: {fileID: 8730031123856442731} + - component: {fileID: 6433935702469069213} + m_Layer: 3 + m_Name: Gravity Changer + m_TagString: Zone + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5300185106086715317 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3680835022977216242} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 3, y: 3, z: 3} + m_ConstrainProportionsScale: 1 + m_Children: + - {fileID: 3847966118591952769} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &2919080977001261938 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3680835022977216242} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!135 &8730031123856442731 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3680835022977216242} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 1 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 3 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!114 &6433935702469069213 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3680835022977216242} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42bb47879381c4f498a115b2b84b191a, type: 3} + m_Name: + m_EditorClassIdentifier: + forcesManager: {fileID: 0} + renderedZoneObject: {fileID: 3847966118592310179} + GravityColors: + - gravity: 0 + color: {r: 0.20188677, g: 1, b: 0.27700332, a: 0.27450982} + - gravity: 1 + color: {r: 0.81708485, g: 0.20943397, b: 1, a: 0.27450982} + - gravity: 2 + color: {r: 1, g: 0.2396226, b: 0.55570096, a: 0.27450982} + - gravity: 3 + color: {r: 0.25471687, g: 0.77203095, b: 1, a: 0.27450982} + - gravity: 4 + color: {r: 1, g: 0.4656382, b: 0.2471698, a: 0.27450982} + _gravity: 0 +--- !u!1001 &4147390443820438502 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 5300185106086715317} + m_Modifications: + - target: {fileID: 930210402018179143, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_Name + value: Nimble Zone Sphere + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalScale.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalScale.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalScale.z + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalPosition.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} +--- !u!4 &3847966118591952769 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 930210402018337895, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + m_PrefabInstance: {fileID: 4147390443820438502} + m_PrefabAsset: {fileID: 0} +--- !u!1 &3847966118592310179 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 930210402018179141, guid: 42641a1e05f4e084bae7d69b644dfd81, type: 3} + m_PrefabInstance: {fileID: 4147390443820438502} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Prefabs/Gravity Changer.prefab.meta b/Assets/Prefabs/Gravity Changer.prefab.meta new file mode 100644 index 0000000..6d65b95 --- /dev/null +++ b/Assets/Prefabs/Gravity Changer.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6926b3895381aea48b807d579c1ce6a0 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/FreeFlyArena.unity b/Assets/Scenes/FreeFlyArena.unity index 52417ad..b3def60 100644 --- a/Assets/Scenes/FreeFlyArena.unity +++ b/Assets/Scenes/FreeFlyArena.unity @@ -1012,6 +1012,76 @@ Material: - _rotation: {r: 0.1, g: 0, b: 0, a: 1} - _shield_color: {r: 0, g: 0, b: 1, a: 1} m_BuildTextureStacks: [] +--- !u!1001 &126387764 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 592057803} + m_Modifications: + - target: {fileID: 3680835022977216242, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_Name + value: Gravity Changer (1) + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.x + value: 17.9 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6433935702469069213, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: _gravity + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6433935702469069213, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: forcesManager + value: + objectReference: {fileID: 1659830376} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} +--- !u!4 &126387765 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + m_PrefabInstance: {fileID: 126387764} + m_PrefabAsset: {fileID: 0} --- !u!1001 &149098264 PrefabInstance: m_ObjectHideFlags: 0 @@ -1417,6 +1487,76 @@ Material: - _rotation: {r: 0.1, g: 0, b: 0, a: 1} - _shield_color: {r: 0, g: 0, b: 1, a: 1} m_BuildTextureStacks: [] +--- !u!1001 &245728173 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 592057803} + m_Modifications: + - target: {fileID: 3680835022977216242, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_Name + value: Gravity Changer (4) + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.x + value: 7.5 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6433935702469069213, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: _gravity + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 6433935702469069213, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: forcesManager + value: + objectReference: {fileID: 1659830376} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} +--- !u!4 &245728174 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + m_PrefabInstance: {fileID: 245728173} + m_PrefabAsset: {fileID: 0} --- !u!1 &264594304 GameObject: m_ObjectHideFlags: 0 @@ -2007,6 +2147,46 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &592057802 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 592057803} + m_Layer: 5 + m_Name: Gravity Changers + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &592057803 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 592057802} + 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: + - {fileID: 1644055483} + - {fileID: 126387765} + - {fileID: 2109643775} + - {fileID: 2016828225} + - {fileID: 245728174} + m_Father: {fileID: 1533660267} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0, y: 42.6} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} --- !u!21 &671011786 Material: serializedVersion: 8 @@ -4016,6 +4196,7 @@ RectTransform: m_ConstrainProportionsScale: 1 m_Children: - {fileID: 1884619255} + - {fileID: 592057803} - {fileID: 1712474357} - {fileID: 3628763} - {fileID: 963194228} @@ -4541,6 +4722,72 @@ Transform: m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: a8cbef7225a60ab49ae0eebd0704a068, type: 3} m_PrefabInstance: {fileID: 1585995789} m_PrefabAsset: {fileID: 0} +--- !u!1001 &1644055482 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 592057803} + m_Modifications: + - target: {fileID: 3680835022977216242, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_Name + value: Gravity Changer + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6433935702469069213, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: forcesManager + value: + objectReference: {fileID: 1659830376} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} +--- !u!4 &1644055483 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + m_PrefabInstance: {fileID: 1644055482} + m_PrefabAsset: {fileID: 0} --- !u!1 &1659830375 GameObject: m_ObjectHideFlags: 0 @@ -4964,7 +5211,7 @@ GameObject: m_Component: - component: {fileID: 1884619255} m_Layer: 5 - m_Name: Spheres + m_Name: Nimble Zones m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -5337,6 +5584,76 @@ Transform: m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: a8cbef7225a60ab49ae0eebd0704a068, type: 3} m_PrefabInstance: {fileID: 1993802128} m_PrefabAsset: {fileID: 0} +--- !u!1001 &2016828224 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 592057803} + m_Modifications: + - target: {fileID: 3680835022977216242, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_Name + value: Gravity Changer (3) + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.x + value: -9.3 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6433935702469069213, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: _gravity + value: 4 + objectReference: {fileID: 0} + - target: {fileID: 6433935702469069213, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: forcesManager + value: + objectReference: {fileID: 1659830376} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} +--- !u!4 &2016828225 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + m_PrefabInstance: {fileID: 2016828224} + m_PrefabAsset: {fileID: 0} --- !u!1001 &2035067024 PrefabInstance: m_ObjectHideFlags: 0 @@ -5407,6 +5724,76 @@ Transform: m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: a8cbef7225a60ab49ae0eebd0704a068, type: 3} m_PrefabInstance: {fileID: 2035067024} m_PrefabAsset: {fileID: 0} +--- !u!1001 &2109643774 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 592057803} + m_Modifications: + - target: {fileID: 3680835022977216242, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_Name + value: Gravity Changer (2) + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.x + value: -20.1 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalPosition.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6433935702469069213, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: _gravity + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 6433935702469069213, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + propertyPath: forcesManager + value: + objectReference: {fileID: 1659830376} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} +--- !u!4 &2109643775 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: 6926b3895381aea48b807d579c1ce6a0, type: 3} + m_PrefabInstance: {fileID: 2109643774} + m_PrefabAsset: {fileID: 0} --- !u!1001 &5283318567490213766 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/GravityChanger.cs b/Assets/Scripts/GravityChanger.cs new file mode 100644 index 0000000..95ce28d --- /dev/null +++ b/Assets/Scripts/GravityChanger.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using log4net; +using Managers; +using Unity.Mathematics; +using Unity.VisualScripting; +using UnityEngine; +using UnityEngine.UIElements; +using static AffectingForcesManager; + +[ExecuteInEditMode] +public class GravityChanger : MonoBehaviour +{ + private static ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static Transform _nimbleZoneTransform; + public AffectingForcesManager forcesManager; + + public GameObject renderedZoneObject; + + [SerializeField] + private List GravityColors = new(); + + private Dictionary _gravityColors = + new Dictionary + { + {Gravity.DownGravity, Color.green }, + {Gravity.UpGravity, Color.magenta }, + {Gravity.NoGravity, Color.red }, + {Gravity.InwardsGravity, Color.blue }, + {Gravity.OutwardsGravity, Color.yellow }, + }; + + [SerializeField] + private static float _gravityFactor = 30f; + + [SerializeField] + private Gravity _gravity = Gravity.NoGravity; + + private int maxRippleAmount = 5; + private MeshRenderer meshRenderer; + private Material material; + + void Awake() + { + foreach (GravityColorEntry entry in GravityColors) + { + _gravityColors[entry.gravity] = entry.color; + } + meshRenderer = renderedZoneObject.GetComponent(); + _nimbleZoneTransform = gameObject.transform; + ApplyZoneColor(meshRenderer); + +#if UNITY_EDITOR + if (!Application.isPlaying) return; +#endif + + material = meshRenderer.material; + } + + /// + /// Array of the available gravities. + /// + private Func[] gravityFunctions = + { DownGravity, UpGravity, NoGravity, InwardsGravity, OutwardsGravity }; + + /// + /// Function which returns a gravity zero vector. + /// + private static readonly Func NoGravity = + new((gravitySource, target) => new Vector3()); + + /// + /// Function which returns a gravity vector downwards, depending + /// on the parent transforms rotation. + /// The parenting transform for a ship is the arena it's in. + /// + private static readonly Func DownGravity = + new((gravitySource, target) => + gravitySource.rotation * Vector3.down * _gravityFactor); + + /// + /// Function which returns a gravity vector upwards, depending + /// on the parent transforms rotation. + /// The parenting transform for a ship is the arena it's in. + /// + private static readonly Func UpGravity = + new((gravitySource, target) => + gravitySource.rotation * Vector3.up * _gravityFactor); + + /// + /// Function which returns a gravity vector towards the center of the parenting transform. + /// The parenting transform for a ship is the arena it's in. + /// + private static readonly Func InwardsGravity = + new((gravitySource, target) => + (target.position - gravitySource.position).normalized * -_gravityFactor); + + /// + /// Function which returns a gravity vector outwards from the center of the parenting transform. + /// The parenting transform for a ship is the arena it's in. + /// + private static readonly Func OutwardsGravity = + new((gravitySource, target) => + (target.position - gravitySource.position).normalized * _gravityFactor); + + public Func GetGravityFunction(Gravity gravity) + { + return gravityFunctions[(int)gravity]; + } + + private void OnTriggerEnter(Collider collider) + { + int instanceID = collider.gameObject.GetInstanceID(); + if (collider.tag == "Ship") + { + forcesManager.SetGravityForInstance(instanceID, GetGravityFunction(_gravity), transform); + } + } + + private void Update() + { +#if UNITY_EDITOR + if (!Application.isPlaying) return; +#endif + material.SetFloat("_ShaderTime", Time.timeSinceLevelLoad); + } + + private void ApplyZoneColor(MeshRenderer renderer) + { + Color color = _gravityColors[_gravity]; + MaterialPropertyBlock materialPropertyBlock = new(); + materialPropertyBlock.SetColor("_BaseColor", color); + renderer.SetPropertyBlock(materialPropertyBlock); + } + + +} + +public enum Gravity +{ + DownGravity, UpGravity, NoGravity, InwardsGravity, OutwardsGravity +} + +[Serializable] +public class GravityColorEntry +{ + public Gravity gravity; + public Color color; +} diff --git a/Assets/Scripts/GravityChanger.cs.meta b/Assets/Scripts/GravityChanger.cs.meta new file mode 100644 index 0000000..5c3d9c0 --- /dev/null +++ b/Assets/Scripts/GravityChanger.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42bb47879381c4f498a115b2b84b191a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/NimbleZone.cs b/Assets/Scripts/NimbleZone.cs index a0309e4..70a3d5a 100644 --- a/Assets/Scripts/NimbleZone.cs +++ b/Assets/Scripts/NimbleZone.cs @@ -19,22 +19,22 @@ public class NimbleZone : MonoBehaviour public GameObject renderedZoneObject; [SerializeField] - private List NimbleZoneColors = new(); + private List NimbleZoneColors = new(); - private Dictionary _nimbleZoneColors = - new Dictionary + private Dictionary _nimbleZoneColors = + new Dictionary { - {Gravities.DownGravity, Color.green }, - {Gravities.UpGravity, Color.magenta }, - {Gravities.NoGravity, Color.red }, - {Gravities.InwardsGravity, Color.blue }, - {Gravities.OutwardsGravity, Color.yellow }, + {Gravity.DownGravity, Color.green }, + {Gravity.UpGravity, Color.magenta }, + {Gravity.NoGravity, Color.red }, + {Gravity.InwardsGravity, Color.blue }, + {Gravity.OutwardsGravity, Color.yellow }, }; [SerializeField] private static float gravityFactor = 30f; [SerializeField] - private Gravities outsideGravityFunction = Gravities.NoGravity; + private Gravity outsideGravityFunction = Gravity.NoGravity; [SerializeField] private Zone zone = Zone.NimbleZone; @@ -63,7 +63,7 @@ public class NimbleZone : MonoBehaviour void Awake() { - foreach (NimbleZoneColorDictionaryEntry entry in NimbleZoneColors) + foreach (GravityColorEntry entry in NimbleZoneColors) { _nimbleZoneColors[entry.gravity] = entry.color; } @@ -125,7 +125,7 @@ public class NimbleZone : MonoBehaviour new((gravitySource, target) => (target.position - gravitySource.position).normalized * gravityFactor); - public Func GetGravityFunction(Gravities gravity) + public Func GetGravityFunction(Gravity gravity) { return gravityFunctions[(int)gravity]; } @@ -275,16 +275,4 @@ public class NimbleZone : MonoBehaviour } -} - -public enum Gravities -{ - DownGravity, UpGravity, NoGravity, InwardsGravity, OutwardsGravity -} - -[Serializable] -public class NimbleZoneColorDictionaryEntry -{ - public Gravities gravity; - public Color color; -} +} \ No newline at end of file