Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
GameDevWeek
Wintersemester 2018-2019
Unity
Suck It
Commits
5645da35
Commit
5645da35
authored
Mar 30, 2019
by
Sebastian
Browse files
restore Air Jumps when element is collected midair
parent
2b5a0676
Changes
1
Hide whitespace changes
Inline
Side-by-side
Assets/_Game/Scripts/Player/MovementController.cs
View file @
5645da35
...
...
@@ -34,6 +34,7 @@ public class MovementController : MonoBehaviour
private
bool
m_Grounded
=
false
;
// Whether or not the player is grounded.
private
bool
m_Swimming
=
false
;
private
bool
m_Airborn
=
true
;
private
bool
m_isAir
=
false
;
private
Rigidbody2D
m_Rigidbody2D
;
private
bool
m_FacingRight
=
true
;
// For determining which way the player is currently facing.
private
Vector3
m_Velocity
=
Vector3
.
zero
;
...
...
@@ -110,6 +111,7 @@ public class MovementController : MonoBehaviour
r_Animator
.
SetBool
(
"isJumping"
,
m_Jumped
);
r_Animator
.
SetBool
(
"isAirborn"
,
m_Airborn
);
r_Animator
.
SetBool
(
"isSwimming"
,
m_Swimming
);
//r_Animator.SetBool("isAirCharged", m_isAir);
}
...
...
@@ -155,6 +157,7 @@ public class MovementController : MonoBehaviour
m_Grounded
=
false
;
m_TempJumpCount
--;
if
(
r_State
.
GetCurrentElement
()
==
InfusedElement
.
Air
)
r_State
.
ChangeCharges
(-
1
);
print
(
"AirJump: Charges left = "
+
m_TempJumpCount
);
m_Rigidbody2D
.
velocity
=
Vector2
.
up
*
m_JumpForce
;
OnJumpEvent
.
Invoke
();
StartCoroutine
(
Wait
(
m_SecondsWaitToJump
));
...
...
@@ -180,6 +183,14 @@ public class MovementController : MonoBehaviour
else
{
MovementState
state
=
r_State
.
GetCurrentMovementState
();
if
(
r_State
.
GetCurrentElement
()
==
InfusedElement
.
Air
)
{
m_isAir
=
true
;
}
else
{
m_isAir
=
false
;
}
m_JumpForce
=
state
.
jumpForce
;
m_MovementSmoothing
=
state
.
smoothing
;
m_AirControl
=
state
.
airControl
;
...
...
@@ -191,6 +202,12 @@ public class MovementController : MonoBehaviour
}
}
public
void
SetAirJumpCount
()
{
if
(
r_State
.
GetCurrentElement
()
!=
InfusedElement
.
Air
)
return
;
m_TempJumpCount
=
r_State
.
GetCharges
();
}
public
void
SetSwimming
(
bool
value
)
{
m_Swimming
=
value
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment