feat: gravity changer; smaller orbs which change gravity instantly

This commit is contained in:
Jakob Feldmann 2024-05-20 19:23:04 +02:00
parent fc7d9a3004
commit 9e96946b1a
6 changed files with 739 additions and 25 deletions

View File

@ -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}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6926b3895381aea48b807d579c1ce6a0
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1012,6 +1012,76 @@ Material:
- _rotation: {r: 0.1, g: 0, b: 0, a: 1} - _rotation: {r: 0.1, g: 0, b: 0, a: 1}
- _shield_color: {r: 0, g: 0, b: 1, a: 1} - _shield_color: {r: 0, g: 0, b: 1, a: 1}
m_BuildTextureStacks: [] 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 --- !u!1001 &149098264
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1417,6 +1487,76 @@ Material:
- _rotation: {r: 0.1, g: 0, b: 0, a: 1} - _rotation: {r: 0.1, g: 0, b: 0, a: 1}
- _shield_color: {r: 0, g: 0, b: 1, a: 1} - _shield_color: {r: 0, g: 0, b: 1, a: 1}
m_BuildTextureStacks: [] 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 --- !u!1 &264594304
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -2007,6 +2147,46 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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 --- !u!21 &671011786
Material: Material:
serializedVersion: 8 serializedVersion: 8
@ -4016,6 +4196,7 @@ RectTransform:
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: m_Children:
- {fileID: 1884619255} - {fileID: 1884619255}
- {fileID: 592057803}
- {fileID: 1712474357} - {fileID: 1712474357}
- {fileID: 3628763} - {fileID: 3628763}
- {fileID: 963194228} - {fileID: 963194228}
@ -4541,6 +4722,72 @@ Transform:
m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: a8cbef7225a60ab49ae0eebd0704a068, type: 3} m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: a8cbef7225a60ab49ae0eebd0704a068, type: 3}
m_PrefabInstance: {fileID: 1585995789} m_PrefabInstance: {fileID: 1585995789}
m_PrefabAsset: {fileID: 0} 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 --- !u!1 &1659830375
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4964,7 +5211,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 1884619255} - component: {fileID: 1884619255}
m_Layer: 5 m_Layer: 5
m_Name: Spheres m_Name: Nimble Zones
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -5337,6 +5584,76 @@ Transform:
m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: a8cbef7225a60ab49ae0eebd0704a068, type: 3} m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: a8cbef7225a60ab49ae0eebd0704a068, type: 3}
m_PrefabInstance: {fileID: 1993802128} m_PrefabInstance: {fileID: 1993802128}
m_PrefabAsset: {fileID: 0} 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 --- !u!1001 &2035067024
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5407,6 +5724,76 @@ Transform:
m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: a8cbef7225a60ab49ae0eebd0704a068, type: 3} m_CorrespondingSourceObject: {fileID: 5300185106086715317, guid: a8cbef7225a60ab49ae0eebd0704a068, type: 3}
m_PrefabInstance: {fileID: 2035067024} m_PrefabInstance: {fileID: 2035067024}
m_PrefabAsset: {fileID: 0} 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 --- !u!1001 &5283318567490213766
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -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<GravityColorEntry> GravityColors = new();
private Dictionary<Gravity, Color> _gravityColors =
new Dictionary<Gravity, Color>
{
{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<MeshRenderer>();
_nimbleZoneTransform = gameObject.transform;
ApplyZoneColor(meshRenderer);
#if UNITY_EDITOR
if (!Application.isPlaying) return;
#endif
material = meshRenderer.material;
}
/// <summary>
/// Array of the available gravities.
/// </summary>
private Func<Transform, Transform, Vector3>[] gravityFunctions =
{ DownGravity, UpGravity, NoGravity, InwardsGravity, OutwardsGravity };
/// <summary>
/// Function which returns a gravity zero vector.
/// </summary>
private static readonly Func<Transform, Transform, Vector3> NoGravity =
new((gravitySource, target) => new Vector3());
/// <summary>
/// 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.
/// </summary>
private static readonly Func<Transform, Transform, Vector3> DownGravity =
new((gravitySource, target) =>
gravitySource.rotation * Vector3.down * _gravityFactor);
/// <summary>
/// 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.
/// </summary>
private static readonly Func<Transform, Transform, Vector3> UpGravity =
new((gravitySource, target) =>
gravitySource.rotation * Vector3.up * _gravityFactor);
/// <summary>
/// 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.
/// </summary>
private static readonly Func<Transform, Transform, Vector3> InwardsGravity =
new((gravitySource, target) =>
(target.position - gravitySource.position).normalized * -_gravityFactor);
/// <summary>
/// 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.
/// </summary>
private static readonly Func<Transform, Transform, Vector3> OutwardsGravity =
new((gravitySource, target) =>
(target.position - gravitySource.position).normalized * _gravityFactor);
public Func<Transform, Transform, Vector3> 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;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 42bb47879381c4f498a115b2b84b191a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -19,22 +19,22 @@ public class NimbleZone : MonoBehaviour
public GameObject renderedZoneObject; public GameObject renderedZoneObject;
[SerializeField] [SerializeField]
private List<NimbleZoneColorDictionaryEntry> NimbleZoneColors = new(); private List<GravityColorEntry> NimbleZoneColors = new();
private Dictionary<Gravities, Color> _nimbleZoneColors = private Dictionary<Gravity, Color> _nimbleZoneColors =
new Dictionary<Gravities, Color> new Dictionary<Gravity, Color>
{ {
{Gravities.DownGravity, Color.green }, {Gravity.DownGravity, Color.green },
{Gravities.UpGravity, Color.magenta }, {Gravity.UpGravity, Color.magenta },
{Gravities.NoGravity, Color.red }, {Gravity.NoGravity, Color.red },
{Gravities.InwardsGravity, Color.blue }, {Gravity.InwardsGravity, Color.blue },
{Gravities.OutwardsGravity, Color.yellow }, {Gravity.OutwardsGravity, Color.yellow },
}; };
[SerializeField] [SerializeField]
private static float gravityFactor = 30f; private static float gravityFactor = 30f;
[SerializeField] [SerializeField]
private Gravities outsideGravityFunction = Gravities.NoGravity; private Gravity outsideGravityFunction = Gravity.NoGravity;
[SerializeField] [SerializeField]
private Zone zone = Zone.NimbleZone; private Zone zone = Zone.NimbleZone;
@ -63,7 +63,7 @@ public class NimbleZone : MonoBehaviour
void Awake() void Awake()
{ {
foreach (NimbleZoneColorDictionaryEntry entry in NimbleZoneColors) foreach (GravityColorEntry entry in NimbleZoneColors)
{ {
_nimbleZoneColors[entry.gravity] = entry.color; _nimbleZoneColors[entry.gravity] = entry.color;
} }
@ -125,7 +125,7 @@ public class NimbleZone : MonoBehaviour
new((gravitySource, target) => new((gravitySource, target) =>
(target.position - gravitySource.position).normalized * gravityFactor); (target.position - gravitySource.position).normalized * gravityFactor);
public Func<Transform, Transform, Vector3> GetGravityFunction(Gravities gravity) public Func<Transform, Transform, Vector3> GetGravityFunction(Gravity gravity)
{ {
return gravityFunctions[(int)gravity]; return gravityFunctions[(int)gravity];
} }
@ -276,15 +276,3 @@ public class NimbleZone : MonoBehaviour
} }
public enum Gravities
{
DownGravity, UpGravity, NoGravity, InwardsGravity, OutwardsGravity
}
[Serializable]
public class NimbleZoneColorDictionaryEntry
{
public Gravities gravity;
public Color color;
}