restart + fall location

This commit is contained in:
Sewmina Dilshan 2023-01-27 11:52:52 +05:30
parent 11552f90ad
commit d750c21084
2 changed files with 5 additions and 4 deletions

View File

@ -2043,7 +2043,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1342050495}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -6.08, y: 1.244, z: 0}
m_LocalPosition: {x: -10.2, y: 1.244, z: 0}
m_LocalScale: {x: 0.018947564, y: 1, z: 1}
m_Children:
- {fileID: 1937559066}
@ -2087,7 +2087,7 @@ HingeJoint2D:
m_BreakTorque: Infinity
m_AutoConfigureConnectedAnchor: 1
m_Anchor: {x: 0, y: 0}
m_ConnectedAnchor: {x: -6.08, y: 1.244}
m_ConnectedAnchor: {x: -10.2, y: 1.244}
m_UseMotor: 0
m_Motor:
m_MotorSpeed: 0

View File

@ -19,6 +19,7 @@ public class Player : MonoBehaviour
public float Score {get{return Mathf.Clamp(transform.position.x * moneyRate,0,float.MaxValue);}}
void Start()
{
walking =false;
CameraFollower.Target= transform;
}
@ -129,8 +130,8 @@ public class Player : MonoBehaviour
rb.simulated=false;
RaycastHit2D hit = Physics2D.Linecast(stick.GetChild(1).transform.position, stick.GetChild(1).transform.position- new Vector3(0,1f,0));
if(hit.collider == null){
Debug.Log("Fall down");
StartCoroutine(fall((!shorten) ? stick.GetChild(1).position : stick.position + new Vector3(0,0.5f)));
Debug.Log("Fall down, Too short? : " + shorten);
StartCoroutine(fall(((!shorten) ? stick.GetChild(1).position : stick.position) + new Vector3(0,0.5f)));
}else{
Debug.Log("Travel to point : " + hit.point + " : " + hit.collider.name);