Update
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0562eeefa7a963429a4ee595d37adb4
|
||||
folderAsset: yes
|
||||
timeCreated: 1494437079
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,510 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &137936
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22474998}
|
||||
- component: {fileID: 22289816}
|
||||
- component: {fileID: 11430320}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22474998
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 137936}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 22462718}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 75, y: 0}
|
||||
m_SizeDelta: {x: -150, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &22289816
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 137936}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &11430320
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 137936}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 2100000, guid: a33be1e1efa8ca14286b77d062313a4e, type: 2}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: a8f74dbf0f81e504bbbdf3f6063e1047, type: 3}
|
||||
m_FontSize: 100
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 1
|
||||
m_MinSize: 50
|
||||
m_MaxSize: 100
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: 'action text
|
||||
|
||||
F'
|
||||
--- !u!1 &146674
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22462718}
|
||||
- component: {fileID: 22244980}
|
||||
- component: {fileID: 11404324}
|
||||
- component: {fileID: 11492154}
|
||||
m_Layer: 5
|
||||
m_Name: bg
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22462718
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 146674}
|
||||
m_LocalRotation: {x: 0, y: -1, z: 0, w: -0.00000010430813}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 22474998}
|
||||
- {fileID: 22493032}
|
||||
- {fileID: 22433174}
|
||||
m_Father: {fileID: 22447194}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &22244980
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 146674}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &11404324
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 146674}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 2100000, guid: a33be1e1efa8ca14286b77d062313a4e, type: 2}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 0.627451}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &11492154
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 146674}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 60254cc56f3d5d04896861196a404996, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
OnChangeToKeyboard:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 190832}
|
||||
m_MethodName: SetActive
|
||||
m_Mode: 6
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
- m_Target: {fileID: 154448}
|
||||
m_MethodName: SetActive
|
||||
m_Mode: 6
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 1
|
||||
m_CallState: 2
|
||||
OnChangeToMobile:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
OnChangeToJoystick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 190832}
|
||||
m_MethodName: SetActive
|
||||
m_Mode: 6
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 1
|
||||
m_CallState: 2
|
||||
- m_Target: {fileID: 154448}
|
||||
m_MethodName: SetActive
|
||||
m_Mode: 6
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!1 &154448
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22493032}
|
||||
- component: {fileID: 22229584}
|
||||
- component: {fileID: 11453002}
|
||||
m_Layer: 5
|
||||
m_Name: icon_keyboard
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22493032
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 154448}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 22462718}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0.00064086914, y: 0.0000141859055}
|
||||
m_SizeDelta: {x: 150, y: 150}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!222 &22229584
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 154448}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &11453002
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 154448}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 2100000, guid: a33be1e1efa8ca14286b77d062313a4e, type: 2}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 9dc1b1e35a44b5a4da340dd179166361, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &190832
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22433174}
|
||||
- component: {fileID: 22292520}
|
||||
- component: {fileID: 11468942}
|
||||
m_Layer: 5
|
||||
m_Name: icon_controller
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22433174
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 190832}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 22462718}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 150, y: 150}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!222 &22292520
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 190832}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &11468942
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 190832}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 2100000, guid: a33be1e1efa8ca14286b77d062313a4e, type: 2}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: cfea15071ee3a4543ba205f132c5da33, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &196820
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22447194}
|
||||
- component: {fileID: 22359920}
|
||||
- component: {fileID: 11429832}
|
||||
- component: {fileID: 11408192}
|
||||
- component: {fileID: 11402886}
|
||||
- component: {fileID: 11426842}
|
||||
m_Layer: 5
|
||||
m_Name: vActionText_ExampleA
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22447194
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 28.808083}
|
||||
m_LocalScale: {x: 0.0017500378, y: 0.0017500373, z: 0.0017500373}
|
||||
m_Children:
|
||||
- {fileID: 22462718}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 24.946892, y: 0.816}
|
||||
m_SizeDelta: {x: 700, y: 150}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!223 &22359920
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 2
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &11429832
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
--- !u!114 &11408192
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!114 &11402886
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 19c789670a80b704eba4dfebed94a111, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
header: COMMENT
|
||||
comment: 'This is a ingame HUD example, it will render above all objects and follow
|
||||
the camera.
|
||||
|
||||
|
||||
Inside you can modify the Text or the Sprite buttons.'
|
||||
inEdit: 0
|
||||
--- !u!114 &11426842
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: a5bfa2d224a49724b94dd6c24553be35, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
alignUp: 0
|
||||
height: 1
|
||||
detachOnStart: 0
|
||||
useSmothRotation: 1
|
||||
justY: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c08c0d81378ff14e93e590e27e40c1d
|
||||
timeCreated: 1494437091
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,493 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &137936
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22474998}
|
||||
- component: {fileID: 22289816}
|
||||
- component: {fileID: 11430320}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22474998
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 137936}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 22462718}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 75, y: 0}
|
||||
m_SizeDelta: {x: -150, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &22289816
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 137936}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &11430320
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 137936}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 12800000, guid: a8f74dbf0f81e504bbbdf3f6063e1047, type: 3}
|
||||
m_FontSize: 100
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 1
|
||||
m_MinSize: 50
|
||||
m_MaxSize: 100
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: 'action text
|
||||
|
||||
F'
|
||||
--- !u!1 &146674
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22462718}
|
||||
- component: {fileID: 22244980}
|
||||
- component: {fileID: 11404324}
|
||||
- component: {fileID: 11492154}
|
||||
m_Layer: 5
|
||||
m_Name: bg
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22462718
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 146674}
|
||||
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_Children:
|
||||
- {fileID: 22474998}
|
||||
- {fileID: 22493032}
|
||||
- {fileID: 22433174}
|
||||
m_Father: {fileID: 22447194}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &22244980
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 146674}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &11404324
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 146674}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 0.627451}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 0}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &11492154
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 146674}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 60254cc56f3d5d04896861196a404996, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
OnChangeToKeyboard:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 190832}
|
||||
m_MethodName: SetActive
|
||||
m_Mode: 6
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
- m_Target: {fileID: 154448}
|
||||
m_MethodName: SetActive
|
||||
m_Mode: 6
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 1
|
||||
m_CallState: 2
|
||||
OnChangeToMobile:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
OnChangeToJoystick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 190832}
|
||||
m_MethodName: SetActive
|
||||
m_Mode: 6
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 1
|
||||
m_CallState: 2
|
||||
- m_Target: {fileID: 154448}
|
||||
m_MethodName: SetActive
|
||||
m_Mode: 6
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!1 &154448
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22493032}
|
||||
- component: {fileID: 22229584}
|
||||
- component: {fileID: 11453002}
|
||||
m_Layer: 5
|
||||
m_Name: icon_keyboard
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22493032
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 154448}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 22462718}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0.00064086914, y: 0.0000141859055}
|
||||
m_SizeDelta: {x: 150, y: 150}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!222 &22229584
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 154448}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &11453002
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 154448}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: 9dc1b1e35a44b5a4da340dd179166361, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &190832
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22433174}
|
||||
- component: {fileID: 22292520}
|
||||
- component: {fileID: 11468942}
|
||||
m_Layer: 5
|
||||
m_Name: icon_controller
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22433174
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 190832}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 22462718}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.5}
|
||||
m_AnchorMax: {x: 0, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 150, y: 150}
|
||||
m_Pivot: {x: 0, y: 0.5}
|
||||
--- !u!222 &22292520
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 190832}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &11468942
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 190832}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: cfea15071ee3a4543ba205f132c5da33, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 1
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &196820
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 22447194}
|
||||
- component: {fileID: 22359920}
|
||||
- component: {fileID: 11429832}
|
||||
- component: {fileID: 11408192}
|
||||
- component: {fileID: 11402886}
|
||||
m_Layer: 5
|
||||
m_Name: vActionText_ExampleB
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &22447194
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 28.228796}
|
||||
m_LocalScale: {x: 0.0017500378, y: 0.0017500373, z: 0.0017500373}
|
||||
m_Children:
|
||||
- {fileID: 22462718}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 24.609264, y: 0.195}
|
||||
m_SizeDelta: {x: 700, y: 150}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!223 &22359920
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 2
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_AdditionalShaderChannelsFlag: 25
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &11429832
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 0
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 800, y: 600}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
--- !u!114 &11408192
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!114 &11402886
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 196820}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 19c789670a80b704eba4dfebed94a111, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
header: COMMENT
|
||||
comment: 'This is a ingame HUD example, you can use on world space and it will
|
||||
render just like a normal Object.
|
||||
|
||||
|
||||
Inside you can modify the Text or the
|
||||
Sprite buttons.'
|
||||
inEdit: 0
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 544aa551098166042af57ffecc053c48
|
||||
timeCreated: 1494449016
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,111 @@
|
||||
using UnityEngine;
|
||||
namespace Invector.vCharacterController.vActions
|
||||
{
|
||||
/// <summary>
|
||||
/// Define all the Action Controllers.
|
||||
/// </summary>
|
||||
public interface IActionController
|
||||
{
|
||||
bool enabled { get; set; }
|
||||
GameObject gameObject { get; }
|
||||
Transform transform { get; }
|
||||
string name { get; }
|
||||
System.Type GetType();
|
||||
}
|
||||
/// <summary>
|
||||
/// Used to receive Event when do action.
|
||||
/// Ps. Need implementation
|
||||
/// </summary>
|
||||
public interface IActionReceiver : IActionController
|
||||
{
|
||||
void OnReceiveAction(vTriggerGenericAction actionInfo);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Used to register the event <see cref="vCharacter.onActionEnter"/> in the <see cref="vCharacter"/>. Ps.Need implementation
|
||||
/// </summary>
|
||||
public interface IActionEnterListener : IActionController
|
||||
{
|
||||
void OnActionEnter(Collider actionCollider);
|
||||
}
|
||||
/// <summary>
|
||||
/// Used to register the event <see cref="vCharacter.onActionExit"/> in the <see cref="vCharacter"/>. Ps.Need implementation
|
||||
/// </summary>
|
||||
public interface IActionExitListener : IActionController
|
||||
{
|
||||
void OnActionExit(Collider actionCollider);
|
||||
}
|
||||
/// <summary>
|
||||
/// Used to register the event <see cref="vCharacter.onActionStay"/> in the <see cref="vCharacter"/>. Ps. Need implementation
|
||||
/// </summary>
|
||||
public interface IActionStayListener : IActionController
|
||||
{
|
||||
void OnActionStay(Collider actionCollider);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Used to register the events <see cref="vCharacter.onActionEnter"/>,<see cref="vCharacter.onActionStay"/> and <see cref="vCharacter.onActionExit"/> in the <see cref="vCharacter"/>. Depending of options enabled (<see cref="vActionListener.actionEnter"/>, <see cref="vActionListener.actionStay"/> and <see cref="vActionListener.actionExit"/>). Ps. Need implementation
|
||||
/// </summary>
|
||||
public interface IActionListener : IActionEnterListener, IActionExitListener, IActionStayListener
|
||||
{
|
||||
bool actionEnter { get; set; }
|
||||
bool actionExit { get; set; }
|
||||
bool actionStay { get; set; }
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Implementation of the <see cref="IActionListener"/>.
|
||||
/// Used to register the events <see cref="vCharacter.onActionEnter"/>,<see cref="vCharacter.onActionStay"/> and <see cref="vCharacter.onActionExit"/> in the <see cref="vCharacter"/>.
|
||||
/// Depending of options enabled (<see cref="actionEnter"/>, <see cref="actionStay"/> and <see cref="actionExit"/>). Override <seealso cref="SetUpListener"/> to change default options (all enabled)
|
||||
/// </summary>
|
||||
public abstract class vActionListener : vMonoBehaviour, IActionListener
|
||||
{
|
||||
public bool actionEnter { get; set; }
|
||||
public bool actionExit { get; set; }
|
||||
public bool actionStay { get; set; }
|
||||
protected virtual void Awake()
|
||||
{
|
||||
SetUpListener();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called On Awake
|
||||
/// </summary>
|
||||
protected virtual void SetUpListener()
|
||||
{
|
||||
///Set what kind of action need to use;
|
||||
actionEnter = true;///Use Trigger Enter
|
||||
actionExit = true; ///Use Trigger Exit
|
||||
actionStay = true; ///Use Trigger Stay
|
||||
}
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void OnActionEnter(Collider other)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void OnActionStay(Collider other)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void OnActionExit(Collider other)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class vOnActionHandle : UnityEngine.Events.UnityEvent<vTriggerGenericAction>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d19b14876bfb07747ab805e15e655f8f
|
||||
timeCreated: 1494029663
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,914 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Invector.vCharacterController.vActions
|
||||
{
|
||||
using System.Collections.Generic;
|
||||
using vCharacterController;
|
||||
|
||||
[vClassHeader("GENERIC ACTION", "Use the vTriggerGenericAction to trigger a simple animation.\n<b><size=12>You can use <color=red>vGenericActionReceiver</color> component to filter events by action name</size></b>", iconName = "triggerIcon")]
|
||||
public class vGenericAction : vActionListener
|
||||
{
|
||||
#region Variables
|
||||
|
||||
[vEditorToolbar("Settings")]
|
||||
[Tooltip("Tag of the object you want to access")]
|
||||
public string actionTag = "Action";
|
||||
[Tooltip("Use root motion of the animation")]
|
||||
public bool useRootMotion = true;
|
||||
|
||||
[vEditorToolbar("Debug")]
|
||||
[Header("--- Debug Only ---")]
|
||||
[Tooltip("Check this to enter the debug mode")]
|
||||
public bool debugMode;
|
||||
[vReadOnly] protected vTriggerGenericAction _triggerAction;
|
||||
public virtual vTriggerGenericAction triggerAction { get => _triggerAction; set => _triggerAction = value; }
|
||||
|
||||
[vReadOnly, SerializeField]
|
||||
protected bool _playingAnimation;
|
||||
[vReadOnly, SerializeField]
|
||||
protected bool actionStarted;
|
||||
[vReadOnly]
|
||||
public bool isLockTriggerEvents;
|
||||
[vReadOnly, SerializeField]
|
||||
protected List<Collider> colliders = new List<Collider>();
|
||||
|
||||
[vEditorToolbar("Events")]
|
||||
public vOnActionHandle OnDoAction = new vOnActionHandle();
|
||||
public vOnActionHandle OnEnterTriggerAction;
|
||||
public vOnActionHandle OnExitTriggerAction;
|
||||
public vOnActionHandle OnStartAction;
|
||||
public vOnActionHandle OnCancelAction;
|
||||
public vOnActionHandle OnEndAction;
|
||||
|
||||
public bool doingAction { get; set; }
|
||||
public virtual Camera mainCamera { get; set; }
|
||||
public virtual vThirdPersonInput tpInput { get; set; }
|
||||
protected virtual float _currentInputDelay { get; set; }
|
||||
protected virtual Vector3 _screenCenter { get; set; }
|
||||
protected virtual float timeInTrigger { get; set; }
|
||||
protected virtual float animationBehaviourDelay { get; set; }
|
||||
|
||||
protected bool finishRotationMatch;
|
||||
protected bool finishPositionXZMatch;
|
||||
protected bool finishPositionYMatch;
|
||||
protected virtual Vector3 screenCenter
|
||||
{
|
||||
get
|
||||
{
|
||||
var center = _screenCenter;
|
||||
center.x = Screen.width * 0.5f;
|
||||
center.y = Screen.height * 0.5f;
|
||||
center.z = 0;
|
||||
return _screenCenter = center;
|
||||
}
|
||||
}
|
||||
|
||||
internal Dictionary<Collider, ActionStorage> actions;
|
||||
|
||||
#endregion
|
||||
|
||||
internal class ActionStorage
|
||||
{
|
||||
internal vTriggerGenericAction action;
|
||||
internal bool isValid;
|
||||
internal ActionStorage()
|
||||
{
|
||||
|
||||
}
|
||||
internal ActionStorage(vTriggerGenericAction action)
|
||||
{
|
||||
this.action = action;
|
||||
action.OnValidate.AddListener((GameObject o) => { isValid = true; });
|
||||
action.OnInvalidate.AddListener((GameObject o) => { isValid = false; });
|
||||
}
|
||||
public static implicit operator vTriggerGenericAction(ActionStorage storage)
|
||||
{
|
||||
return storage.action;
|
||||
}
|
||||
public static implicit operator ActionStorage(vTriggerGenericAction action)
|
||||
{
|
||||
return new ActionStorage(action);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetUpListener()
|
||||
{
|
||||
actionEnter = true;
|
||||
actionStay = true;
|
||||
actionExit = true;
|
||||
actions = new Dictionary<Collider, ActionStorage>();
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
tpInput = GetComponent<vThirdPersonInput>();
|
||||
|
||||
var actionsReceivers = GetComponentsInChildren<IActionReceiver>();
|
||||
|
||||
for (int i = 0; i < actionsReceivers.Length; i++)
|
||||
{
|
||||
OnDoAction.AddListener(actionsReceivers[i].OnReceiveAction);
|
||||
}
|
||||
|
||||
|
||||
if (tpInput != null)
|
||||
{
|
||||
tpInput.onUpdate -= CheckForTriggerAction;
|
||||
tpInput.onUpdate += CheckForTriggerAction;
|
||||
|
||||
tpInput.onLateUpdate -= UpdateGenericAction;
|
||||
tpInput.onLateUpdate += UpdateGenericAction;
|
||||
}
|
||||
if (!mainCamera)
|
||||
{
|
||||
mainCamera = Camera.main;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void UpdateGenericAction()
|
||||
{
|
||||
if (!mainCamera)
|
||||
{
|
||||
mainCamera = Camera.main;
|
||||
}
|
||||
|
||||
if (!mainCamera)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AnimationBehaviour();
|
||||
HandleColliders();
|
||||
}
|
||||
|
||||
protected virtual void HandleColliders()
|
||||
{
|
||||
colliders.Clear();
|
||||
foreach (var key in actions.Keys)
|
||||
{
|
||||
colliders.Add(key);
|
||||
}
|
||||
if (!doingAction && triggerAction && !isLockTriggerEvents)
|
||||
{
|
||||
if (timeInTrigger <= 0)
|
||||
{
|
||||
actions.Clear();
|
||||
triggerAction = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
timeInTrigger -= Time.deltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual bool inActionAnimation
|
||||
{
|
||||
get
|
||||
{
|
||||
return !string.IsNullOrEmpty(triggerAction.playAnimation)
|
||||
&& tpInput.cc.animatorStateInfos.stateInfos[triggerAction.animatorLayer].shortPathHash.Equals(Animator.StringToHash(triggerAction.playAnimation));
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void CheckForTriggerAction()
|
||||
{
|
||||
if (actions.Count == 0 && !triggerAction || isLockTriggerEvents)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
vTriggerGenericAction _triggerAction = GetNearAction();
|
||||
if (!doingAction && triggerAction != _triggerAction)
|
||||
{
|
||||
triggerAction = _triggerAction;
|
||||
if (triggerAction)
|
||||
{
|
||||
triggerAction.OnValidate.Invoke(gameObject);
|
||||
OnEnterTriggerAction.Invoke(triggerAction);
|
||||
}
|
||||
}
|
||||
|
||||
TriggerActionInput();
|
||||
}
|
||||
|
||||
protected virtual vTriggerGenericAction GetNearAction()
|
||||
{
|
||||
if (isLockTriggerEvents || doingAction || playingAnimation)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
float distance = Mathf.Infinity;
|
||||
vTriggerGenericAction _targetAction = null;
|
||||
|
||||
foreach (var key in actions.Keys)
|
||||
{
|
||||
if (key)
|
||||
{
|
||||
try
|
||||
{
|
||||
vTriggerGenericAction action = actions[key];
|
||||
var screenP = mainCamera ? mainCamera.WorldToScreenPoint(key.transform.position) : screenCenter;
|
||||
if (mainCamera)
|
||||
{
|
||||
|
||||
bool isValid = action.enabled && action.gameObject.activeInHierarchy && (!action.activeFromForward && (screenP - screenCenter).magnitude < distance || IsInForward(action.transform, action.forwardAngle) && (screenP - screenCenter).magnitude < distance);
|
||||
if (isValid)
|
||||
{
|
||||
distance = (screenP - screenCenter).magnitude;
|
||||
if (_targetAction && _targetAction != action)
|
||||
{
|
||||
if (actions[_targetAction._collider].isValid)
|
||||
{
|
||||
_targetAction.OnInvalidate.Invoke(gameObject);
|
||||
}
|
||||
|
||||
_targetAction = action;
|
||||
}
|
||||
else if (_targetAction == null)
|
||||
{
|
||||
_targetAction = action;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (actions[action._collider].isValid)
|
||||
{
|
||||
action.OnInvalidate.Invoke(gameObject);
|
||||
}
|
||||
|
||||
OnExitTriggerAction.Invoke(triggerAction);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_targetAction)
|
||||
{
|
||||
_targetAction = action;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (actions[action._collider].isValid)
|
||||
{
|
||||
action.OnInvalidate.Invoke(gameObject);
|
||||
}
|
||||
OnExitTriggerAction.Invoke(triggerAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
actions.Remove(key);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return _targetAction;
|
||||
}
|
||||
|
||||
protected virtual bool IsInForward(Transform target, float angleToCompare)
|
||||
{
|
||||
var angle = Vector3.Angle(transform.forward, target.forward);
|
||||
return angle <= angleToCompare;
|
||||
}
|
||||
|
||||
protected virtual void AnimationBehaviour()
|
||||
{
|
||||
if (animationBehaviourDelay > 0 && !playingAnimation)
|
||||
{
|
||||
animationBehaviourDelay -= Time.deltaTime; return;
|
||||
}
|
||||
|
||||
if (playingAnimation)
|
||||
{
|
||||
if (triggerAction.matchTarget != null)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b><color=blue>Match Target...</color> ");
|
||||
}
|
||||
|
||||
EvaluateToTargetPosition();
|
||||
}
|
||||
|
||||
if (triggerAction.useTriggerRotation)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b><color=blue>Rotate to Target...</color> ");
|
||||
}
|
||||
|
||||
EvaluateToTargetRotation();
|
||||
}
|
||||
|
||||
if (actionStarted && !triggerAction.endActionManualy && (triggerAction.inputType != vTriggerGenericAction.InputType.GetButtonTimer || !triggerAction.playAnimationWhileHoldingButton) && tpInput.cc.animatorStateInfos.GetCurrentNormalizedTime(triggerAction.animatorLayer) >= triggerAction.endExitTimeAnimation)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>Finish Animation ");
|
||||
}
|
||||
// triggers the OnEndAnimation Event
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
else if (doingAction && actionStarted && (triggerAction == null || !triggerAction.endActionManualy))
|
||||
{
|
||||
//when using a GetButtonTimer the ResetTriggerSettings will be automatically called at the end of the timer or by releasing the input
|
||||
if (triggerAction != null && (triggerAction.inputType == vTriggerGenericAction.InputType.GetButtonTimer && triggerAction.playAnimationWhileHoldingButton))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>Force ResetTriggerSettings ");
|
||||
}
|
||||
// triggers the OnEndAnimation Event
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void EvaluateToTargetPosition()
|
||||
{
|
||||
var matchTargetPosition = triggerAction.matchTarget.position;
|
||||
switch (triggerAction.avatarTarget)
|
||||
{
|
||||
case AvatarTarget.LeftHand:
|
||||
matchTargetPosition = (triggerAction.matchTarget.position - transform.rotation * transform.InverseTransformPoint(tpInput.animator.GetBoneTransform(HumanBodyBones.LeftHand).position));
|
||||
break;
|
||||
case AvatarTarget.RightHand:
|
||||
matchTargetPosition = (triggerAction.matchTarget.position - transform.rotation * transform.InverseTransformPoint(tpInput.animator.GetBoneTransform(HumanBodyBones.RightHand).position));
|
||||
break;
|
||||
case AvatarTarget.LeftFoot:
|
||||
matchTargetPosition = (triggerAction.matchTarget.position - transform.rotation * transform.InverseTransformPoint(tpInput.animator.GetBoneTransform(HumanBodyBones.LeftFoot).position));
|
||||
break;
|
||||
case AvatarTarget.RightFoot:
|
||||
matchTargetPosition = (triggerAction.matchTarget.position - transform.rotation * transform.InverseTransformPoint(tpInput.animator.GetBoneTransform(HumanBodyBones.RightFoot).position));
|
||||
break;
|
||||
}
|
||||
AnimationCurve XZ = triggerAction.matchPositionXZCurve;
|
||||
AnimationCurve Y = triggerAction.matchPositionYCurve;
|
||||
float normalizedTime = Mathf.Clamp(tpInput.cc.animatorStateInfos.GetCurrentNormalizedTime(triggerAction.animatorLayer), 0, 1);
|
||||
|
||||
var localRelativeToTarget = triggerAction.matchTarget.InverseTransformPoint(matchTargetPosition);
|
||||
if (!triggerAction.useLocalX)
|
||||
{
|
||||
localRelativeToTarget.x = triggerAction.matchTarget.InverseTransformPoint(transform.position).x;
|
||||
}
|
||||
|
||||
if (!triggerAction.useLocalZ)
|
||||
{
|
||||
localRelativeToTarget.z = triggerAction.matchTarget.InverseTransformPoint(transform.position).z;
|
||||
}
|
||||
|
||||
matchTargetPosition = triggerAction.matchTarget.TransformPoint(localRelativeToTarget);
|
||||
|
||||
Vector3 rootPosition = tpInput.cc.animator.rootPosition;
|
||||
|
||||
float evaluatedXZ = XZ.Evaluate(normalizedTime);
|
||||
float evaluatedY = Y.Evaluate(normalizedTime);
|
||||
|
||||
if (evaluatedXZ < 1f)
|
||||
{
|
||||
rootPosition.x = Mathf.Lerp(rootPosition.x, matchTargetPosition.x, evaluatedXZ);
|
||||
rootPosition.z = Mathf.Lerp(rootPosition.z, matchTargetPosition.z, evaluatedXZ);
|
||||
finishPositionXZMatch = true;
|
||||
}
|
||||
else if (finishPositionXZMatch)
|
||||
{
|
||||
finishPositionXZMatch = false;
|
||||
rootPosition.x = matchTargetPosition.x;
|
||||
rootPosition.z = matchTargetPosition.z;
|
||||
}
|
||||
if (evaluatedY < 1f)
|
||||
{
|
||||
rootPosition.y = Mathf.Lerp(rootPosition.y, matchTargetPosition.y, evaluatedY);
|
||||
finishPositionYMatch = true;
|
||||
}
|
||||
else if (finishPositionYMatch)
|
||||
{
|
||||
finishPositionYMatch = false;
|
||||
rootPosition.y = matchTargetPosition.y;
|
||||
}
|
||||
|
||||
transform.position = rootPosition;
|
||||
}
|
||||
|
||||
protected virtual void EvaluateToTargetRotation()
|
||||
{
|
||||
var targetEuler = new Vector3(transform.eulerAngles.x, triggerAction.transform.eulerAngles.y, transform.eulerAngles.z);
|
||||
Quaternion targetRotation = Quaternion.Euler(targetEuler);
|
||||
Quaternion rootRotation = tpInput.cc.animator.rootRotation;
|
||||
AnimationCurve rotationCurve = triggerAction.matchRotationCurve;
|
||||
float normalizedTime = tpInput.cc.animatorStateInfos.GetCurrentNormalizedTime(triggerAction.animatorLayer);
|
||||
float evaluatedCurve = rotationCurve.Evaluate(normalizedTime);
|
||||
if (evaluatedCurve < 1)
|
||||
{
|
||||
rootRotation = Quaternion.Lerp(rootRotation, targetRotation, evaluatedCurve);
|
||||
finishRotationMatch = true;
|
||||
}
|
||||
else if (finishRotationMatch)
|
||||
{
|
||||
finishRotationMatch = false;
|
||||
rootRotation = targetRotation;
|
||||
}
|
||||
transform.rotation = rootRotation;
|
||||
}
|
||||
|
||||
protected virtual void EndAction()
|
||||
{
|
||||
OnEndAction.Invoke(triggerAction);
|
||||
|
||||
var trigger = triggerAction;
|
||||
// triggers the OnEndAnimation Event
|
||||
trigger.OnEndAnimation.Invoke();
|
||||
// Exit the trigger
|
||||
OnExitTriggerAction.Invoke(triggerAction);
|
||||
// reset GenericAction variables so you can use it again
|
||||
ResetTriggerSettings();
|
||||
|
||||
// Destroy trigger after reset all settings
|
||||
if (trigger.destroyAfter)
|
||||
{
|
||||
StartCoroutine(DestroyActionDelay(trigger));
|
||||
}
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>End Action ");
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool playingAnimation
|
||||
{
|
||||
get
|
||||
{
|
||||
if (triggerAction == null || !doingAction)
|
||||
{
|
||||
return _playingAnimation = false;
|
||||
}
|
||||
|
||||
if (!_playingAnimation && inActionAnimation)
|
||||
{
|
||||
_playingAnimation = true;
|
||||
triggerAction.OnStartAnimation.Invoke();
|
||||
DisablePlayerGravityAndCollision();
|
||||
}
|
||||
else if (_playingAnimation && !inActionAnimation)
|
||||
{
|
||||
_playingAnimation = false;
|
||||
}
|
||||
return _playingAnimation;
|
||||
}
|
||||
protected set
|
||||
{
|
||||
_playingAnimation = true;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool actionConditions
|
||||
{
|
||||
get
|
||||
{
|
||||
return (!doingAction && !playingAnimation && !tpInput.cc.isJumping && !tpInput.cc.customAction /*&& !tpInput.cc.animator.IsInTransition(triggerAction.animatorLayer)*/);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnActionEnter(Collider other)
|
||||
{
|
||||
if (isLockTriggerEvents)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (other != null && other.gameObject.CompareTag(actionTag))
|
||||
{
|
||||
if (!actions.ContainsKey(other))
|
||||
{
|
||||
vTriggerGenericAction[] _triggerActions = other.GetComponents<vTriggerGenericAction>();
|
||||
for (int i = 0; i < _triggerActions.Length; i++)
|
||||
{
|
||||
var _triggerAction = _triggerActions[i];
|
||||
if (_triggerAction && _triggerAction.enabled)
|
||||
{
|
||||
actions.Add(other, _triggerAction);
|
||||
_triggerAction.OnPlayerEnter.Invoke(gameObject);
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("<color=green>Enter in Trigger </color>" + other.gameObject, other.gameObject);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnActionExit(Collider other)
|
||||
{
|
||||
if (isLockTriggerEvents)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (other.gameObject.CompareTag(actionTag) && actions.ContainsKey(other) && (!doingAction || other != triggerAction._collider))
|
||||
{
|
||||
vTriggerGenericAction action = actions[other];
|
||||
actions.Remove(other);
|
||||
action.OnPlayerExit.Invoke(gameObject);
|
||||
action.OnInvalidate.Invoke(gameObject);
|
||||
OnExitTriggerAction.Invoke(action);
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("<color=red>Exit of Trigger </color> " + other.gameObject, other.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnActionStay(Collider other)
|
||||
{
|
||||
if (isLockTriggerEvents)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (other != null && actions.ContainsKey(other))
|
||||
{
|
||||
|
||||
actions[other].action.OnPlayerStay.Invoke(gameObject);
|
||||
timeInTrigger = .5f;
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("<color=yellow>Stay in Trigger </color>" + other.gameObject, other.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// End Action Manualy if <see cref="vTriggerGenericAction.endActionManualy"/> equals true
|
||||
/// </summary>
|
||||
public virtual void FinishAction()
|
||||
{
|
||||
if (triggerAction && actionStarted && triggerAction.endActionManualy)
|
||||
{
|
||||
EndAction();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void CancelAction()
|
||||
{
|
||||
if (triggerAction && actionStarted)
|
||||
{
|
||||
var trigger = triggerAction;
|
||||
// triggers the OnEndAnimation Event
|
||||
trigger.OnCancelAction.Invoke();
|
||||
// Exit the trigger
|
||||
OnExitTriggerAction.Invoke(triggerAction);
|
||||
// reset GenericAction variables so you can use it again
|
||||
ResetTriggerSettings();
|
||||
// Destroy trigger after reset all settings
|
||||
if (trigger.destroyAfter)
|
||||
{
|
||||
StartCoroutine(DestroyActionDelay(trigger));
|
||||
}
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>Cancel Action ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void TriggerActionInput()
|
||||
{
|
||||
if (triggerAction == null || !triggerAction.gameObject.activeInHierarchy || (triggerAction.CanDoAction == false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// AutoAction
|
||||
if (triggerAction.inputType == vTriggerGenericAction.InputType.AutoAction && actionConditions)
|
||||
{
|
||||
TriggerActionEvents();
|
||||
TriggerAnimation();
|
||||
}
|
||||
// GetButtonDown
|
||||
else if (triggerAction.inputType == vTriggerGenericAction.InputType.GetButtonDown && actionConditions)
|
||||
{
|
||||
if (triggerAction.actionInput.GetButtonDown())
|
||||
{
|
||||
TriggerActionEvents();
|
||||
TriggerAnimation();
|
||||
}
|
||||
}
|
||||
// GetDoubleButton
|
||||
else if (triggerAction.inputType == vTriggerGenericAction.InputType.GetDoubleButton && actionConditions)
|
||||
{
|
||||
if (triggerAction.actionInput.GetDoubleButtonDown(triggerAction.doubleButtomTime))
|
||||
{
|
||||
TriggerActionEvents();
|
||||
TriggerAnimation();
|
||||
}
|
||||
}
|
||||
// GetButtonTimer (Hold Button)
|
||||
else if (triggerAction.inputType == vTriggerGenericAction.InputType.GetButtonTimer)
|
||||
{
|
||||
if (_currentInputDelay <= 0)
|
||||
{
|
||||
var up = false;
|
||||
var t = 0f;
|
||||
|
||||
// this mode will play the animation while you're holding the button
|
||||
if (triggerAction.playAnimationWhileHoldingButton)
|
||||
{
|
||||
TriggerActionEventsInput();
|
||||
|
||||
// call the OnFinishActionInput after the buttomTimer is concluded and reset player settings
|
||||
if (triggerAction.actionInput.GetButtonTimer(ref t, ref up, triggerAction.buttonTimer))
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>Finish Action Input ");
|
||||
}
|
||||
|
||||
triggerAction.UpdateButtonTimer(0);
|
||||
triggerAction.OnFinishActionInput.Invoke();
|
||||
|
||||
ResetActionState();
|
||||
EndAction();
|
||||
//ResetTriggerSettings();
|
||||
}
|
||||
|
||||
// trigger the Animation and the ActionEvents while your hold the button
|
||||
if (triggerAction && triggerAction.actionInput.inButtomTimer)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b><color=blue>Holding Input</color> ");
|
||||
}
|
||||
|
||||
triggerAction.UpdateButtonTimer(t);
|
||||
TriggerAnimation();
|
||||
}
|
||||
|
||||
// call OnCancelActionInput if the button is released before ending the buttonTimer
|
||||
if (up && triggerAction)
|
||||
{
|
||||
CancelButtonTimer();
|
||||
}
|
||||
}
|
||||
// this mode will play the animation after you finish holding the button
|
||||
else /*if (!doingAction)*/
|
||||
{
|
||||
TriggerActionEventsInput();
|
||||
|
||||
// call the OnFinishActionInput after the buttomTimer is concluded and reset player settings
|
||||
if (triggerAction.actionInput.GetButtonTimer(ref t, ref up, triggerAction.buttonTimer))
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>Finish Action Input ");
|
||||
}
|
||||
|
||||
triggerAction.UpdateButtonTimer(0);
|
||||
triggerAction.OnFinishActionInput.Invoke();
|
||||
// destroy the triggerAction if checked with destroyAfter
|
||||
TriggerAnimation();
|
||||
}
|
||||
|
||||
// trigger the ActionEvents while your hold the button
|
||||
if (triggerAction && triggerAction.actionInput.inButtomTimer)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b><color=blue>Holding Input</color>");
|
||||
}
|
||||
|
||||
triggerAction.UpdateButtonTimer(t);
|
||||
}
|
||||
|
||||
// call OnCancelActionInput if the button is released before ending the buttonTimer
|
||||
if (up && triggerAction)
|
||||
{
|
||||
CancelButtonTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentInputDelay -= Time.deltaTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void CancelButtonTimer()
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>Cancel Action ");
|
||||
}
|
||||
|
||||
triggerAction.OnCancelActionInput.Invoke();
|
||||
_currentInputDelay = triggerAction.inputDelay;
|
||||
triggerAction.UpdateButtonTimer(0);
|
||||
OnCancelAction.Invoke(triggerAction);
|
||||
ResetActionState();
|
||||
ResetTriggerSettings(false);
|
||||
}
|
||||
|
||||
protected virtual void TriggerActionEventsInput()
|
||||
{
|
||||
// trigger the ActionEvents while your hold the button
|
||||
if (triggerAction && triggerAction.actionInput.GetButtonDown())
|
||||
{
|
||||
TriggerActionEvents();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void TriggerActionEvents()
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>TriggerAction Events ", gameObject);
|
||||
}
|
||||
|
||||
doingAction = true;
|
||||
// Call OnStartAction from the Controller's GenericAction inspector
|
||||
OnStartAction.Invoke(triggerAction);
|
||||
|
||||
// Call OnDoAction from the Controller's GenericAction
|
||||
OnDoAction.Invoke(triggerAction);
|
||||
|
||||
// trigger OnDoAction Event, you can add a delay in the inspector
|
||||
StartCoroutine(triggerAction.OnPressActionDelay(gameObject));
|
||||
}
|
||||
|
||||
public virtual void TriggerAnimation()
|
||||
{
|
||||
if (playingAnimation || actionStarted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>TriggerAnimation ", gameObject);
|
||||
}
|
||||
|
||||
if (triggerAction.animatorActionState != 0)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>Applied ActionState: " + triggerAction.animatorActionState + " ", gameObject);
|
||||
}
|
||||
|
||||
tpInput.cc.SetActionState(triggerAction.animatorActionState);
|
||||
}
|
||||
|
||||
// trigger the animation behaviour & match target
|
||||
if (!string.IsNullOrEmpty(triggerAction.playAnimation))
|
||||
{
|
||||
if (!actionStarted)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>PlayAnimation: " + triggerAction.playAnimation + " ", gameObject);
|
||||
}
|
||||
|
||||
actionStarted = true;
|
||||
playingAnimation = true;
|
||||
tpInput.cc.animator.CrossFadeInFixedTime(triggerAction.playAnimation, triggerAction.crossFadeTransition, triggerAction.animatorLayer); // trigger the action animation clip
|
||||
if (!string.IsNullOrEmpty(triggerAction.customCameraState))
|
||||
{
|
||||
tpInput.ChangeCameraState(triggerAction.customCameraState, true); // change current camera state to a custom
|
||||
}
|
||||
}
|
||||
animationBehaviourDelay = triggerAction.crossFadeTransition + 0.1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
actionStarted = true;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ResetActionState()
|
||||
{
|
||||
if (triggerAction && triggerAction.resetAnimatorActionState)
|
||||
{
|
||||
tpInput.cc.SetActionState(0);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ResetTriggerSettings(bool removeTrigger = true)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>Reset Trigger Settings ");
|
||||
}
|
||||
|
||||
// reset player gravity and collision
|
||||
EnablePlayerGravityAndCollision();
|
||||
// reset the Animator parameter ActionState back to 0
|
||||
ResetActionState();
|
||||
// reset the CameraState to the Default state
|
||||
if (triggerAction != null && !string.IsNullOrEmpty(triggerAction.customCameraState))
|
||||
{
|
||||
tpInput.ResetCameraState();
|
||||
}
|
||||
// remove the collider from the actions list
|
||||
if (triggerAction != null && actions.ContainsKey(triggerAction._collider) && removeTrigger)
|
||||
{
|
||||
actions.Remove(triggerAction._collider);
|
||||
}
|
||||
triggerAction = null;
|
||||
doingAction = false;
|
||||
actionStarted = false;
|
||||
}
|
||||
|
||||
public virtual void DisablePlayerGravityAndCollision()
|
||||
{
|
||||
if (triggerAction && triggerAction.disableGravity)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b><color=red>Disable Player's Gravity</color> ");
|
||||
}
|
||||
|
||||
tpInput.cc._rigidbody.useGravity = false;
|
||||
if (!tpInput.cc._rigidbody.isKinematic)
|
||||
tpInput.cc._rigidbody.linearVelocity = Vector3.zero;
|
||||
tpInput.cc._rigidbody.isKinematic = true;
|
||||
}
|
||||
if (triggerAction && triggerAction.disableCollision)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b><color=red>Disable Player's Collision</color> ");
|
||||
}
|
||||
|
||||
tpInput.cc._capsuleCollider.isTrigger = true;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void EnablePlayerGravityAndCollision()
|
||||
{
|
||||
if (triggerAction && triggerAction.disableGravity)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b><color=red>Enable Player's Gravity</color> ");
|
||||
}
|
||||
|
||||
tpInput.cc._rigidbody.useGravity = true;
|
||||
tpInput.cc._rigidbody.isKinematic = false;
|
||||
}
|
||||
if (triggerAction && triggerAction.disableCollision)
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b><color=red>Enable Player's Collision</color> ");
|
||||
}
|
||||
|
||||
tpInput.cc._capsuleCollider.isTrigger = false;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual IEnumerator DestroyActionDelay(vTriggerGenericAction triggerAction)
|
||||
{
|
||||
var _triggerAction = triggerAction;
|
||||
yield return new WaitForSeconds(_triggerAction.destroyDelay);
|
||||
if (_triggerAction != null && _triggerAction.gameObject != null)
|
||||
{
|
||||
OnExitTriggerAction.Invoke(triggerAction);
|
||||
Destroy(_triggerAction.gameObject);
|
||||
}
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log($"<b>GenericAction: </b>Destroy Trigger ");
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void SetLockTriggerEvents(bool value)
|
||||
{
|
||||
foreach (var key in actions.Keys)
|
||||
{
|
||||
if (key)
|
||||
{
|
||||
actions[key].action.OnPlayerExit.Invoke(gameObject);
|
||||
actions[key].action.OnInvalidate.Invoke(gameObject);
|
||||
}
|
||||
}
|
||||
actions.Clear();
|
||||
isLockTriggerEvents = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1660eeab87ecf543be4a3ca42e6e836
|
||||
timeCreated: 1493315378
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,106 @@
|
||||
using System.Collections.Generic;
|
||||
namespace Invector.vCharacterController.vActions
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic Action receiver for <seealso cref="vGenericAction"/> events.
|
||||
/// Use this component inside character with <see cref="vGenericAction"/> component.
|
||||
/// This is usefull for trigger events based in the <seealso cref="vTriggerGenericAction.actionName"/>.
|
||||
/// </summary>
|
||||
[vClassHeader("Action Receiver")]
|
||||
public class vGenericActionReceiver : vMonoBehaviour
|
||||
{
|
||||
public List<string> supportedActionNames = new List<string>() { "Action" };
|
||||
public UnityEngine.Events.UnityEvent onEnterTriggerAction;
|
||||
public UnityEngine.Events.UnityEvent onExitTriggerAction;
|
||||
public UnityEngine.Events.UnityEvent onStartAction;
|
||||
public UnityEngine.Events.UnityEvent onCancelAction;
|
||||
public UnityEngine.Events.UnityEvent onEndAction;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
vGenericAction genericAction = gameObject.GetComponentInParent<vGenericAction>();
|
||||
if (genericAction)
|
||||
{
|
||||
genericAction.OnEnterTriggerAction.AddListener(OnEnterTriggerAction);
|
||||
genericAction.OnExitTriggerAction.AddListener(OnExitTriggerAction);
|
||||
genericAction.OnStartAction.AddListener(OnStartAction);
|
||||
genericAction.OnCancelAction.AddListener(OnCancelAction);
|
||||
genericAction.OnEndAction.AddListener(OnEndAction);
|
||||
}
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
vGenericAction genericAction = GetComponentInParent<vGenericAction>();
|
||||
if (genericAction)
|
||||
{
|
||||
genericAction.OnEnterTriggerAction.RemoveListener(OnEnterTriggerAction);
|
||||
genericAction.OnExitTriggerAction.RemoveListener(OnExitTriggerAction);
|
||||
genericAction.OnStartAction.RemoveListener(OnStartAction);
|
||||
genericAction.OnCancelAction.RemoveListener(OnCancelAction);
|
||||
genericAction.OnEndAction.RemoveListener(OnEndAction);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual bool IsValidAction(vTriggerGenericAction actionInfo)
|
||||
{
|
||||
bool isValid = this.enabled && this.gameObject.activeInHierarchy && actionInfo != null && supportedActionNames.Contains(actionInfo.actionName);
|
||||
return isValid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event called when Enter in trigger
|
||||
/// </summary>
|
||||
/// <param name="actionInfo"></param>
|
||||
public virtual void OnEnterTriggerAction(vTriggerGenericAction actionInfo)
|
||||
{
|
||||
if (IsValidAction(actionInfo))
|
||||
{
|
||||
onEnterTriggerAction.Invoke();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Event Called when exit Trigger
|
||||
/// </summary>
|
||||
/// <param name="actionInfo"></param>
|
||||
public virtual void OnExitTriggerAction(vTriggerGenericAction actionInfo)
|
||||
{
|
||||
if (IsValidAction(actionInfo))
|
||||
{
|
||||
onExitTriggerAction.Invoke();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Event called when action is started
|
||||
/// </summary>
|
||||
/// <param name="actionInfo"></param>
|
||||
public virtual void OnStartAction(vTriggerGenericAction actionInfo)
|
||||
{
|
||||
if (IsValidAction(actionInfo))
|
||||
{
|
||||
onStartAction.Invoke();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Event called when action is canceled
|
||||
/// </summary>
|
||||
/// <param name="actionInfo"></param>
|
||||
public virtual void OnCancelAction(vTriggerGenericAction actionInfo)
|
||||
{
|
||||
if (IsValidAction(actionInfo))
|
||||
{
|
||||
onCancelAction.Invoke();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Event called when action is finished or canceled
|
||||
/// </summary>
|
||||
/// <param name="actionInfo"></param>
|
||||
public virtual void OnEndAction(vTriggerGenericAction actionInfo)
|
||||
{
|
||||
if (IsValidAction(actionInfo))
|
||||
{
|
||||
onEndAction.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4dc232b8e1716b046831c15cc4cda895
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,76 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Invector.vCharacterController.vActions
|
||||
{
|
||||
[vClassHeader("Generic Animation", "Use this script to trigger a simple animation.")]
|
||||
public class vGenericAnimation : vMonoBehaviour
|
||||
{
|
||||
#region Variables
|
||||
|
||||
[Tooltip("Input to trigger the custom animation")]
|
||||
public GenericInput actionInput = new GenericInput("L", "A", "A");
|
||||
[Tooltip("Name of the animation clip")]
|
||||
public string animationClip;
|
||||
[Tooltip("Where in the end of the animation will trigger the event OnEndAnimation")]
|
||||
public float animationEnd = 0.8f;
|
||||
|
||||
public UnityEvent OnPlayAnimation;
|
||||
public UnityEvent OnEndAnimation;
|
||||
|
||||
protected bool isPlaying;
|
||||
protected bool triggerOnce;
|
||||
protected vThirdPersonInput tpInput;
|
||||
|
||||
#endregion
|
||||
|
||||
protected virtual void Start()
|
||||
{
|
||||
tpInput = GetComponent<vThirdPersonInput>();
|
||||
}
|
||||
|
||||
protected virtual void LateUpdate()
|
||||
{
|
||||
TriggerAnimation();
|
||||
AnimationBehaviour();
|
||||
}
|
||||
|
||||
protected virtual void TriggerAnimation()
|
||||
{
|
||||
// condition to trigger the animation
|
||||
bool playConditions = !isPlaying && !tpInput.cc.customAction && !string.IsNullOrEmpty(animationClip);
|
||||
|
||||
if (actionInput.GetButtonDown() && playConditions)
|
||||
PlayAnimation();
|
||||
}
|
||||
|
||||
public virtual void PlayAnimation()
|
||||
{
|
||||
// we use a bool to trigger the event just once at the end of the animation
|
||||
triggerOnce = true;
|
||||
// trigger the OnPlay Event
|
||||
OnPlayAnimation.Invoke();
|
||||
// trigger the animationClip
|
||||
tpInput.cc.animator.CrossFadeInFixedTime(animationClip, 0.1f);
|
||||
}
|
||||
|
||||
protected virtual void AnimationBehaviour()
|
||||
{
|
||||
// know if the animation is playing or not
|
||||
isPlaying = tpInput.cc.baseLayerInfo.IsName(animationClip);
|
||||
|
||||
if (isPlaying)
|
||||
{
|
||||
// detected the end of the animation clip to trigger the OnEndAnimation Event
|
||||
if (tpInput.cc.animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= animationEnd)
|
||||
{
|
||||
if (triggerOnce)
|
||||
{
|
||||
triggerOnce = false; // reset the bool so we can call the event again
|
||||
OnEndAnimation.Invoke(); // call the OnEnd Event at the end of the animation
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab01fc92c35bcd64681457359b1685c0
|
||||
timeCreated: 1495501541
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,614 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
namespace Invector.vCharacterController.vActions
|
||||
{
|
||||
[vClassHeader("Ladder Action", iconName = "ladderIcon")]
|
||||
public class vLadderAction : vActionListener
|
||||
{
|
||||
#region public variables
|
||||
|
||||
[vEditorToolbar("Settings", overrideChildOrder: true, order = 0)]
|
||||
[Tooltip("Tag of the object you want to access")]
|
||||
public string actionTag = "LadderTrigger";
|
||||
[Tooltip("Speed multiplier for the climb ladder animations")]
|
||||
public float climbSpeed = 1.5f;
|
||||
[Tooltip("Speed multiplier for the climb ladder animations when the fastClimbInput is pressed")]
|
||||
public float fastClimbSpeed = 3f;
|
||||
[Tooltip("How much Stamina will be consumed when climbing faster")]
|
||||
public float fastClimbStamina = 30f;
|
||||
[Tooltip("Input to use the ladder going up or down")]
|
||||
public GenericInput verticalInput = new GenericInput("Vertical", "LeftAnalogVertical", "Vertical");
|
||||
[Tooltip("Input to enter the ladder")]
|
||||
public GenericInput enterInput = new GenericInput("E", "A", "A");
|
||||
[Tooltip("Input to exit the ladder")]
|
||||
public GenericInput exitInput = new GenericInput("Space", "B", "B");
|
||||
[Tooltip("Input to climb faster")]
|
||||
public GenericInput fastClimbInput = new GenericInput("LeftShift", "LeftStickClick", "LeftStickClick");
|
||||
[Tooltip("Input to climb faster")]
|
||||
public GenericInput slideDownInput = new GenericInput("Q", "X", "X");
|
||||
|
||||
|
||||
[vEditorToolbar("Events")]
|
||||
public UnityEvent OnEnterLadder;
|
||||
public UnityEvent OnExitLadder;
|
||||
public UnityEvent OnEnterTriggerLadder;
|
||||
public UnityEvent OnExitTriggerLadder;
|
||||
|
||||
|
||||
[vEditorToolbar("Debug")]
|
||||
public bool debugMode;
|
||||
[vReadOnly(false)]
|
||||
[SerializeField]
|
||||
protected vTriggerLadderAction targetLadderAction;
|
||||
[vReadOnly(false)]
|
||||
[SerializeField]
|
||||
protected vTriggerLadderAction currentLadderAction;
|
||||
//[vReadOnly(false)]
|
||||
//[SerializeField]
|
||||
protected List<vTriggerLadderAction> actionTriggers = new List<vTriggerLadderAction>();
|
||||
[vReadOnly(false)]
|
||||
[SerializeField]
|
||||
protected float _speed;
|
||||
protected virtual float speed { get { return _speed; } set { _speed = value; } }
|
||||
[vReadOnly(false)]
|
||||
[SerializeField]
|
||||
protected float currentClimbSpeed;
|
||||
[vReadOnly(false)]
|
||||
[SerializeField]
|
||||
protected bool _isUsingLadder;
|
||||
public virtual bool isUsingLadder { get { return _isUsingLadder; } set { _isUsingLadder = value; } }
|
||||
[vReadOnly(false)]
|
||||
[SerializeField]
|
||||
protected bool enterLadderStarted;
|
||||
[vReadOnly(false)]
|
||||
[SerializeField]
|
||||
protected bool inEnterLadderAnimation;
|
||||
[vReadOnly(false)]
|
||||
[SerializeField]
|
||||
protected bool inExitingLadderAnimation;
|
||||
[vReadOnly(false)]
|
||||
[SerializeField]
|
||||
protected bool triggerEnterOnce;
|
||||
[vReadOnly(false)]
|
||||
[SerializeField]
|
||||
protected bool triggerExitOnce;
|
||||
|
||||
#endregion
|
||||
|
||||
protected vThirdPersonInput tpInput;
|
||||
protected bool isAligningMidAir;
|
||||
|
||||
protected override void SetUpListener()
|
||||
{
|
||||
actionEnter = false;
|
||||
actionStay = true;
|
||||
actionExit = true;
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
tpInput = GetComponent<vThirdPersonInput>();
|
||||
if (tpInput)
|
||||
{
|
||||
tpInput.onUpdate -= UpdateLadderBehavior;
|
||||
tpInput.onUpdate += UpdateLadderBehavior;
|
||||
|
||||
tpInput.onAnimatorMove -= UsingLadder;
|
||||
tpInput.onAnimatorMove += UsingLadder;
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void UpdateLadderBehavior()
|
||||
{
|
||||
AutoEnterLadder();
|
||||
EnterLadderInput();
|
||||
ExitLadderInput();
|
||||
}
|
||||
|
||||
protected virtual void EnterLadderInput()
|
||||
{
|
||||
if (targetLadderAction == null || tpInput.cc.customAction || tpInput.cc.isJumping || !tpInput.cc.isGrounded || tpInput.cc.isRolling)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (enterInput.GetButtonDown() && !enterLadderStarted && !isUsingLadder && !targetLadderAction.autoAction)
|
||||
{
|
||||
TriggerEnterLadder();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void ExitLadderInput()
|
||||
{
|
||||
if (!isUsingLadder)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (tpInput.cc.baseLayerInfo.IsName("EnterLadderTop") || tpInput.cc.baseLayerInfo.IsName("EnterLadderBottom"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetLadderAction == null)
|
||||
{
|
||||
if (tpInput.cc.IsAnimatorTag("ClimbLadder"))
|
||||
{
|
||||
if (slideDownInput.GetButtonDown() && !inExitingLadderAnimation)
|
||||
{
|
||||
tpInput.cc.animator.CrossFadeInFixedTime("Ladder_SlideDown", 0.2f);
|
||||
}
|
||||
|
||||
// exit ladder at any moment by pressing the cancelInput
|
||||
if (exitInput.GetButtonDown())
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("Quick Exit..." + currentLadderAction.name + "_" + currentLadderAction.transform.parent.gameObject.name);
|
||||
}
|
||||
tpInput.cc.animator.speed = 1;
|
||||
tpInput.cc.animator.CrossFadeInFixedTime("QuickExitLadder", 0.1f);
|
||||
Invoke("ResetPlayerSettings", .5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentLadderAction = targetLadderAction;
|
||||
var animationClip = targetLadderAction.exitAnimation;
|
||||
if (animationClip == "ExitLadderBottom")
|
||||
{
|
||||
// exit ladder when reach the bottom by pressing the cancelInput or pressing down at
|
||||
if (exitInput.GetButtonDown() && !triggerExitOnce || (speed <= -0.05f && !triggerExitOnce) || (tpInput.cc.IsAnimatorTag("LadderSlideDown") && targetLadderAction != null && !triggerExitOnce))
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("Exit Bottom..." + currentLadderAction.name + "_" + currentLadderAction.transform.parent.gameObject.name);
|
||||
}
|
||||
triggerExitOnce = true;
|
||||
tpInput.cc.animator.CrossFadeInFixedTime(targetLadderAction.exitAnimation, 0.1f); // trigger the animation clip
|
||||
}
|
||||
}
|
||||
else if (animationClip == "ExitLadderTop" && tpInput.cc.IsAnimatorTag("ClimbLadder")) // exit the ladder from the top
|
||||
{
|
||||
if ((speed >= 0.05f) && !triggerExitOnce && !tpInput.cc.animator.IsInTransition(0)) // trigger the exit animation by pressing up
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("Exit Top..." + currentLadderAction.name + "_" + currentLadderAction.transform.parent.gameObject.name);
|
||||
}
|
||||
triggerExitOnce = true;
|
||||
tpInput.cc.animator.CrossFadeInFixedTime(targetLadderAction.exitAnimation, 0.1f); // trigger the animation clip
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void AutoEnterLadder()
|
||||
{
|
||||
if (targetLadderAction == null || !targetLadderAction.autoAction)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (tpInput.cc.customAction || isUsingLadder || tpInput.cc.animator.IsInTransition(0) || tpInput.cc.isRolling)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// enter the ladder automatically if checked with autoAction
|
||||
if (targetLadderAction.autoAction && tpInput.cc.input != Vector3.zero && !tpInput.cc.customAction)
|
||||
{
|
||||
var inputDir = Camera.main.transform.TransformDirection(new Vector3(tpInput.cc.input.x, 0f, tpInput.cc.input.z));
|
||||
inputDir.y = 0f;
|
||||
var dist = Vector3.Distance(inputDir.normalized, targetLadderAction.transform.forward);
|
||||
if (dist < 0.8f)
|
||||
{
|
||||
TriggerEnterLadder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void TriggerMidAirEnterLadder(vTriggerLadderMiddle ladderMiddle)
|
||||
{
|
||||
if (tpInput.cc.isGrounded || isAligningMidAir) return;
|
||||
|
||||
isAligningMidAir = true;
|
||||
|
||||
Vector3 pos = ladderMiddle.refTarget.position;
|
||||
bool pointFounded = false;
|
||||
float distance = Vector3.Distance(pos, transform.position);
|
||||
int steps = (int)(ladderMiddle._collider.size.y / ladderMiddle.stepHeight);
|
||||
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
pos = ladderMiddle.refTarget.position + ladderMiddle.transform.up * ladderMiddle.stepHeight * i;
|
||||
var _distance = Vector3.Distance(pos, transform.position);
|
||||
|
||||
if (_distance <= distance)
|
||||
{
|
||||
distance = _distance;
|
||||
pointFounded = true;
|
||||
}
|
||||
else if (pointFounded)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
tpInput.cc.DisableGravityAndCollision();
|
||||
tpInput.cc.isCrouching = false;
|
||||
tpInput.cc.ControlCapsuleHeight();
|
||||
tpInput.UpdateCameraStates();
|
||||
tpInput.cc.UpdateAnimator();
|
||||
|
||||
triggerEnterOnce = true;
|
||||
enterLadderStarted = true;
|
||||
tpInput.cc.animator.SetInteger(vAnimatorParameters.ActionState, 1); // set actionState 1 to avoid falling transitions
|
||||
|
||||
tpInput.cc.StopCharacter();
|
||||
tpInput.SetLockAllInput(true);
|
||||
tpInput.cc.ResetInputAnimatorParameters();
|
||||
|
||||
var localPos = ladderMiddle.transform.InverseTransformPoint(transform.position);
|
||||
if (localPos.x >= 0f)
|
||||
tpInput.cc.animator.CrossFadeInFixedTime("IdleLadder_Left", 0.25f); // trigger the action animation clip
|
||||
else
|
||||
tpInput.cc.animator.CrossFadeInFixedTime("IdleLadder_Right", 0.25f); // trigger the action animation clip
|
||||
|
||||
tpInput.cc.disableAnimations = true;
|
||||
|
||||
StartCoroutine(AlignToMiddleLadder(pos, ladderMiddle.refTarget.rotation));
|
||||
}
|
||||
|
||||
IEnumerator AlignToMiddleLadder(Vector3 pos, Quaternion rot)
|
||||
{
|
||||
float time = 0f;
|
||||
Vector3 position = transform.position;
|
||||
Quaternion rotation = transform.rotation;
|
||||
|
||||
while (time <= 1f)
|
||||
{
|
||||
transform.position = Vector3.Lerp(position, pos, time);
|
||||
transform.rotation = Quaternion.Lerp(rotation, rot, time);
|
||||
|
||||
time += Time.fixedDeltaTime * 8f;
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
transform.position = pos;
|
||||
transform.rotation = rot;
|
||||
yield return null;
|
||||
}
|
||||
while (tpInput.cc.animator.IsInTransition(0));
|
||||
yield return new WaitForEndOfFrame();
|
||||
isUsingLadder = true;
|
||||
isAligningMidAir = false;
|
||||
}
|
||||
|
||||
protected virtual void TriggerEnterLadder()
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("Enter Ladder");
|
||||
}
|
||||
|
||||
OnExitTriggerLadder.Invoke();
|
||||
|
||||
if (targetLadderAction.targetCharacterParent)
|
||||
{
|
||||
transform.parent = targetLadderAction.targetCharacterParent;
|
||||
}
|
||||
|
||||
tpInput.cc.isCrouching = false;
|
||||
tpInput.cc.ControlCapsuleHeight();
|
||||
tpInput.UpdateCameraStates();
|
||||
tpInput.cc.UpdateAnimator();
|
||||
OnEnterLadder.Invoke();
|
||||
triggerEnterOnce = true;
|
||||
enterLadderStarted = true;
|
||||
tpInput.cc.animator.SetInteger(vAnimatorParameters.ActionState, 1); // set actionState 1 to avoid falling transitions
|
||||
tpInput.SetLockAllInput(true);
|
||||
tpInput.cc.ResetInputAnimatorParameters();
|
||||
targetLadderAction.OnDoAction.Invoke();
|
||||
currentLadderAction = targetLadderAction;
|
||||
//tpInput.cc.animator.updateMode = AnimatorUpdateMode.Normal;
|
||||
if (!string.IsNullOrEmpty(currentLadderAction.playAnimation))
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("TriggerAnimation " + currentLadderAction.name + "_" + currentLadderAction.transform.parent.gameObject.name);
|
||||
}
|
||||
|
||||
tpInput.cc.animator.CrossFadeInFixedTime(currentLadderAction.playAnimation, 0.25f); // trigger the action animation clip
|
||||
isUsingLadder = true;
|
||||
tpInput.cc.disableAnimations = true;
|
||||
tpInput.cc.StopCharacter();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void UsingLadder()
|
||||
{
|
||||
if (!isUsingLadder)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// update the base layer to know what animations are being played
|
||||
tpInput.cc.AnimatorLayerControl();
|
||||
tpInput.cc.ActionsControl();
|
||||
// update camera movement
|
||||
tpInput.CameraInput();
|
||||
|
||||
// go up or down
|
||||
speed = verticalInput.GetAxis();
|
||||
tpInput.cc.animator.SetFloat(vAnimatorParameters.InputVertical, speed, 0.1f, Time.deltaTime);
|
||||
if (speed >= 0.05f || speed <= -0.05f)
|
||||
{
|
||||
tpInput.cc.animator.speed = Mathf.Lerp(tpInput.cc.animator.speed, currentClimbSpeed, 2f * Time.deltaTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
tpInput.cc.animator.speed = Mathf.Lerp(tpInput.cc.animator.speed, 1f, 2f * Time.deltaTime);
|
||||
}
|
||||
|
||||
// increase speed by input and consume stamina
|
||||
if (fastClimbInput.GetButton() && tpInput.cc.currentStamina > 0)
|
||||
{
|
||||
currentClimbSpeed = fastClimbSpeed;
|
||||
StaminaConsumption();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentClimbSpeed = climbSpeed;
|
||||
}
|
||||
|
||||
// enter ladder behaviour
|
||||
var _inEnterLadderAnimation = tpInput.cc.baseLayerInfo.IsName("EnterLadderTop") || tpInput.cc.baseLayerInfo.IsName("EnterLadderBottom") && !tpInput.cc.animator.IsInTransition(0);
|
||||
|
||||
if (_inEnterLadderAnimation)
|
||||
{
|
||||
this.inEnterLadderAnimation = true;
|
||||
|
||||
tpInput.cc.DisableGravityAndCollision(); // disable gravity & turn collision trigger
|
||||
// disable ingame hud
|
||||
if (currentLadderAction != null)
|
||||
{
|
||||
currentLadderAction.OnPlayerExit.Invoke();
|
||||
}
|
||||
|
||||
if (currentLadderAction.useTriggerRotation)
|
||||
{
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("Rotating to target..." + currentLadderAction.name + "_" + currentLadderAction.transform.parent.gameObject.name);
|
||||
}
|
||||
EvaluateToRotation(currentLadderAction.enterRotationCurve, currentLadderAction.matchTarget.transform.rotation, tpInput.cc.baseLayerInfo.normalizedTime);
|
||||
}
|
||||
|
||||
if (currentLadderAction.matchTarget != null)
|
||||
{
|
||||
if (transform.parent != currentLadderAction.targetCharacterParent)
|
||||
{
|
||||
transform.parent = currentLadderAction.targetCharacterParent;
|
||||
}
|
||||
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("Match Target to Enter..." + currentLadderAction.name + "_" + currentLadderAction.transform.parent.gameObject.name);
|
||||
}
|
||||
|
||||
EvaluateToPosition(currentLadderAction.enterPositionXZCurve, currentLadderAction.enterPositionYCurve, currentLadderAction.matchTarget.position, tpInput.cc.baseLayerInfo.normalizedTime);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_inEnterLadderAnimation && inEnterLadderAnimation)
|
||||
{
|
||||
enterLadderStarted = false;
|
||||
inEnterLadderAnimation = false;
|
||||
}
|
||||
TriggerExitLadder();
|
||||
}
|
||||
|
||||
protected virtual void TriggerExitLadder()
|
||||
{
|
||||
// exit ladder behaviour
|
||||
inExitingLadderAnimation = tpInput.cc.baseLayerInfo.IsName("ExitLadderTop") || tpInput.cc.baseLayerInfo.IsName("ExitLadderBottom") || tpInput.cc.baseLayerInfo.IsName("QuickExitLadder");
|
||||
|
||||
if (inExitingLadderAnimation)
|
||||
{
|
||||
tpInput.cc.animator.speed = 1;
|
||||
|
||||
if (currentLadderAction.exitMatchTarget != null && !tpInput.cc.baseLayerInfo.IsName("QuickExitLadder"))
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("Match Target to exit..." + currentLadderAction.name + "_" + currentLadderAction.transform.parent.gameObject.name);
|
||||
}
|
||||
|
||||
EvaluateToPosition(currentLadderAction.exitPositionXZCurve, currentLadderAction.exitPositionYCurve, currentLadderAction.exitMatchTarget.position, tpInput.cc.baseLayerInfo.normalizedTime);
|
||||
}
|
||||
var newRot = new Vector3(0, tpInput.animator.rootRotation.eulerAngles.y, 0);
|
||||
EvaluateToRotation(currentLadderAction.exitRotationCurve, Quaternion.Euler(newRot), tpInput.cc.baseLayerInfo.normalizedTime);
|
||||
|
||||
if (tpInput.cc.baseLayerInfo.normalizedTime >= 0.8f)
|
||||
{
|
||||
// after playing the animation we reset some values
|
||||
ResetPlayerSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void EvaluateToPosition(AnimationCurve XZ, AnimationCurve Y, Vector3 targetPosition, float normalizedTime)
|
||||
{
|
||||
Vector3 rootPosition = tpInput.cc.animator.rootPosition;
|
||||
|
||||
float evaluatedXZ = XZ.Evaluate(normalizedTime);
|
||||
float evaluatedY = Y.Evaluate(normalizedTime);
|
||||
|
||||
if (evaluatedXZ < 1f)
|
||||
{
|
||||
rootPosition.x = Mathf.Lerp(rootPosition.x, targetPosition.x, evaluatedXZ);
|
||||
rootPosition.z = Mathf.Lerp(rootPosition.z, targetPosition.z, evaluatedXZ);
|
||||
}
|
||||
|
||||
if (evaluatedY < 1f)
|
||||
{
|
||||
rootPosition.y = Mathf.Lerp(rootPosition.y, targetPosition.y, evaluatedY);
|
||||
}
|
||||
|
||||
transform.position = rootPosition;
|
||||
}
|
||||
|
||||
protected virtual void EvaluateToRotation(AnimationCurve curve, Quaternion targetRotation, float normalizedTime)
|
||||
{
|
||||
Quaternion rootRotation = tpInput.cc.animator.rootRotation;
|
||||
float evaluatedCurve = curve.Evaluate(normalizedTime);
|
||||
if (evaluatedCurve < 1)
|
||||
{
|
||||
rootRotation = Quaternion.Lerp(rootRotation, targetRotation, evaluatedCurve);
|
||||
}
|
||||
transform.rotation = rootRotation;
|
||||
}
|
||||
|
||||
protected virtual void StaminaConsumption()
|
||||
{
|
||||
if (tpInput.cc.currentStamina <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tpInput.cc.ReduceStamina(fastClimbStamina, true); // call the ReduceStamina method from the player
|
||||
tpInput.cc.currentStaminaRecoveryDelay = 0.25f; // delay to start recovery stamina
|
||||
}
|
||||
|
||||
protected virtual void AddLadderTrigger(vTriggerLadderAction _ladderAction)
|
||||
{
|
||||
if (targetLadderAction != _ladderAction)
|
||||
{
|
||||
targetLadderAction = _ladderAction;
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("TriggerStay " + targetLadderAction.name + "_" + targetLadderAction.transform.parent.gameObject.name);
|
||||
}
|
||||
}
|
||||
|
||||
if (!actionTriggers.Contains(targetLadderAction))
|
||||
{
|
||||
actionTriggers.Add(targetLadderAction);
|
||||
targetLadderAction.OnPlayerEnter.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void RemoveLadderTrigger(vTriggerLadderAction _ladderAction)
|
||||
{
|
||||
if (_ladderAction == targetLadderAction)
|
||||
{
|
||||
targetLadderAction = null;
|
||||
}
|
||||
|
||||
if (actionTriggers.Contains(_ladderAction))
|
||||
{
|
||||
actionTriggers.Remove(_ladderAction);
|
||||
_ladderAction.OnPlayerExit.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void CheckForTriggerAction(Collider other)
|
||||
{
|
||||
// assign the component - it will be null when he exit the trigger area
|
||||
var _ladderAction = other.GetComponent<vTriggerLadderAction>();
|
||||
if (!_ladderAction)
|
||||
{
|
||||
AddLadderTrigger(_ladderAction);
|
||||
return;
|
||||
}
|
||||
// check the maxAngle too see if the character can do the action
|
||||
var dist = Vector3.Distance(transform.forward, _ladderAction.transform.forward);
|
||||
|
||||
if (isUsingLadder && _ladderAction != null)
|
||||
{
|
||||
if (targetLadderAction != _ladderAction)
|
||||
{
|
||||
targetLadderAction = _ladderAction;
|
||||
if (!actionTriggers.Contains(targetLadderAction))
|
||||
{
|
||||
actionTriggers.Add(targetLadderAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((_ladderAction.activeFromForward == false || dist <= 0.8f) && !isUsingLadder)
|
||||
{
|
||||
AddLadderTrigger(_ladderAction);
|
||||
OnEnterTriggerLadder.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveLadderTrigger(_ladderAction);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ResetPlayerSettings()
|
||||
{
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("Reset Player Settings");
|
||||
}
|
||||
|
||||
speed = 0f;
|
||||
targetLadderAction = null;
|
||||
isUsingLadder = false;
|
||||
OnExitLadder.Invoke();
|
||||
triggerExitOnce = false;
|
||||
triggerEnterOnce = false;
|
||||
inEnterLadderAnimation = false;
|
||||
enterLadderStarted = false;
|
||||
tpInput.cc.animator.SetInteger(vAnimatorParameters.ActionState, 0);
|
||||
tpInput.cc.EnableGravityAndCollision();
|
||||
tpInput.SetLockAllInput(false);
|
||||
tpInput.cc.StopCharacter();
|
||||
tpInput.cc.disableAnimations = false;
|
||||
//tpInput.cc.animator.updateMode = AnimatorUpdateMode.AnimatePhysics;
|
||||
if (transform.parent != null)
|
||||
{
|
||||
transform.parent = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnActionStay(Collider other)
|
||||
{
|
||||
if (other.gameObject.CompareTag(actionTag))
|
||||
{
|
||||
CheckForTriggerAction(other);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnActionExit(Collider other)
|
||||
{
|
||||
if (other.gameObject.CompareTag(actionTag))
|
||||
{
|
||||
var _ladderAction = other.GetComponent<vTriggerLadderAction>();
|
||||
if (!_ladderAction)
|
||||
{
|
||||
return;
|
||||
}
|
||||
RemoveLadderTrigger(_ladderAction);
|
||||
if (debugMode)
|
||||
{
|
||||
Debug.Log("TriggerExit " + other.name + "_" + other.transform.parent.gameObject.name);
|
||||
}
|
||||
|
||||
OnExitTriggerLadder.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d2c95dd758dfa4469068df6a1432f05
|
||||
timeCreated: 1493405773
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,26 @@
|
||||
using Invector;
|
||||
using Invector.vCharacterController.vActions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
[vClassHeader("Trigger Action Event", helpBoxText = "Use this to filter a specific TriggerAction so you can use Events with the Controller or components attached to the Controller", useHelpBox = true)]
|
||||
public class vTriggerActionEvent : vMonoBehaviour
|
||||
{
|
||||
public List<ActionEvent> actionFinders;
|
||||
|
||||
public void TriggerEvent(vTriggerGenericAction action)
|
||||
{
|
||||
var _action = actionFinders.Find(a => a.actionName.Equals(action.gameObject.name));
|
||||
|
||||
if (_action != null)
|
||||
{
|
||||
_action.onTriggerEvent.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ActionEvent
|
||||
{
|
||||
public string actionName;
|
||||
public UnityEngine.Events.UnityEvent onTriggerEvent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48a88010f5c98cd4cbe92201839efbfc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,172 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Invector.vCharacterController.vActions
|
||||
{
|
||||
[vClassHeader("Trigger Generic Action", openClose = true, iconName = "triggerIcon")]
|
||||
public class vTriggerGenericAction : vMonoBehaviour
|
||||
{
|
||||
[vEditorToolbar("Input", order = 1)]
|
||||
|
||||
public InputType inputType = InputType.GetButtonDown;
|
||||
|
||||
[Tooltip("Input to make the action")]
|
||||
public GenericInput actionInput = new GenericInput("E", "A", "A");
|
||||
|
||||
public enum InputType
|
||||
{
|
||||
GetButtonDown,
|
||||
GetDoubleButton,
|
||||
GetButtonTimer,
|
||||
AutoAction
|
||||
};
|
||||
|
||||
[vHelpBox("Time you have to hold the button *Only for GetButtonTimer*")]
|
||||
public float buttonTimer = 3f;
|
||||
[vHelpBox("Add delay to start the input count *Only for GetButtonTimer*")]
|
||||
public float inputDelay = 0.1f;
|
||||
[vHelpBox("*Only for GetButtonTimer* \n\n<b>TRUE: </b> Play the animation while you're holding the button \n" +
|
||||
"<b>FALSE: </b>Play the animation after you finish holding the button")]
|
||||
public bool playAnimationWhileHoldingButton = true;
|
||||
|
||||
[vHelpBox("Time to press the button twice *Only for GetDoubleButton*")]
|
||||
public float doubleButtomTime = 0.25f;
|
||||
|
||||
[vEditorToolbar("Trigger", order = 2)]
|
||||
[SerializeField] protected bool canDoAction = true;
|
||||
|
||||
public string actionName = "Action";
|
||||
public string actionTag = "Action";
|
||||
[vHelpBox("Disable this trigger OnStart")]
|
||||
public bool disableOnStart = false;
|
||||
[vHelpBox("Disable the Player's Capsule Collider Collision, useful for animations with closer interactions")]
|
||||
public bool disableCollision;
|
||||
[vHelpBox("Disable the Player's Rigidbody Gravity, useful for on air animations")]
|
||||
public bool disableGravity;
|
||||
[vHelpBox("It will only use the trigger if the forward of the character is close to the forward of this transform")]
|
||||
public bool activeFromForward;
|
||||
[vHelpBox("Max angle between character forward and trigger forward to active trigger"), Range(5, 180)]
|
||||
public float forwardAngle = 55;
|
||||
[vHelpBox("Rotate Character to the Forward Rotation of this Trigger")]
|
||||
public bool useTriggerRotation;
|
||||
[vHelpBox("Destroy this Trigger after pressing the Input or AutoAction or finishing the Action")]
|
||||
public bool destroyAfter = false;
|
||||
[vHideInInspector("destroyAfter")]
|
||||
public float destroyDelay = 0f;
|
||||
[vHelpBox("Change your CameraState to a Custom State while playing the animation")]
|
||||
public string customCameraState;
|
||||
|
||||
[vEditorToolbar("Animation", order = 2)]
|
||||
|
||||
[vHelpBox("Trigger a Animation - Use the exactly same name of the AnimationState you want to trigger, " +
|
||||
"don't forget to add a vAnimatorTag to your State")]
|
||||
public string playAnimation;
|
||||
|
||||
public float crossFadeTransition = 0.25f;
|
||||
|
||||
public int animatorLayer = 0;
|
||||
|
||||
[vHelpBox("Check the Exit Time of your animation (if it doesn't loop) and insert here. \n\n" +
|
||||
"For example if your Exit Time is 0.82 you need to insert 0.82" +
|
||||
"\n\nAlways check with the Debug of the GenericAction if your animation is finishing correctly, " +
|
||||
"otherwise the controller won't reset to the default physics and collision.", vHelpBoxAttribute.MessageType.Warning)]
|
||||
[Tooltip("You can use this to make a persistent action, and finish the action calling FinishAction method of the vGenericAction component in your character")]
|
||||
public bool endActionManualy = false;
|
||||
[vHideInInspector("endActionManualy", invertValue = true)]
|
||||
public float endExitTimeAnimation = 0.8f;
|
||||
[vHelpBox("Use a ActionState value to apply special conditions for your AnimatorController transitions")]
|
||||
public int animatorActionState = 0;
|
||||
[vHelpBox("Reset the ActionState parameter to 0 after playing the animation")]
|
||||
public bool resetAnimatorActionState = true;
|
||||
[vHelpBox("Use a empty transform as reference for the MatchTarget")]
|
||||
public Transform matchTarget;
|
||||
[vHelpBox("Select the bone you want to use as reference to the Match Target")]
|
||||
public AvatarTarget avatarTarget;
|
||||
[Header("Curve Match target system")]
|
||||
public bool useLocalX = false;
|
||||
public bool useLocalZ = true;
|
||||
public AnimationCurve matchPositionXZCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(.5f, 1), new Keyframe(1, 1));
|
||||
public AnimationCurve matchPositionYCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(.5f, 1), new Keyframe(1, 1));
|
||||
public AnimationCurve matchRotationCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(.5f, 1), new Keyframe(1, 1));
|
||||
|
||||
[vEditorToolbar("Events", order = 3)]
|
||||
|
||||
[Tooltip("Delay to run the OnDoAction Event")]
|
||||
[FormerlySerializedAs("onDoActionDelay")]
|
||||
public float onPressActionDelay;
|
||||
|
||||
[Header("--- INPUT EVENTS ---")]
|
||||
[FormerlySerializedAs("OnDoAction")]
|
||||
public UnityEvent OnPressActionInput;
|
||||
public OnDoActionWithTarget onPressActionInputWithTarget;
|
||||
|
||||
[Header("--- ONLY FOR GET BUTTON TIMER ---")]
|
||||
public UnityEvent OnCancelActionInput;
|
||||
public UnityEvent OnFinishActionInput;
|
||||
public OnUpdateValue OnUpdateButtonTimer;
|
||||
|
||||
[Header("--- ANIMATION EVENTS ---")]
|
||||
public UnityEvent OnStartAnimation;
|
||||
public UnityEvent OnEndAnimation;
|
||||
|
||||
[Header("--- PLAYER AND TRIGGER DETECTION ---")]
|
||||
public OnDoActionWithTarget OnPlayerEnter;
|
||||
public OnDoActionWithTarget OnPlayerStay;
|
||||
public OnDoActionWithTarget OnPlayerExit;
|
||||
|
||||
[Header("--- ACTION VALIDATION ---")]
|
||||
public OnDoActionWithTarget OnValidate;
|
||||
public OnDoActionWithTarget OnInvalidate;
|
||||
public UnityEvent OnCancelAction;
|
||||
|
||||
private float currentButtonTimer;
|
||||
internal Collider _collider;
|
||||
|
||||
public bool CanDoAction
|
||||
{
|
||||
get => canDoAction;
|
||||
set => canDoAction = value;
|
||||
}
|
||||
protected virtual void Start()
|
||||
{
|
||||
this.gameObject.tag = actionTag;
|
||||
this.gameObject.layer = LayerMask.NameToLayer("Triggers");
|
||||
_collider = GetComponent<Collider>();
|
||||
_collider.isTrigger = true;
|
||||
if (disableOnStart)
|
||||
this.enabled = false;
|
||||
}
|
||||
|
||||
public virtual IEnumerator OnPressActionDelay(GameObject obj)
|
||||
{
|
||||
yield return new WaitForSeconds(onPressActionDelay);
|
||||
OnPressActionInput.Invoke();
|
||||
if (obj)
|
||||
onPressActionInputWithTarget.Invoke(obj);
|
||||
}
|
||||
|
||||
public void UpdateButtonTimer(float value)
|
||||
{
|
||||
if (value != currentButtonTimer)
|
||||
{
|
||||
currentButtonTimer = value;
|
||||
OnUpdateButtonTimer.Invoke(value);
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class OnUpdateValue : UnityEvent<float>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class OnDoActionWithTarget : UnityEvent<GameObject>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 53a2f2cffbeaacb49b92a9a282dd4c19
|
||||
timeCreated: 1548187028
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 65f0ab239a5cfe64897f8b4b02466643, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,45 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
namespace Invector.vCharacterController.vActions
|
||||
{
|
||||
[vClassHeader("Trigger Ladder Action", false)]
|
||||
public class vTriggerLadderAction : vMonoBehaviour
|
||||
{
|
||||
[vEditorToolbar("Settings")]
|
||||
[Header("Trigger Action Options")]
|
||||
[Tooltip("Automatically execute the action without the need to press a Button")]
|
||||
public bool autoAction;
|
||||
|
||||
[Header("Enter")]
|
||||
[Tooltip("Trigger an Animation - Use the exactly same name of the AnimationState you want to trigger")]
|
||||
public string playAnimation;
|
||||
|
||||
[Header("Exit")]
|
||||
[Tooltip("Trigger an Animation - Use the exactly same name of the AnimationState you want to trigger")]
|
||||
public string exitAnimation;
|
||||
|
||||
[Tooltip("Use this to limit the trigger to active if forward of character is close to this forward")]
|
||||
public bool activeFromForward;
|
||||
[Tooltip("Rotate Character for this rotation when active")]
|
||||
public bool useTriggerRotation;
|
||||
|
||||
|
||||
[Tooltip("Target Character parent, used to movable ladders to set character child of target, keep empty if ladder is static")]
|
||||
public Transform targetCharacterParent;
|
||||
[vEditorToolbar("MatchTarget")]
|
||||
[Tooltip("Use a transform to help the character climb any height, take a look at the Example Scene ClimbUp, StepUp, JumpOver objects.")]
|
||||
public Transform matchTarget;
|
||||
[Tooltip("Use a empty gameObject as a reference for the character to exit")]
|
||||
public Transform exitMatchTarget;
|
||||
public AnimationCurve enterPositionXZCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
|
||||
public AnimationCurve enterPositionYCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
|
||||
public AnimationCurve exitPositionXZCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
|
||||
public AnimationCurve exitPositionYCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
|
||||
public AnimationCurve enterRotationCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
|
||||
public AnimationCurve exitRotationCurve = new AnimationCurve(new Keyframe(0, 0), new Keyframe(1, 1));
|
||||
public UnityEvent OnDoAction;
|
||||
public UnityEvent OnPlayerEnter;
|
||||
public UnityEvent OnPlayerStay;
|
||||
public UnityEvent OnPlayerExit;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acb414223d4e72240a4c12d2d6a14be1
|
||||
timeCreated: 1469459577
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,48 @@
|
||||
using Invector.vCharacterController.vActions;
|
||||
using UnityEngine;
|
||||
|
||||
public class vTriggerLadderMiddle : MonoBehaviour
|
||||
{
|
||||
public Transform refTarget;
|
||||
public float stepHeight = 0.5f;
|
||||
public float entryAngleFwd = 45f;
|
||||
public bool debugMode = true;
|
||||
|
||||
vLadderAction ladderAction;
|
||||
internal BoxCollider _collider;
|
||||
|
||||
void Start()
|
||||
{
|
||||
_collider = GetComponent<BoxCollider>();
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
if (!debugMode) return;
|
||||
|
||||
if (!_collider)
|
||||
_collider = GetComponent<BoxCollider>();
|
||||
else
|
||||
{
|
||||
int steps = (int)(_collider.size.y / stepHeight);
|
||||
|
||||
for (int i = 0; i < steps; i++)
|
||||
{
|
||||
Gizmos.DrawSphere(refTarget.position + refTarget.up * i * stepHeight, 0.1f);
|
||||
Gizmos.DrawLine(refTarget.position + refTarget.up * i * stepHeight, refTarget.position + refTarget.up * i * stepHeight + refTarget.forward * 0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
if (other.gameObject.CompareTag("Player"))
|
||||
{
|
||||
if (Vector3.Angle(other.transform.forward, refTarget.transform.forward) > entryAngleFwd) return;
|
||||
|
||||
ladderAction = other.GetComponent<vLadderAction>();
|
||||
if (ladderAction.isUsingLadder) return;
|
||||
ladderAction.TriggerMidAirEnterLadder(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c5bae65728a16d4cb1052b692ce6e6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user