Commit fix
This commit is contained in:
parent
2bb3e99c35
commit
559faba7b9
@ -247,4 +247,4 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
|
@ -177,7 +177,7 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
--- !u!1 &1560962679917322222
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -227,4 +227,4 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
|
@ -345,4 +345,4 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
|
@ -164,7 +164,7 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
--- !u!1 &8214805574275809151
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -294,4 +294,4 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
|
@ -1604,7 +1604,7 @@ Rigidbody:
|
||||
m_AngularDrag: 0.05
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 2
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 112
|
||||
m_CollisionDetection: 2
|
||||
--- !u!114 &3244356566819001086
|
||||
@ -2072,7 +2072,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3244356567913423209}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.55, z: -0.877}
|
||||
m_LocalPosition: {x: 0, y: 0.55, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -2102,7 +2102,7 @@ Camera:
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
near clip plane: 0.1
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
|
@ -101,7 +101,7 @@ GameObject:
|
||||
- component: {fileID: 2527761051471871889}
|
||||
- component: {fileID: 4240483973579556787}
|
||||
m_Layer: 0
|
||||
m_Name: platform_blue
|
||||
m_Name: Platform_Blue
|
||||
m_TagString: platform
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@ -344,4 +344,4 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
|
@ -116,7 +116,7 @@ GameObject:
|
||||
- component: {fileID: -7597049073915248875}
|
||||
- component: {fileID: 3278078638141404736}
|
||||
m_Layer: 0
|
||||
m_Name: platform_green
|
||||
m_Name: Platform_Green
|
||||
m_TagString: platform
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@ -245,7 +245,7 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
--- !u!1 &8985668614484660023
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -117,7 +117,7 @@ GameObject:
|
||||
- component: {fileID: 5862113707430629064}
|
||||
- component: {fileID: -6889792310482815023}
|
||||
m_Layer: 0
|
||||
m_Name: platform_red
|
||||
m_Name: Platform_Red
|
||||
m_TagString: platform
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@ -344,4 +344,4 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
|
@ -117,7 +117,7 @@ GameObject:
|
||||
- component: {fileID: 8383421295717427161}
|
||||
- component: {fileID: 3996111038030861644}
|
||||
m_Layer: 0
|
||||
m_Name: platform_yellow
|
||||
m_Name: Platform_yellow
|
||||
m_TagString: platform
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
@ -345,4 +345,4 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 1
|
||||
|
@ -71,7 +71,7 @@ public class PlayerController : MonoBehaviour
|
||||
isRunning = Input.GetKey(KeyCode.LeftShift);
|
||||
if (canMove && currentSpeed < minSpeed)
|
||||
{
|
||||
currentSpeed += 0.0005f;
|
||||
currentSpeed += 0.005f;
|
||||
}
|
||||
|
||||
if (Input.GetAxis("Vertical") > 0 && currentSpeed < maxSpeed)
|
||||
@ -147,7 +147,7 @@ public class PlayerController : MonoBehaviour
|
||||
inAir = false;
|
||||
}
|
||||
|
||||
if (rb.velocity.magnitude != 0 && Vector3.Dot(rb.velocity.normalized, Physics.gravity.normalized) > 0)
|
||||
if (Vector3.Distance(transform.position, new Vector3(0f,0f, transform.position.z)) > 10f)
|
||||
{
|
||||
// Debug.Log("Player is falling :)");
|
||||
this.isFalling = true;
|
||||
@ -167,33 +167,6 @@ public class PlayerController : MonoBehaviour
|
||||
transform.RotateAround(axis, angle * Time.deltaTime * 8f);
|
||||
}
|
||||
|
||||
if (pullObject != null)
|
||||
{
|
||||
PlatformManager platform = pullObject.GetComponent<PlatformManager>();
|
||||
if (platform != null)
|
||||
{
|
||||
float step = platform.speed * Time.deltaTime * 10f;
|
||||
rb.AddForce((pullObject.transform.position - transform.position) * step, ForceMode.Force);
|
||||
}
|
||||
if (Vector3.Distance(pullObject.transform.position, transform.position) > 5f)
|
||||
{
|
||||
pullObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (pushObject != null)
|
||||
{
|
||||
PlatformManager platform = pushObject.GetComponent<PlatformManager>();
|
||||
if (platform != null)
|
||||
{
|
||||
float step = platform.speed * Time.deltaTime * 10f;
|
||||
rb.AddForce(-(pushObject.transform.position - transform.position) * step, ForceMode.Force);
|
||||
}
|
||||
if (Vector3.Distance(pushObject.transform.position, transform.position) > 5f)
|
||||
{
|
||||
pushObject = null;
|
||||
}
|
||||
}
|
||||
var distanceFromYAxis = new Vector2(rb.position.x, rb.position.y).magnitude;
|
||||
if (distanceFromYAxis > this.maxDistanceFromCenterLine)
|
||||
{
|
||||
@ -210,6 +183,23 @@ public class PlayerController : MonoBehaviour
|
||||
if (other.gameObject.tag == "platform")
|
||||
{
|
||||
Physics.gravity = this.downDirection * 9.81f;
|
||||
|
||||
PlatformManager platform = pullObject.GetComponent<PlatformManager>();
|
||||
|
||||
if (platform != null)
|
||||
{
|
||||
platform.Step();
|
||||
float step = platform.speed * Time.deltaTime * 10f;
|
||||
switch (platform.type)
|
||||
{
|
||||
case PlatformManager.PlatformType.Push:
|
||||
rb.AddForce(-(pushObject.transform.position - transform.position) * step, ForceMode.Force);
|
||||
break;
|
||||
case PlatformManager.PlatformType.Pull:
|
||||
rb.AddForce((other.transform.position - transform.position) * step, ForceMode.Force);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,12 +244,8 @@ public class PlayerController : MonoBehaviour
|
||||
switch (platform.type)
|
||||
{
|
||||
case PlatformManager.PlatformType.Push:
|
||||
pushObject = other.gameObject;
|
||||
pullObject = null;
|
||||
break;
|
||||
case PlatformManager.PlatformType.Pull:
|
||||
pullObject = other.gameObject;
|
||||
pushObject = null;
|
||||
break;
|
||||
case PlatformManager.PlatformType.RotateY:
|
||||
break;
|
||||
@ -291,11 +277,11 @@ public class PlayerController : MonoBehaviour
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 gDirection = -other.GetContact(0).normal;
|
||||
saveDirection = gDirection;
|
||||
Vector3 gDirection = -transform.up;
|
||||
saveDirection = -other.GetContact(0).normal;
|
||||
if (platform == null)
|
||||
{
|
||||
gDirection = -other.GetContact(0).normal;
|
||||
gDirection = -transform.up;
|
||||
}
|
||||
platformForward = other.transform.forward;
|
||||
platformRight = other.transform.right;
|
||||
|
Loading…
Reference in New Issue
Block a user