This commit is contained in:
2023-02-09 13:39:52 +01:00
parent c6180300a8
commit e803930349
4 changed files with 55 additions and 45 deletions

View File

@@ -123,14 +123,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 499665619135560210}
m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067}
m_LocalPosition: {x: 16.96, y: 1, z: 3}
m_LocalRotation: {x: -0.70710677, y: 0, z: 0, w: 0.70710677}
m_LocalPosition: {x: 16.85, y: 1.01, z: 3}
m_LocalScale: {x: 3, y: 1.5, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8769601115213192681}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: -90, y: 90, z: -90}
--- !u!33 &6014928796244115842
MeshFilter:
m_ObjectHideFlags: 0

View File

@@ -258,6 +258,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
loadFrom: []
sideObjects: []
--- !u!4 &1201779183
Transform:
m_ObjectHideFlags: 0
@@ -286,8 +287,9 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
rb: {fileID: 7917514869596290073}
jumpforce: 5
jumpforce: 350
sideMovement: 3
isJumping: 0
--- !u!1001 &1265567512
PrefabInstance:
m_ObjectHideFlags: 0
@@ -9046,7 +9048,7 @@ GameObject:
m_Component:
- component: {fileID: 7917514869596290071}
- component: {fileID: 7917514869596290073}
- component: {fileID: 7917514869596290072}
- component: {fileID: 7917514869596290074}
m_Layer: 0
m_Name: BobyWithRigifyAdvanced
m_TagString: Untagged
@@ -9726,19 +9728,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &7917514869596290072
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7398140401948337837}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 3.46828, y: 6.272723, z: 1.3076319}
m_Center: {x: -0.011764348, y: 3.0974507, z: -0.01770711}
--- !u!54 &7917514869596290073
Rigidbody:
m_ObjectHideFlags: 0
@@ -9753,8 +9742,22 @@ Rigidbody:
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 116
m_CollisionDetection: 1
m_Constraints: 112
m_CollisionDetection: 2
--- !u!136 &7917514869596290074
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7398140401948337837}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 1.7212968
m_Height: 6.3698125
m_Direction: 1
m_Center: {x: -0.03604698, y: 3.18, z: -0.06167984}
--- !u!4 &7986884067029569574
Transform:
m_ObjectHideFlags: 0

View File

@@ -10,7 +10,8 @@ public class PlayerController : MonoBehaviour
public float jumpforce = 5f;
public float sideMovement = 3f;
private Vector3 direction;
private float horizontal, vertical, isJumping;
private float horizontal, vertical;
public bool isJumping;
private bool isOnGround;
//swipe movement
@@ -23,10 +24,16 @@ public class PlayerController : MonoBehaviour
void Update(){
//jumping
/*if (isJumping > 0 && isOnGround) {
rb.AddForce(new Vector3(0, jumpforce, 0));
isOnGround = false;
}*/
if (Input.touchCount > 0) {
var startPosition = Input.GetTouch(0).position;
if(Input.GetTouch(0).phase == TouchPhase.Ended && !isJumping && Input.GetTouch(0).position == startPosition){
rb.AddForce(new Vector3(0, jumpforce, 0));
isJumping = true;
}else if(Input.GetTouch(0).phase == TouchPhase.Ended ){
isJumping = false;
}
//isOnGround = false;
}
//new character controller with swipe lane changing
if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began){
@@ -35,7 +42,7 @@ public class PlayerController : MonoBehaviour
if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended){
endTouchPosition = Input.GetTouch(0).position;
if(endTouchPosition.x + 20< startTouchPosition.x){
if(endTouchPosition.x + 200< startTouchPosition.x){
//left
goLeft();
@@ -46,11 +53,11 @@ public class PlayerController : MonoBehaviour
}
}
private void OnCollisionEnter(Collision collision) {
/*private void OnCollisionEnter(Collision collision) {
if (collision.collider.CompareTag("Ground")) {
isOnGround = true;
}
}
}*/
private void goLeft(){
if(rb.transform.position.x == 3) return; //ne tudjon kimenni a savbol