player is jumping
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b4dc5f685f8edc4bbba6fb0c8ea39ba
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8851c5995be5f704babebf752d60b4e2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88c6da05db186cb44a4453fd624b31b2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -38,7 +38,7 @@ RenderSettings:
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.56158954, g: 0.7218083, b: 0.8178571, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.5615895, g: 0.72180885, b: 0.81785697, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
@@ -288,8 +288,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
rb: {fileID: 7917514869596290073}
|
||||
jumpforce: 350
|
||||
sideMovement: 3
|
||||
isJumping: 0
|
||||
holdTime: 0.15
|
||||
--- !u!1001 &1265567512
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -9743,7 +9742,7 @@ Rigidbody:
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 112
|
||||
m_CollisionDetection: 2
|
||||
m_CollisionDetection: 0
|
||||
--- !u!136 &7917514869596290074
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -8,12 +8,18 @@ public class PlayerController : MonoBehaviour
|
||||
private CameraController cc;
|
||||
//public float moveSpeed = 5f;
|
||||
public float jumpforce = 5f;
|
||||
public float sideMovement = 3f;
|
||||
private float sideMovement = 3f;
|
||||
private Vector3 direction;
|
||||
private float horizontal, vertical;
|
||||
public bool isJumping;
|
||||
private bool isJumping;
|
||||
private bool isOnGround;
|
||||
|
||||
|
||||
//
|
||||
public float holdTime = 0.3f;
|
||||
private bool isTapped = false;
|
||||
private float timeSinceLastTap = 0f;
|
||||
|
||||
//swipe movement
|
||||
private Vector2 startTouchPosition;
|
||||
private Vector2 endTouchPosition;
|
||||
@@ -22,17 +28,28 @@ public class PlayerController : MonoBehaviour
|
||||
cc = FindObjectOfType<CameraController>();
|
||||
}
|
||||
|
||||
void Update(){
|
||||
private void Update(){
|
||||
//jumping
|
||||
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;
|
||||
if(Input.touchCount > 0){
|
||||
Touch touch = Input.GetTouch(0);
|
||||
|
||||
if(touch.phase == TouchPhase.Began){
|
||||
isTapped = true;
|
||||
timeSinceLastTap = Time.time;
|
||||
}
|
||||
|
||||
if(touch.phase == TouchPhase.Ended){
|
||||
isTapped = false;
|
||||
timeSinceLastTap = 0f;
|
||||
}
|
||||
|
||||
if(isTapped && rb.transform.position.y <= 0.16f){
|
||||
if(Time.time - timeSinceLastTap >= holdTime){
|
||||
Debug.Log("Long tapped");
|
||||
rb.AddForce(new Vector3(0, jumpforce, 0));
|
||||
isTapped = false;
|
||||
}
|
||||
}
|
||||
//isOnGround = false;
|
||||
}
|
||||
|
||||
//new character controller with swipe lane changing
|
||||
@@ -42,7 +59,7 @@ public class PlayerController : MonoBehaviour
|
||||
if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended){
|
||||
endTouchPosition = Input.GetTouch(0).position;
|
||||
|
||||
if(endTouchPosition.x + 200< startTouchPosition.x){
|
||||
if(endTouchPosition.x < startTouchPosition.x){
|
||||
//left
|
||||
goLeft();
|
||||
|
||||
@@ -53,21 +70,17 @@ public class PlayerController : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
/*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
|
||||
if(rb.transform.position.x >= 2.5f) return; //ne tudjon kimenni a savbol
|
||||
cc.xPostion = -3;
|
||||
rb.transform.position = new Vector3(rb.transform.position.x + sideMovement, rb.transform.position.y, rb.transform.position.z);
|
||||
//rb.transform.position = new Vector3(rb.transform.position.x + sideMovement, rb.transform.position.y, rb.transform.position.z);
|
||||
rb.AddForce(new Vector3(300f, 0, 0));
|
||||
}
|
||||
|
||||
private void goRight(){
|
||||
if(rb.transform.position.x == -3) return; //ne tudjon kimenni a savbol
|
||||
if(rb.transform.position.x <= -2.5f) return; //ne tudjon kimenni a savbol
|
||||
cc.xPostion = 3;
|
||||
rb.transform.position = new Vector3(rb.transform.position.x - sideMovement, rb.transform.position.y, rb.transform.position.z);
|
||||
//rb.transform.position = new Vector3(rb.transform.position.x - sideMovement, rb.transform.position.y, rb.transform.position.z);
|
||||
rb.AddForce(new Vector3(-300f, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ MonoBehaviour:
|
||||
m_PixelRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 28
|
||||
width: 1366
|
||||
height: 672
|
||||
y: 43
|
||||
width: 1920
|
||||
height: 997
|
||||
m_ShowMode: 4
|
||||
m_Title: Hierarchy
|
||||
m_RootView: {fileID: 7}
|
||||
@@ -39,12 +39,12 @@ MonoBehaviour:
|
||||
m_Children: []
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 621
|
||||
x: 873
|
||||
y: 0
|
||||
width: 410
|
||||
height: 368
|
||||
m_MinSize: {x: 200, y: 200}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
width: 576
|
||||
height: 560
|
||||
m_MinSize: {x: 202, y: 221}
|
||||
m_MaxSize: {x: 4002, y: 4021}
|
||||
m_ActualView: {fileID: 18}
|
||||
m_Panes:
|
||||
- {fileID: 18}
|
||||
@@ -69,12 +69,12 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 30
|
||||
width: 1366
|
||||
height: 622
|
||||
width: 1920
|
||||
height: 947
|
||||
m_MinSize: {x: 400, y: 200}
|
||||
m_MaxSize: {x: 32384, y: 16192}
|
||||
vertical: 0
|
||||
controlID: 26
|
||||
controlID: 65
|
||||
--- !u!114 &4
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@@ -90,10 +90,10 @@ MonoBehaviour:
|
||||
m_Children: []
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 1031
|
||||
x: 1449
|
||||
y: 0
|
||||
width: 335
|
||||
height: 622
|
||||
width: 471
|
||||
height: 947
|
||||
m_MinSize: {x: 275, y: 50}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_ActualView: {fileID: 14}
|
||||
@@ -118,8 +118,8 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 192
|
||||
height: 368
|
||||
width: 270
|
||||
height: 560
|
||||
m_MinSize: {x: 201, y: 221}
|
||||
m_MaxSize: {x: 4001, y: 4021}
|
||||
m_ActualView: {fileID: 15}
|
||||
@@ -143,9 +143,9 @@ MonoBehaviour:
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 368
|
||||
width: 1031
|
||||
height: 254
|
||||
y: 560
|
||||
width: 1449
|
||||
height: 387
|
||||
m_MinSize: {x: 231, y: 271}
|
||||
m_MaxSize: {x: 10001, y: 10021}
|
||||
m_ActualView: {fileID: 13}
|
||||
@@ -174,8 +174,8 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1366
|
||||
height: 672
|
||||
width: 1920
|
||||
height: 997
|
||||
m_MinSize: {x: 875, y: 300}
|
||||
m_MaxSize: {x: 10000, y: 10000}
|
||||
m_UseTopView: 1
|
||||
@@ -199,7 +199,7 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1366
|
||||
width: 1920
|
||||
height: 30
|
||||
m_MinSize: {x: 0, y: 0}
|
||||
m_MaxSize: {x: 0, y: 0}
|
||||
@@ -220,8 +220,8 @@ MonoBehaviour:
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 652
|
||||
width: 1366
|
||||
y: 977
|
||||
width: 1920
|
||||
height: 20
|
||||
m_MinSize: {x: 0, y: 0}
|
||||
m_MaxSize: {x: 0, y: 0}
|
||||
@@ -244,12 +244,12 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1031
|
||||
height: 622
|
||||
width: 1449
|
||||
height: 947
|
||||
m_MinSize: {x: 300, y: 200}
|
||||
m_MaxSize: {x: 24288, y: 16192}
|
||||
vertical: 1
|
||||
controlID: 27
|
||||
controlID: 66
|
||||
--- !u!114 &11
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@@ -270,12 +270,12 @@ MonoBehaviour:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1031
|
||||
height: 368
|
||||
width: 1449
|
||||
height: 560
|
||||
m_MinSize: {x: 300, y: 100}
|
||||
m_MaxSize: {x: 24288, y: 8096}
|
||||
vertical: 0
|
||||
controlID: 28
|
||||
controlID: 67
|
||||
--- !u!114 &12
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 52
|
||||
@@ -291,10 +291,10 @@ MonoBehaviour:
|
||||
m_Children: []
|
||||
m_Position:
|
||||
serializedVersion: 2
|
||||
x: 192
|
||||
x: 270
|
||||
y: 0
|
||||
width: 429
|
||||
height: 368
|
||||
width: 603
|
||||
height: 560
|
||||
m_MinSize: {x: 200, y: 200}
|
||||
m_MaxSize: {x: 4000, y: 4000}
|
||||
m_ActualView: {fileID: 16}
|
||||
@@ -323,9 +323,9 @@ MonoBehaviour:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 454
|
||||
width: 1030
|
||||
height: 233
|
||||
y: 633
|
||||
width: 1448
|
||||
height: 366
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@@ -343,22 +343,22 @@ MonoBehaviour:
|
||||
m_SkipHidden: 0
|
||||
m_SearchArea: 1
|
||||
m_Folders:
|
||||
- Assets/Scripts
|
||||
- Assets
|
||||
m_Globs: []
|
||||
m_OriginalText:
|
||||
m_ViewMode: 1
|
||||
m_StartGridSize: 64
|
||||
m_LastFolders:
|
||||
- Assets/Scripts
|
||||
- Assets
|
||||
m_LastFoldersGridSize: -1
|
||||
m_LastProjectPath: /home/tom/Documents/dev/zarodolgozat/ColorRunner
|
||||
m_LastProjectPath: C:\dev\zarodolgozat\ColorBall
|
||||
m_LockTracker:
|
||||
m_IsLocked: 0
|
||||
m_FolderTreeState:
|
||||
scrollPos: {x: 0, y: 75}
|
||||
m_SelectedIDs: 04630000
|
||||
m_LastClickedID: 25348
|
||||
m_ExpandedIDs: 000000006a600000006300000a6300000c6300001263000000ca9a3b
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs: 14610000
|
||||
m_LastClickedID: 24852
|
||||
m_ExpandedIDs: 00000000146100001a610000
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@@ -386,7 +386,7 @@ MonoBehaviour:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs:
|
||||
m_LastClickedID: 0
|
||||
m_ExpandedIDs: 000000006a600000
|
||||
m_ExpandedIDs: 0000000014610000
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@@ -462,10 +462,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 1031
|
||||
y: 86
|
||||
width: 334
|
||||
height: 601
|
||||
x: 1449
|
||||
y: 73
|
||||
width: 470
|
||||
height: 926
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@@ -504,9 +504,9 @@ MonoBehaviour:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 86
|
||||
width: 191
|
||||
height: 347
|
||||
y: 73
|
||||
width: 269
|
||||
height: 539
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@@ -516,7 +516,7 @@ MonoBehaviour:
|
||||
scrollPos: {x: 0, y: 0}
|
||||
m_SelectedIDs:
|
||||
m_LastClickedID: 0
|
||||
m_ExpandedIDs: 34fbffff
|
||||
m_ExpandedIDs: 24faffff18fbffff
|
||||
m_RenameOverlay:
|
||||
m_UserAcceptedRename: 0
|
||||
m_Name:
|
||||
@@ -560,10 +560,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 192
|
||||
y: 86
|
||||
width: 427
|
||||
height: 347
|
||||
x: 270
|
||||
y: 73
|
||||
width: 601
|
||||
height: 539
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@@ -798,9 +798,9 @@ MonoBehaviour:
|
||||
m_PlayAudio: 0
|
||||
m_AudioPlay: 0
|
||||
m_Position:
|
||||
m_Target: {x: 0.747241, y: 2.3425326, z: -17.715397}
|
||||
m_Target: {x: -4.802098, y: 3.3336782, z: 32.88261}
|
||||
speed: 2
|
||||
m_Value: {x: 0.747241, y: 2.3425326, z: -17.715397}
|
||||
m_Value: {x: -4.802098, y: 3.3336782, z: 32.88261}
|
||||
m_RenderMode: 0
|
||||
m_CameraMode:
|
||||
drawMode: 0
|
||||
@@ -847,13 +847,13 @@ MonoBehaviour:
|
||||
m_GridAxis: 1
|
||||
m_gridOpacity: 0.5
|
||||
m_Rotation:
|
||||
m_Target: {x: 0.03353659, y: -0.28212187, z: 0.009868531, w: 0.95874125}
|
||||
m_Target: {x: -0.095726386, y: 0.09451524, z: -0.009131043, w: -0.9908675}
|
||||
speed: 2
|
||||
m_Value: {x: 0.033536598, y: -0.28212193, z: 0.009868532, w: 0.9587414}
|
||||
m_Value: {x: -0.09572646, y: 0.094515316, z: -0.009131051, w: -0.9908683}
|
||||
m_Size:
|
||||
m_Target: 3.2369728
|
||||
m_Target: 15.278611
|
||||
speed: 2
|
||||
m_Value: 3.2369728
|
||||
m_Value: 15.278611
|
||||
m_Ortho:
|
||||
m_Target: 0
|
||||
speed: 2
|
||||
@@ -899,9 +899,9 @@ MonoBehaviour:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 454
|
||||
width: 1030
|
||||
height: 233
|
||||
y: 633
|
||||
width: 1448
|
||||
height: 366
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@@ -926,10 +926,10 @@ MonoBehaviour:
|
||||
m_Tooltip:
|
||||
m_Pos:
|
||||
serializedVersion: 2
|
||||
x: 621
|
||||
y: 86
|
||||
width: 408
|
||||
height: 347
|
||||
x: 873
|
||||
y: 73
|
||||
width: 574
|
||||
height: 539
|
||||
m_ViewDataDictionary: {fileID: 0}
|
||||
m_OverlayCanvas:
|
||||
m_LastAppliedPresetName: Default
|
||||
@@ -958,7 +958,7 @@ MonoBehaviour:
|
||||
- UnityEditor.DeviceSimulation.ApplicationSettingsPlugin
|
||||
pluginStates:
|
||||
- '{}'
|
||||
scale: 12
|
||||
scale: 19
|
||||
fitToScreenEnabled: 1
|
||||
rotationDegree: 0
|
||||
highlightSafeAreaEnabled: 0
|
||||
|
||||
Reference in New Issue
Block a user