Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
GameDevWeek
W
Wintersemester 2018-2019
Unity
Suck It
Commits
5645da35
Commit
5645da35
authored
Mar 30, 2019
by
Sebastian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore Air Jumps when element is collected midair
parent
2b5a0676
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
Assets/_Game/Scripts/Player/MovementController.cs
Assets/_Game/Scripts/Player/MovementController.cs
+17
-0
No files found.
Assets/_Game/Scripts/Player/MovementController.cs
View file @
5645da35
...
@@ -34,6 +34,7 @@ public class MovementController : MonoBehaviour
...
@@ -34,6 +34,7 @@ public class MovementController : MonoBehaviour
private
bool
m_Grounded
=
false
;
// Whether or not the player is grounded.
private
bool
m_Grounded
=
false
;
// Whether or not the player is grounded.
private
bool
m_Swimming
=
false
;
private
bool
m_Swimming
=
false
;
private
bool
m_Airborn
=
true
;
private
bool
m_Airborn
=
true
;
private
bool
m_isAir
=
false
;
private
Rigidbody2D
m_Rigidbody2D
;
private
Rigidbody2D
m_Rigidbody2D
;
private
bool
m_FacingRight
=
true
;
// For determining which way the player is currently facing.
private
bool
m_FacingRight
=
true
;
// For determining which way the player is currently facing.
private
Vector3
m_Velocity
=
Vector3
.
zero
;
private
Vector3
m_Velocity
=
Vector3
.
zero
;
...
@@ -110,6 +111,7 @@ public class MovementController : MonoBehaviour
...
@@ -110,6 +111,7 @@ public class MovementController : MonoBehaviour
r_Animator
.
SetBool
(
"isJumping"
,
m_Jumped
);
r_Animator
.
SetBool
(
"isJumping"
,
m_Jumped
);
r_Animator
.
SetBool
(
"isAirborn"
,
m_Airborn
);
r_Animator
.
SetBool
(
"isAirborn"
,
m_Airborn
);
r_Animator
.
SetBool
(
"isSwimming"
,
m_Swimming
);
r_Animator
.
SetBool
(
"isSwimming"
,
m_Swimming
);
//r_Animator.SetBool("isAirCharged", m_isAir);
}
}
...
@@ -155,6 +157,7 @@ public class MovementController : MonoBehaviour
...
@@ -155,6 +157,7 @@ public class MovementController : MonoBehaviour
m_Grounded
=
false
;
m_Grounded
=
false
;
m_TempJumpCount
--;
m_TempJumpCount
--;
if
(
r_State
.
GetCurrentElement
()
==
InfusedElement
.
Air
)
r_State
.
ChangeCharges
(-
1
);
if
(
r_State
.
GetCurrentElement
()
==
InfusedElement
.
Air
)
r_State
.
ChangeCharges
(-
1
);
print
(
"AirJump: Charges left = "
+
m_TempJumpCount
);
m_Rigidbody2D
.
velocity
=
Vector2
.
up
*
m_JumpForce
;
m_Rigidbody2D
.
velocity
=
Vector2
.
up
*
m_JumpForce
;
OnJumpEvent
.
Invoke
();
OnJumpEvent
.
Invoke
();
StartCoroutine
(
Wait
(
m_SecondsWaitToJump
));
StartCoroutine
(
Wait
(
m_SecondsWaitToJump
));
...
@@ -180,6 +183,14 @@ public class MovementController : MonoBehaviour
...
@@ -180,6 +183,14 @@ public class MovementController : MonoBehaviour
else
else
{
{
MovementState
state
=
r_State
.
GetCurrentMovementState
();
MovementState
state
=
r_State
.
GetCurrentMovementState
();
if
(
r_State
.
GetCurrentElement
()
==
InfusedElement
.
Air
)
{
m_isAir
=
true
;
}
else
{
m_isAir
=
false
;
}
m_JumpForce
=
state
.
jumpForce
;
m_JumpForce
=
state
.
jumpForce
;
m_MovementSmoothing
=
state
.
smoothing
;
m_MovementSmoothing
=
state
.
smoothing
;
m_AirControl
=
state
.
airControl
;
m_AirControl
=
state
.
airControl
;
...
@@ -191,6 +202,12 @@ public class MovementController : MonoBehaviour
...
@@ -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
)
public
void
SetSwimming
(
bool
value
)
{
{
m_Swimming
=
value
;
m_Swimming
=
value
;
...
...
Write
Preview
Markdown
is supported
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