Ladder mobile controls implemented
This commit is contained in:
parent
836bbaca8d
commit
736106f462
@ -432,6 +432,8 @@ RectTransform:
|
||||
- {fileID: 1917622122}
|
||||
- {fileID: 202149951}
|
||||
- {fileID: 497607598}
|
||||
- {fileID: 1657234021}
|
||||
- {fileID: 1796619813}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 6
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -779,13 +781,28 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Delegates:
|
||||
- eventID: 4
|
||||
- eventID: 2
|
||||
callback:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 6840056971477016069}
|
||||
m_MethodName: JumpAction
|
||||
m_Mode: 1
|
||||
m_MethodName: Jump_Mobile
|
||||
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
|
||||
- eventID: 3
|
||||
callback:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 6840056971477016069}
|
||||
m_MethodName: Jump_Mobile
|
||||
m_Mode: 6
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
@ -1309,6 +1326,7 @@ GameObject:
|
||||
- component: {fileID: 497607601}
|
||||
- component: {fileID: 497607600}
|
||||
- component: {fileID: 497607599}
|
||||
- component: {fileID: 497607602}
|
||||
m_Layer: 0
|
||||
m_Name: Eat
|
||||
m_TagString: Untagged
|
||||
@ -1415,6 +1433,34 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 497607597}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &497607602
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 497607597}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0b148fe25e99eb48b9724523833bab1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Delegates:
|
||||
- eventID: 4
|
||||
callback:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 6840056971477016069}
|
||||
m_MethodName: pickupAbility
|
||||
m_Mode: 1
|
||||
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 &498357911
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -4558,7 +4604,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 358, y: 348}
|
||||
m_AnchoredPosition: {x: 358, y: 746}
|
||||
m_SizeDelta: {x: 160, y: 33}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1541488742
|
||||
@ -5080,6 +5126,168 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1629010658}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &1657234020
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1657234021}
|
||||
- component: {fileID: 1657234025}
|
||||
- component: {fileID: 1657234024}
|
||||
- component: {fileID: 1657234023}
|
||||
- component: {fileID: 1657234022}
|
||||
m_Layer: 0
|
||||
m_Name: LadderUP
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1657234021
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1657234020}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 2.5, y: 12.5, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 32115574}
|
||||
m_RootOrder: 4
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 621, y: 1178}
|
||||
m_SizeDelta: {x: 160, y: 33}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1657234022
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1657234020}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0b148fe25e99eb48b9724523833bab1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Delegates:
|
||||
- eventID: 2
|
||||
callback:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 6840056971477016069}
|
||||
m_MethodName: changeClimbDirection
|
||||
m_Mode: 4
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 1
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
- eventID: 3
|
||||
callback:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 6840056971477016069}
|
||||
m_MethodName: changeClimbDirection
|
||||
m_Mode: 4
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: -1
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &1657234023
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1657234020}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1657234024}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &1657234024
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1657234020}
|
||||
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: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
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!222 &1657234025
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1657234020}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &1663971021
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -5398,6 +5606,168 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &1796619812
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1796619813}
|
||||
- component: {fileID: 1796619817}
|
||||
- component: {fileID: 1796619816}
|
||||
- component: {fileID: 1796619815}
|
||||
- component: {fileID: 1796619814}
|
||||
m_Layer: 0
|
||||
m_Name: LadderDOWN
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1796619813
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1796619812}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 2.5, y: 12.5, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 32115574}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 621, y: 308}
|
||||
m_SizeDelta: {x: 160, y: 33}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1796619814
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1796619812}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0b148fe25e99eb48b9724523833bab1, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Delegates:
|
||||
- eventID: 2
|
||||
callback:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 6840056971477016069}
|
||||
m_MethodName: changeClimbDirection
|
||||
m_Mode: 4
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: -1
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
- eventID: 3
|
||||
callback:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 6840056971477016069}
|
||||
m_MethodName: changeClimbDirection
|
||||
m_Mode: 4
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 1
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &1796619815
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1796619812}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 1796619816}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &1796619816
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1796619812}
|
||||
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: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
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!222 &1796619817
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1796619812}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!1 &1833704053
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -5533,7 +5903,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 868, y: 348}
|
||||
m_AnchoredPosition: {x: 868, y: 746}
|
||||
m_SizeDelta: {x: 160, y: 33}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1917622123
|
||||
@ -6278,6 +6648,21 @@ PrefabInstance:
|
||||
propertyPath: powerImage
|
||||
value:
|
||||
objectReference: {fileID: 1773067638}
|
||||
- target: {fileID: 7094923891560833916, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||
type: 3}
|
||||
propertyPath: upNdownLadder.Array.size
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7094923891560833916, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||
type: 3}
|
||||
propertyPath: upNdownLadder.Array.data[0]
|
||||
value:
|
||||
objectReference: {fileID: 1657234020}
|
||||
- target: {fileID: 7094923891560833916, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||
type: 3}
|
||||
propertyPath: upNdownLadder.Array.data[1]
|
||||
value:
|
||||
objectReference: {fileID: 1796619812}
|
||||
- target: {fileID: 7094923891560833917, guid: e4d82994b58b7304b91c915c597b71f8,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
|
@ -1,4 +1,4 @@
|
||||
#define testing
|
||||
#define testing //Remove this line to disable testing mode
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@ -22,13 +22,16 @@ public class PlayerManager : MonoBehaviour
|
||||
private Rigidbody rigidBody;
|
||||
private PowerCubeManager powerCubeManager;
|
||||
private bool interact = false;
|
||||
private float moveDirection = 0f;
|
||||
private float moveDirection = 0f; //Mobile phone equivalent of Input.GetAxis("Horizontal")
|
||||
private float climbDirection = 0f;//Mobile phone equivalent of Input.GetAxis("Vertical")
|
||||
private bool wantToJump = false; //Mobile phone equivalent of Input.GetAxis("Jump")
|
||||
|
||||
public List<int> activeAbility = new List<int>(); //without ability=0 or null, dubleJump = 1, push/pull = 2, dash = 3, ladder = 4
|
||||
public List<GameObject> PowerPrefabs = new List<GameObject>(); //dubleJump = 0, push/pull = 1, dash = 2, ladder = 3
|
||||
public List<Sprite> powerIcons = new List<Sprite>(); //dubleJump = 0, push/pull = 1, dash = 2, ladder = 3
|
||||
public Image powerImage;
|
||||
private bool dubleJump = true;
|
||||
[SerializeField]
|
||||
private GameObject pushPullObject;
|
||||
private float pushPullObjectDistance;
|
||||
public float dashPower = 40f;
|
||||
@ -49,6 +52,8 @@ public class PlayerManager : MonoBehaviour
|
||||
private Vector3 saveCameraPosition;
|
||||
private float savePower;
|
||||
|
||||
public GameObject[] upNdownLadder;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@ -78,6 +83,8 @@ public class PlayerManager : MonoBehaviour
|
||||
playerAnimator.Play("Die");
|
||||
FindObjectOfType<AudioManager>().Play("Lose");
|
||||
}
|
||||
|
||||
#if UNITY_STANDALONE || UNITY_EDITOR
|
||||
if (interact)
|
||||
{
|
||||
if (powerCubeManager != null && (
|
||||
@ -95,6 +102,22 @@ public class PlayerManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_ANDROID || UNITY_IPHONE || testing //testing is defined at line 0
|
||||
if(onLadder && upNdownLadder[0].active == false)
|
||||
{
|
||||
upNdownLadder[0].SetActive(true);
|
||||
upNdownLadder[1].SetActive(true);
|
||||
}
|
||||
else
|
||||
if(onLadder == false && upNdownLadder[0].active == true)
|
||||
{
|
||||
upNdownLadder[0].SetActive(false);
|
||||
upNdownLadder[1].SetActive(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
AbilityAction();
|
||||
DeactivePowerCube();
|
||||
if (!cannotMove) {
|
||||
@ -117,6 +140,27 @@ public class PlayerManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_ANDROID || UNITY_IPHONE || testing //testing is defined at line 0
|
||||
public void pickupAbility() //Mobile controls
|
||||
{
|
||||
if (interact)
|
||||
{
|
||||
if (powerCubeManager != null && (
|
||||
powerCubeManager.powerType == PowerCubeManager.PowerType.Artefact ||
|
||||
powerCubeManager.powerType == PowerCubeManager.PowerType.DubleJump ||
|
||||
powerCubeManager.powerType == PowerCubeManager.PowerType.PushPull ||
|
||||
powerCubeManager.powerType == PowerCubeManager.PowerType.Dash ||
|
||||
powerCubeManager.powerType == PowerCubeManager.PowerType.Ladder
|
||||
))
|
||||
{
|
||||
FindObjectOfType<AudioManager>().Play("Pickup");
|
||||
playerAnimator.SetTrigger("Eat");
|
||||
interact = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
JumpAction();
|
||||
@ -246,7 +290,7 @@ public class PlayerManager : MonoBehaviour
|
||||
void Animation()
|
||||
{
|
||||
float localSpeed = 5f;
|
||||
if (Input.GetAxis("Horizontal") > 0)
|
||||
if (Input.GetAxis("Horizontal") > 0 || moveDirection > 0)
|
||||
{
|
||||
playerAnimator.SetBool("Walk", true);
|
||||
if (pushPullObject == null) {
|
||||
@ -257,7 +301,7 @@ public class PlayerManager : MonoBehaviour
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (Input.GetAxis("Horizontal") < 0)
|
||||
else if (Input.GetAxis("Horizontal") < 0 || moveDirection < 0)
|
||||
{
|
||||
playerAnimator.SetBool("Walk", true);
|
||||
if (pushPullObject == null)
|
||||
@ -275,16 +319,22 @@ public class PlayerManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void changeMoveDirection(float input)
|
||||
|
||||
public void changeMoveDirection(float input) //Mobile phone controls
|
||||
{
|
||||
Debug.Log(input);
|
||||
//Debug.Log(input);
|
||||
moveDirection += input;
|
||||
}
|
||||
|
||||
public void changeClimbDirection(float input) //Mobile phone controls
|
||||
{
|
||||
climbDirection += input;
|
||||
}
|
||||
|
||||
void Move()
|
||||
{
|
||||
#if UNITY_EDITOR || UNITY_STANDALONE
|
||||
if (Input.GetAxis("Horizontal") != 0)
|
||||
#if (UNITY_EDITOR || UNITY_STANDALONE) && (!testing)
|
||||
if (Input.GetAxis("Horizontal") != 0 || moveDirection != 0)
|
||||
{
|
||||
if (!run) {
|
||||
FindObjectOfType<AudioManager>().Play("Walk", true);
|
||||
@ -297,11 +347,11 @@ public class PlayerManager : MonoBehaviour
|
||||
rigidBody.MovePosition(
|
||||
transform.position +
|
||||
(onLadder && activeAbility.Count > 0 && activeAbility[0] == 4 ? (transform.up * speed * Input.GetAxis("Vertical") * Time.deltaTime) : Vector3.zero) +
|
||||
(transform.right * (run ? runSpeed : speed) /** Input.GetAxis("Horizontal") */* moveDirection * Time.deltaTime)
|
||||
(transform.right * (run ? runSpeed : speed) * Input.GetAxis("Horizontal") * Time.deltaTime) //TODO: uncomment Input.GetAxis after testing
|
||||
);
|
||||
#endif
|
||||
|
||||
#if UNITY_ANDROID || UNITY_IPHONE
|
||||
#if UNITY_ANDROID || UNITY_IPHONE || testing
|
||||
if(moveDirection != 0)
|
||||
{
|
||||
if(!run)
|
||||
@ -315,14 +365,13 @@ public class PlayerManager : MonoBehaviour
|
||||
}
|
||||
rigidBody.MovePosition(
|
||||
transform.position +
|
||||
(onLadder && activeAbility.Count > 0 && activeAbility[0] == 4 ? (transform.up * speed * Input.GetAxis("Vertical") * Time.deltaTime) : Vector3.zero) +
|
||||
(onLadder && activeAbility.Count > 0 && activeAbility[0] == 4 ? (transform.up * speed * climbDirection * Time.deltaTime) : Vector3.zero) +
|
||||
(transform.right * (run ? runSpeed : speed) * moveDirection * Time.deltaTime)
|
||||
);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//Interface pro UI
|
||||
public void JumpAction()
|
||||
{
|
||||
if (!cannotMove && (!onLadder || (onLadder && (activeAbility.Count < 0 || activeAbility[0] != 4))))
|
||||
@ -331,9 +380,15 @@ public class PlayerManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void Jump_Mobile(bool b) //Mobile phone controls
|
||||
{
|
||||
wantToJump = b;
|
||||
}
|
||||
|
||||
void Jump()
|
||||
{
|
||||
if (Input.GetAxisRaw("Jump") > 0)
|
||||
#if UNITY_STANDALONE
|
||||
if (Input.GetAxisRaw("Jump") > 0 || wantToJump)
|
||||
{
|
||||
if (rigidBody.velocity.y <= 1 && (onGround || (dubleJump && activeAbility.Count > 0 && activeAbility[0] == 1)) )
|
||||
{
|
||||
@ -350,6 +405,27 @@ public class PlayerManager : MonoBehaviour
|
||||
FindObjectOfType<AudioManager>().Play("Jump");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if UNITY_ANDROID || UNITY_IPHONE
|
||||
if (wantToJump)
|
||||
{
|
||||
if (rigidBody.velocity.y <= 1 && (onGround || (dubleJump && activeAbility.Count > 0 && activeAbility[0] == 1)) )
|
||||
{
|
||||
if (!onGround)
|
||||
{
|
||||
dubleJump = false;
|
||||
}
|
||||
FindObjectOfType<AudioManager>().Play("Jump");
|
||||
pushPullObject = null;
|
||||
rigidBody.AddForce(
|
||||
(transform.up * jump * 10 * Time.deltaTime),
|
||||
ForceMode.VelocityChange
|
||||
);
|
||||
FindObjectOfType<AudioManager>().Play("Jump");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private void DropPower()
|
||||
|
Loading…
Reference in New Issue
Block a user