Changed input manager to new system, added jump timer to "fix" jump mechanic (Double jumps, no jumps, etc.)
This commit is contained in:
@@ -2714,6 +2714,8 @@ MonoBehaviour:
|
||||
rightHands:
|
||||
- {fileID: 835735158964695673, guid: a4b1fc59e8e64b4a0ab15e10bbbea832, type: 3}
|
||||
isArmed: 0
|
||||
secondsSinceJump: 0
|
||||
secondsUntilJump: 5
|
||||
--- !u!54 &136514676
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -4549,6 +4551,7 @@ MeshRenderer:
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_MaskInteraction: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &345805738
|
||||
MeshFilter:
|
||||
@@ -10922,6 +10925,7 @@ MeshRenderer:
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_MaskInteraction: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &927922406
|
||||
MeshFilter:
|
||||
@@ -11264,14 +11268,14 @@ Light:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 993077594}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 11
|
||||
serializedVersion: 12
|
||||
m_Type: 1
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Intensity: 1
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.80208
|
||||
m_CookieSize: 10
|
||||
m_CookieSize2D: {x: 10, y: 10}
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Resolution: -1
|
||||
@@ -14529,6 +14533,7 @@ MeshRenderer:
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_MaskInteraction: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &1323863533
|
||||
MeshFilter:
|
||||
@@ -16128,6 +16133,7 @@ MeshRenderer:
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_MaskInteraction: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &1438812383
|
||||
MeshFilter:
|
||||
@@ -17465,8 +17471,8 @@ RectTransform:
|
||||
- {fileID: 1209078835}
|
||||
m_Father: {fileID: 1936911267}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0.3}
|
||||
m_AnchorMin: {x: 0, y: 0.1}
|
||||
m_AnchorMax: {x: 1, y: 0.4}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
@@ -19469,6 +19475,81 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &1710224812
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1710224813}
|
||||
- component: {fileID: 1710224815}
|
||||
- component: {fileID: 1710224814}
|
||||
m_Layer: 5
|
||||
m_Name: jumpTimerFill
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1710224813
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1710224812}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1806462459}
|
||||
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!114 &1710224814
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1710224812}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, 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 &1710224815
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1710224812}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1726505615
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -20349,6 +20430,82 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1797197013}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1806462458
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1806462459}
|
||||
- component: {fileID: 1806462461}
|
||||
- component: {fileID: 1806462460}
|
||||
m_Layer: 5
|
||||
m_Name: jumpTimer
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1806462459
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1806462458}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1710224813}
|
||||
m_Father: {fileID: 1936911267}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0.1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &1806462460
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1806462458}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 0.392}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10907, 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 &1806462461
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1806462458}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &1828511572
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -22208,9 +22365,10 @@ RectTransform:
|
||||
- {fileID: 1425477498}
|
||||
- {fileID: 1952068944}
|
||||
- {fileID: 1510172560}
|
||||
- {fileID: 1806462459}
|
||||
m_Father: {fileID: 1601343528}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.8}
|
||||
m_AnchorMin: {x: 0, y: 0.775}
|
||||
m_AnchorMax: {x: 0.2, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
@@ -22363,8 +22521,8 @@ RectTransform:
|
||||
- {fileID: 171713367}
|
||||
m_Father: {fileID: 1936911267}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.4}
|
||||
m_AnchorMax: {x: 1, y: 0.7}
|
||||
m_AnchorMin: {x: 0, y: 0.45}
|
||||
m_AnchorMax: {x: 1, y: 0.75}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
|
||||
@@ -474,6 +474,12 @@ namespace Assets.Scripts
|
||||
background = GameObject.Find("secondaryBackgroundPlayer");
|
||||
text = GameObject.Find("secondaryTextPlayer");
|
||||
updateBar(foreground, background, text, player.getPlayerStat("MaxSecondary").getAmount() + equipment["MP"], player.getPlayerStat("Secondary").getAmount());
|
||||
|
||||
|
||||
foreground = GameObject.Find("jumpTimerFill");
|
||||
background = GameObject.Find("jumpTimer");
|
||||
text = null;
|
||||
updateBar(foreground, background, text, player.secondsUntilJump, (int)player.secondsSinceJump);
|
||||
}
|
||||
|
||||
public void updateBar(GameObject bar, GameObject barBackground, GameObject textField, int maxValue, int minValue)
|
||||
|
||||
@@ -29,9 +29,10 @@ namespace Assets.Scripts.Player
|
||||
bool finishedGame = false;
|
||||
PlayerObject player;
|
||||
DateTime now;
|
||||
int jumpFrameCounter;
|
||||
public bool isArmed;
|
||||
bool canJump;
|
||||
public float secondsSinceJump;
|
||||
public int secondsUntilJump = 5;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
@@ -65,8 +66,8 @@ namespace Assets.Scripts.Player
|
||||
worldGenerator = GameObject.Find("WorldGenerator").GetComponent<WorldGenerator>();
|
||||
}
|
||||
isArmed = true;
|
||||
jumpFrameCounter = 0;
|
||||
canJump = false;
|
||||
canJump = true;
|
||||
secondsSinceJump = secondsUntilJump;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
@@ -88,6 +89,18 @@ namespace Assets.Scripts.Player
|
||||
SteamWorksHandler.getStandardAchievement("DeathAchievement");
|
||||
uihandler.showDeathScreen();
|
||||
}
|
||||
if (!canJump)
|
||||
{
|
||||
secondsSinceJump += Time.deltaTime;
|
||||
if (secondsSinceJump >= secondsUntilJump)
|
||||
{
|
||||
canJump = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
secondsSinceJump = secondsUntilJump;
|
||||
}
|
||||
}
|
||||
|
||||
private void regeneratePlayer()
|
||||
@@ -167,14 +180,6 @@ namespace Assets.Scripts.Player
|
||||
|
||||
public void move(Vector3 input, bool isSprinting)
|
||||
{
|
||||
if(gameObject.GetComponent<Rigidbody>().linearVelocity.y <= 0.1f && gameObject.GetComponent<Rigidbody>().linearVelocity.y >= -0.1f){
|
||||
jumpFrameCounter++;
|
||||
}
|
||||
|
||||
if(jumpFrameCounter >= 10){
|
||||
canJump = true;
|
||||
jumpFrameCounter = 0;
|
||||
}
|
||||
if (input.y != 0)
|
||||
{
|
||||
if (canJump)
|
||||
@@ -182,6 +187,7 @@ namespace Assets.Scripts.Player
|
||||
gameObject.GetComponent<Rigidbody>().linearVelocity = new Vector3(0, 5, 0);
|
||||
audioHandler.playJump();
|
||||
canJump = false;
|
||||
secondsSinceJump = 0;
|
||||
}
|
||||
}
|
||||
Vector3 movement = new Vector3(input.x, 0, input.z);
|
||||
|
||||
Reference in New Issue
Block a user