better isFalling detection
This commit is contained in:
parent
9294c2b8f1
commit
c9d2ef15ce
@ -108,14 +108,14 @@ public class PlayerController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
if (jump)
|
if (jump)
|
||||||
{
|
{
|
||||||
Debug.Log("Jump");
|
// Debug.Log("Jump");
|
||||||
rb.AddForce(transform.up * jumpSpeed * 100 * Time.deltaTime, ForceMode.Impulse);
|
rb.AddForce(transform.up * jumpSpeed * 100 * Time.deltaTime, ForceMode.Impulse);
|
||||||
jump = false;
|
jump = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rb.velocity.magnitude != 0 && rb.velocity.normalized == this.downDirection.normalized)
|
if(rb.velocity.magnitude != 0 && Vector3.Dot(rb.velocity.normalized, Physics.gravity.normalized) > 0 )
|
||||||
{
|
{
|
||||||
// Debug.Log("Player is falling :)");
|
Debug.Log("Player is falling :)");
|
||||||
this.isFalling = true;
|
this.isFalling = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -148,7 +148,7 @@ public class PlayerController : MonoBehaviour
|
|||||||
|
|
||||||
if (pushObject != null)
|
if (pushObject != null)
|
||||||
{
|
{
|
||||||
PlatformManager platform = pullObject.GetComponent<PlatformManager>();
|
PlatformManager platform = pushObject.GetComponent<PlatformManager>();
|
||||||
if (platform != null)
|
if (platform != null)
|
||||||
{
|
{
|
||||||
float step = platform.speed * Time.deltaTime * 10f;
|
float step = platform.speed * Time.deltaTime * 10f;
|
||||||
|
@ -34,7 +34,7 @@ public class ProceduralGeneration : MonoBehaviour
|
|||||||
float horizontalDistancePerPlatform = (float)Random.Range(1.0f, levelBlocks.Count); ;
|
float horizontalDistancePerPlatform = (float)Random.Range(1.0f, levelBlocks.Count); ;
|
||||||
|
|
||||||
List<GameObject> levelBlocksSpawnTemp = new List<GameObject>();
|
List<GameObject> levelBlocksSpawnTemp = new List<GameObject>();
|
||||||
Debug.Log("Building LOOP");
|
// Debug.Log("Building LOOP");
|
||||||
|
|
||||||
int pieceCount = 10;
|
int pieceCount = 10;
|
||||||
float radius = (pieceCount / 2) * 2;
|
float radius = (pieceCount / 2) * 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user