Commit a4b0f197 authored by Eby Komenan's avatar Eby Komenan

HazardSlow changes Jump's height to 0 and Jump plays the failed jump animation...

HazardSlow changes Jump's height to 0 and Jump plays the failed jump animation when a jump is requested when the height is 0, the slowfactor is not applied multiple times for consecutive slowHazards
parent 460b6859
......@@ -256,7 +256,7 @@ AnimationClip:
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 1
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
......
......@@ -13,49 +13,49 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: walk state
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: on ground
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: on wall
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: is wall sliding
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: is dashing
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: is dead
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: jump failed
m_Type: 4
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
......@@ -277,49 +277,49 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101220815868077354
--- !u!1101 &1101255389930790196
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: jump failed
- m_ConditionMode: 2
m_ConditionEvent: on ground
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1102617517530729818}
m_DstState: {fileID: 1102141645327444176}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.031434536
m_TransitionDuration: 0.1
m_TransitionOffset: 0
m_ExitTime: 0.5833334
m_HasExitTime: 1
m_ExitTime: 0.06250006
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101255389930790196
--- !u!1101 &1101284597369093138
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: on ground
- m_ConditionMode: 1
m_ConditionEvent: jump failed
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1102141645327444176}
m_DstState: {fileID: 1102617517530729818}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.1
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.06250006
m_ExitTime: 0.013712956
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
......@@ -586,6 +586,27 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101807632871170194
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1102586274863957820}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.1
m_TransitionOffset: 0
m_ExitTime: 0.375
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101807685430122190
AnimatorStateTransition:
m_ObjectHideFlags: 1
......@@ -658,30 +679,6 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101923617733050754
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: jump failed
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1102586274863957820}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0.05775318
m_ExitTime: 0.49050638
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1101943404283242284
AnimatorStateTransition:
m_ObjectHideFlags: 3
......@@ -979,7 +976,7 @@ AnimatorState:
m_Transitions:
- {fileID: 1101744012158545528}
- {fileID: 1101951043015843990}
- {fileID: 1101220815868077354}
- {fileID: 1101284597369093138}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
......@@ -1003,7 +1000,7 @@ AnimatorState:
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 1101923617733050754}
- {fileID: 1101807632871170194}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
......
......@@ -128,7 +128,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 4045396142737594, guid: db5e8a1e71fe955478cf51c1f332836a, type: 2}
propertyPath: m_RootOrder
value: 3
value: 2
objectReference: {fileID: 0}
- target: {fileID: 114188013725194092, guid: db5e8a1e71fe955478cf51c1f332836a,
type: 2}
......@@ -523,6 +523,10 @@ Prefab:
propertyPath: m_SortingLayerID
value: 1402309851
objectReference: {fileID: 0}
- target: {fileID: 4854154196249452, guid: 06c0373dffdb8dd41acff4ae0187b9ce, type: 2}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 06c0373dffdb8dd41acff4ae0187b9ce, type: 2}
m_IsPrefabParent: 0
......@@ -710,7 +714,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 4340557329068104, guid: 294123b456fc7644cb0e5b11c0d5a750, type: 2}
propertyPath: m_RootOrder
value: 9
value: 6
objectReference: {fileID: 0}
- target: {fileID: 1139495411747536, guid: 294123b456fc7644cb0e5b11c0d5a750, type: 2}
propertyPath: m_Name
......@@ -958,7 +962,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &599106627 stripped
Transform:
......@@ -1304,7 +1308,7 @@ ParticleSystem:
m_GameObject: {fileID: 920148520}
serializedVersion: 5
lengthInSec: 0.1
speed: 1
simulationSpeed: 1
looping: 1
prewarm: 0
playOnAwake: 1
......@@ -4343,6 +4347,7 @@ GameObject:
- component: {fileID: 1118525861}
- component: {fileID: 1118525860}
- component: {fileID: 1118525859}
- component: {fileID: 1118525863}
m_Layer: 5
m_Name: UI
m_TagString: Untagged
......@@ -4425,6 +4430,19 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &1118525863
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1118525858}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 44c3e6c59af00de45b780a24a2fee2f3, type: 3}
m_Name:
m_EditorClassIdentifier:
inputButtons:
disableScripts: []
--- !u!1 &1149247900
GameObject:
m_ObjectHideFlags: 1
......@@ -4474,7 +4492,7 @@ Transform:
- {fileID: 2100709142}
- {fileID: 920148521}
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &1165012031 stripped
Transform:
......@@ -4507,7 +4525,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &1183635617 stripped
Transform:
......@@ -4540,6 +4558,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1288981517}
- {fileID: 47748003}
- {fileID: 1328617950}
- {fileID: 216344514}
- {fileID: 407241375}
......@@ -4589,11 +4608,10 @@ Transform:
- {fileID: 1727240399}
- {fileID: 992313189}
- {fileID: 182365961}
- {fileID: 47748003}
- {fileID: 242534398}
- {fileID: 762486095}
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &1212815706 stripped
Transform:
......@@ -4679,7 +4697,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 4319832483873770, guid: 09bfee321e702c547b2cfc7221e70cd0, type: 2}
propertyPath: m_RootOrder
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 212386094942055944, guid: 09bfee321e702c547b2cfc7221e70cd0,
type: 2}
......@@ -5046,7 +5064,6 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a707327fed739e346b5480ab597dbb23, type: 3}
m_Name:
m_EditorClassIdentifier:
smoothSpeed: 1
--- !u!1001 &1398096626
Prefab:
m_ObjectHideFlags: 0
......@@ -5983,7 +6000,7 @@ ParticleSystem:
m_GameObject: {fileID: 2100709141}
serializedVersion: 5
lengthInSec: 0.1
speed: 1
simulationSpeed: 1
looping: 0
prewarm: 0
playOnAwake: 1
......
......@@ -7,12 +7,14 @@ public class HazardSlow : AbstractBehavior {
float slowfactor;
float jumpHeightHold; //Holds the jumpHeight current value.
float wallJumpHeightHold; //Holds the wallJumpHeight current value.
bool valuesHeld;
static bool valuesHeld;
static int slowHazardCount;
void Awake()
{
slowfactor = 2.0f;
valuesHeld = false;
slowHazardCount = 0;
}
......@@ -20,15 +22,20 @@ public class HazardSlow : AbstractBehavior {
if(other.tag=="Player"){
other.GetComponent<Walk>().speed /= slowfactor;
//other.GetComponent<Jump> ().enabled = false;
if (!valuesHeld) {
jumpHeightHold = other.GetComponent<Jump> ().jumpHeight;
wallJumpHeightHold = other.GetComponent<Jump> ().wallJumpHeight;
valuesHeld = true;
if (slowHazardCount == 0)
{
other.GetComponent<Walk> ().speed /= slowfactor;
//other.GetComponent<Jump> ().enabled = false;
if (!valuesHeld) {
jumpHeightHold = other.GetComponent<Jump> ().jumpHeight;
wallJumpHeightHold = other.GetComponent<Jump> ().wallJumpHeight;
valuesHeld = true;
}
other.GetComponent<Jump> ().jumpHeight = 0;
other.GetComponent<Jump> ().wallJumpHeight = 0;
}
other.GetComponent<Jump> ().jumpHeight = 0;
other.GetComponent<Jump> ().wallJumpHeight = 0;
slowHazardCount++;
}
}
......@@ -36,10 +43,14 @@ public class HazardSlow : AbstractBehavior {
if(other.tag=="Player"){
other.GetComponent<Walk>().speed *= slowfactor;
//other.GetComponent<Jump>().enabled = true;
other.GetComponent<Jump> ().jumpHeight = jumpHeightHold;
other.GetComponent<Jump> ().wallJumpHeight = wallJumpHeightHold;
slowHazardCount--;
if (slowHazardCount == 0)
{
other.GetComponent<Walk> ().speed *= slowfactor;
//other.GetComponent<Jump>().enabled = true;
other.GetComponent<Jump> ().jumpHeight = jumpHeightHold;
other.GetComponent<Jump> ().wallJumpHeight = wallJumpHeightHold;
}
}
}
......
......@@ -8,6 +8,7 @@ TagManager:
- Wall
- Enemy
- Tiles Parent
- slowHazard
layers:
- Default
- TransparentFX
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2015
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Birb", "Birb.csproj", "{0E1C9E80-2222-A473-1DED-289BBAAF06DC}"
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Birb", "Assembly-CSharp.csproj", "{A490B848-188F-485C-9203-EFF824787523}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -9,12 +9,15 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0E1C9E80-2222-A473-1DED-289BBAAF06DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0E1C9E80-2222-A473-1DED-289BBAAF06DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0E1C9E80-2222-A473-1DED-289BBAAF06DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E1C9E80-2222-A473-1DED-289BBAAF06DC}.Release|Any CPU.Build.0 = Release|Any CPU
{A490B848-188F-485C-9203-EFF824787523}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A490B848-188F-485C-9203-EFF824787523}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A490B848-188F-485C-9203-EFF824787523}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A490B848-188F-485C-9203-EFF824787523}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
EndGlobalSection
EndGlobal
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment