new movement

This commit is contained in:
2023-03-07 21:06:25 +01:00
parent 927ea1f885
commit 07697c1d20
11 changed files with 587 additions and 132 deletions

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 3b4dc5f685f8edc4bbba6fb0c8ea39ba
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 8851c5995be5f704babebf752d60b4e2
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 88c6da05db186cb44a4453fd624b31b2
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {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 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
@@ -157,6 +157,127 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
--- !u!1 &284201298
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 284201299}
- component: {fileID: 284201302}
- component: {fileID: 284201301}
- component: {fileID: 284201300}
m_Layer: 5
m_Name: Jump
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &284201299
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 284201298}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 871711471}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 12.5, y: -7}
m_SizeDelta: {x: 275, y: 1731.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &284201300
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 284201298}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 0}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 0}
m_PressedColor: {r: 1, g: 1, b: 1, a: 0}
m_SelectedColor: {r: 1, g: 1, b: 1, a: 0}
m_DisabledColor: {r: 1, g: 1, b: 1, a: 0}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 2129484389}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &284201301
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 284201298}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &284201302
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 284201298}
m_CullTransparentMesh: 1
--- !u!1 &481417097 --- !u!1 &481417097
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -281,6 +402,9 @@ RectTransform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1572233530} - {fileID: 1572233530}
- {fileID: 2129484387}
- {fileID: 284201299}
- {fileID: 2069815690}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 9 m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -425,8 +549,12 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
rb: {fileID: 7917514869596290073} rb: {fileID: 7917514869596290073}
jumpforce: 350 jumpforce: 10
holdTime: 0.15 holdTime: 0.2
activeControllType: 0
leftButton: {fileID: 2129484388}
jumpButton: {fileID: 284201300}
rightButton: {fileID: 2069815691}
--- !u!114 &1201779185 --- !u!114 &1201779185
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1174,6 +1302,248 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 1 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &2069815689
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2069815690}
- component: {fileID: 2069815693}
- component: {fileID: 2069815692}
- component: {fileID: 2069815691}
m_Layer: 5
m_Name: GoRight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2069815690
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2069815689}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 871711471}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 275, y: 0.0089758}
m_SizeDelta: {x: 250, y: 1731.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2069815691
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2069815689}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 0}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 0}
m_PressedColor: {r: 1, g: 1, b: 1, a: 0}
m_SelectedColor: {r: 1, g: 1, b: 1, a: 0}
m_DisabledColor: {r: 1, g: 1, b: 1, a: 0}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 2129484389}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &2069815692
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2069815689}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &2069815693
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2069815689}
m_CullTransparentMesh: 1
--- !u!1 &2129484386
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2129484387}
- component: {fileID: 2129484390}
- component: {fileID: 2129484389}
- component: {fileID: 2129484388}
m_Layer: 5
m_Name: GoLeft
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2129484387
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2129484386}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 871711471}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -262.5, y: -0.0089696}
m_SizeDelta: {x: 275, y: 1731.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2129484388
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2129484386}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 0}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 0}
m_PressedColor: {r: 1, g: 1, b: 1, a: 0}
m_SelectedColor: {r: 1, g: 1, b: 1, a: 0}
m_DisabledColor: {r: 1, g: 1, b: 1, a: 0}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 2129484389}
m_OnClick:
m_PersistentCalls:
m_Calls: []
--- !u!114 &2129484389
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2129484386}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &2129484390
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2129484386}
m_CullTransparentMesh: 1
--- !u!1 &30613582022879756 --- !u!1 &30613582022879756
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -10397,7 +10767,7 @@ Rigidbody:
m_Mass: 1 m_Mass: 1
m_Drag: 0 m_Drag: 0
m_AngularDrag: 0 m_AngularDrag: 0
m_UseGravity: 1 m_UseGravity: 0
m_IsKinematic: 0 m_IsKinematic: 0
m_Interpolate: 0 m_Interpolate: 0
m_Constraints: 112 m_Constraints: 112
@@ -10411,7 +10781,7 @@ CapsuleCollider:
m_GameObject: {fileID: 7398140401948337837} m_GameObject: {fileID: 7398140401948337837}
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 0
m_Radius: 1.7212968 m_Radius: 1.7212968
m_Height: 6.3698125 m_Height: 6.3698125
m_Direction: 1 m_Direction: 1

View File

@@ -6,6 +6,15 @@ public class CoinCounter : MonoBehaviour
{ {
public ulong coin = 0; //szedje le db-bol a playerhez a coint public ulong coin = 0; //szedje le db-bol a playerhez a coint
private DatabaseData dd;
//get player coin at startup based on username
private void Awake() {
dd = FindObjectOfType<DatabaseData>();
//dd.GetCoinData("Playmaker1210");
}
public void AddCoin(ulong number){ public void AddCoin(ulong number){
coin += number; coin += number;
} }

View File

@@ -12,10 +12,13 @@ public class DatabaseData : MonoBehaviour
public HighScoreTable hst; //high score table ui public HighScoreTable hst; //high score table ui
public string jsondata; //json szoveg public string jsondata; //json szoveg
private CoinCounter coinc;
private void Awake() { private void Awake() {
hst = FindObjectOfType<HighScoreTable>(); //High Score Table referencia hst = FindObjectOfType<HighScoreTable>(); //High Score Table referencia
htdc = new HighScoreTableDataContainer(); //High Score Table Container objektum htdc = new HighScoreTableDataContainer(); //High Score Table Container objektum
players = new PlayerList(); //jatekos lista osztaly players = new PlayerList(); //jatekos lista osztaly
coinc = FindObjectOfType<CoinCounter>();
} }
private void Start() { private void Start() {
@@ -37,6 +40,8 @@ public class DatabaseData : MonoBehaviour
public void PostNewScoreData() => StartCoroutine(IPostNewScoreData()); public void PostNewScoreData() => StartCoroutine(IPostNewScoreData());
public void PostNewPalyaData() => StartCoroutine(IPostNewPalyaData()); public void PostNewPalyaData() => StartCoroutine(IPostNewPalyaData());
public void GetCoinData(string username) => StartCoroutine(IGetPlayerCoins(username));
private IEnumerator IGetPlayerData() { private IEnumerator IGetPlayerData() {
input.text = "Loading..."; //ideiglenes szoveg amig nem jelenik meg az adat szoveg input.text = "Loading..."; //ideiglenes szoveg amig nem jelenik meg az adat szoveg
@@ -66,6 +71,30 @@ public class DatabaseData : MonoBehaviour
} }
private IEnumerator IGetCurretPlayer(int userid){
string uri = "http://localhost:3000/currentplayer";
var uwr = new UnityWebRequest(uri, "POST");
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+userid+"}"); //palya id megadasa
uwr.uploadHandler = (UploadHandler)new UploadHandlerRaw(jsonToSend); //felkuldi a palya id-t
uwr.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
uwr.SetRequestHeader("Content-Type", "application/json");
yield return uwr.SendWebRequest();
if (uwr.isNetworkError) {
Debug.Log(uwr.error);
} else {
jsondata = uwr.downloadHandler.text; //json szoveg eltarolasa
Debug.Log("current player json: " + jsondata);
jsonParser(jsondata); //json adat atalakitasa
foreach(var p in players.player) {
p.ConvertDate(); //datum eltarolasa es atalakitasa datum tipussa
Debug.Log("p_id: " + p.player_id + " username: " + p.player_name + " join date: " + p.joindate.printDate() + "\n");
}
}
}
private IEnumerator IGetHighScoreData(int palya_id){ private IEnumerator IGetHighScoreData(int palya_id){
string uri = "http://localhost:3000/toplist"; string uri = "http://localhost:3000/toplist";
@@ -104,7 +133,7 @@ public class DatabaseData : MonoBehaviour
Debug.Log(uwr.error); Debug.Log(uwr.error);
} else { } else {
Debug.Log(uwr.downloadHandler.text); Debug.Log(uwr.downloadHandler.text);
coinc.coin = ulong.Parse(uwr.downloadHandler.text);
} }
} }

View File

@@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour public class PlayerController : MonoBehaviour
{ {
@@ -16,49 +17,78 @@ public class PlayerController : MonoBehaviour
private Vector2 startTouchPosition; //erintes kezdo pozicio private Vector2 startTouchPosition; //erintes kezdo pozicio
private Vector2 endTouchPosition; //erintes vegpozicio private Vector2 endTouchPosition; //erintes vegpozicio
public ControllType activeControllType;
public Button leftButton;
public Button jumpButton;
public Button rightButton;
public enum ControllType
{
Swipe,
Button
}
private void Awake() { private void Awake() {
cc = FindObjectOfType<CameraController>(); //kamera vezerlo referencia cc = FindObjectOfType<CameraController>(); //kamera vezerlo referencia
activeControllType = ControllType.Button;
}
public void setControllType(ControllType controlltype){
activeControllType = controlltype;
} }
private void Update(){ private void Update(){
//jumping
if(Input.touchCount > 0){
Touch touch = Input.GetTouch(0); //elso erintes lekerese
if(touch.phase == TouchPhase.Began){ //ha az erintes elkezdotott if(activeControllType == ControllType.Swipe){
isTapped = true; leftButton.gameObject.SetActive(false);
timeSinceLastTap = Time.time; jumpButton.gameObject.SetActive(false);
} rightButton.gameObject.SetActive(false);
if(touch.phase == TouchPhase.Ended){ //ha az erintes befejezodott //jumping
isTapped = false; if(Input.touchCount > 0){
timeSinceLastTap = 0f; Touch touch = Input.GetTouch(0); //elso erintes lekerese
}
if(isTapped && rb.transform.position.y <= 0.16f){ if(touch.phase == TouchPhase.Began){ //ha az erintes elkezdotott
if(Time.time - timeSinceLastTap >= holdTime){ //ha nyomva tartotta a beallitott ideig isTapped = true;
Debug.Log("Long tapped"); timeSinceLastTap = Time.time;
rb.AddForce(new Vector3(0, jumpforce, 0)); //ugras }
if(touch.phase == TouchPhase.Ended){ //ha az erintes befejezodott
isTapped = false; isTapped = false;
timeSinceLastTap = 0f;
}
if(isTapped && rb.transform.position.y <= 0.16f){
if(Time.time - timeSinceLastTap >= holdTime){ //ha nyomva tartotta a beallitott ideig
Debug.Log("Long tapped");
jump();
isTapped = false;
}
} }
} }
}
//new character controller with swipe lane changing //new character controller with swipe lane changing
if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began){ //elso erintes elkezdodott if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began){ //elso erintes elkezdodott
startTouchPosition = Input.GetTouch(0).position; startTouchPosition = Input.GetTouch(0).position;
}
if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended){ //elso erintes befejezodott
endTouchPosition = Input.GetTouch(0).position;
if(endTouchPosition.x < startTouchPosition.x){ //balra huzott
//left
goLeft();
}else if(endTouchPosition.x > startTouchPosition.x){ //jobbra huzott
//right
goRight();
} }
if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended){ //elso erintes befejezodott
endTouchPosition = Input.GetTouch(0).position;
if(endTouchPosition.x < startTouchPosition.x){ //balra huzott
//left
goLeft();
}else if(endTouchPosition.x > startTouchPosition.x){ //jobbra huzott
//right
goRight();
}
}
}else if(activeControllType == ControllType.Button){
jumpforce = 2;
leftButton.onClick.AddListener(goRight);
jumpButton.onClick.AddListener(jump);
rightButton.onClick.AddListener(goLeft);
} }
} }
@@ -73,4 +103,8 @@ public class PlayerController : MonoBehaviour
cc.xPostion = 3; //kamera xPozicioja cc.xPostion = 3; //kamera xPozicioja
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);
} }
private void jump(){
rb.AddForce(new Vector3(0, jumpforce, 0)); //ugras
}
} }

View File

@@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class SetButtonSize : MonoBehaviour
{
public Canvas canvas;
public Button leftButton;
public Button jumpButton;
public Button rightButton;
private Vector2 canvasSize;
private void Awake() {
canvasSize = new Vector2(canvas.GetComponent<RectTransform>().rect.width, canvas.GetComponent<RectTransform>().rect.height);
///leftButton
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e84dc5ac17504204da8ccd1fb2c9bbfe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using TMPro; using TMPro;
using System.Threading; using UnityEditor;
public class fps : MonoBehaviour public class fps : MonoBehaviour
{ {
@@ -13,10 +13,12 @@ public class fps : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
#if UNITY_EDITOR
if (Time.unscaledTime > _timer) { if (Time.unscaledTime > _timer) {
int fps = (int)(1f / Time.unscaledDeltaTime); int fps = (int)(1f / Time.unscaledDeltaTime);
fpsText.text = "FPS: " + fps; fpsText.text = "FPS: " + fps;
_timer = Time.unscaledTime + _hudRefreshRate; _timer = Time.unscaledTime + _hudRefreshRate;
} }
#endif
} }
} }

View File

@@ -15,15 +15,15 @@ MonoBehaviour:
m_PixelRect: m_PixelRect:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 28 y: 43
width: 1366 width: 1920
height: 673 height: 997
m_ShowMode: 4 m_ShowMode: 4
m_Title: Hierarchy m_Title: Hierarchy
m_RootView: {fileID: 3} m_RootView: {fileID: 3}
m_MinSize: {x: 875, y: 300} m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000} m_MaxSize: {x: 10000, y: 10000}
m_Maximized: 0 m_Maximized: 1
--- !u!114 &2 --- !u!114 &2
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@@ -39,10 +39,10 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 681 x: 957
y: 0 y: 0
width: 339 width: 477
height: 354 height: 550
m_MinSize: {x: 202, y: 221} m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021} m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 18} m_ActualView: {fileID: 18}
@@ -70,8 +70,8 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 1366 width: 1920
height: 673 height: 997
m_MinSize: {x: 875, y: 300} m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000} m_MaxSize: {x: 10000, y: 10000}
m_UseTopView: 1 m_UseTopView: 1
@@ -95,7 +95,7 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 1366 width: 1920
height: 30 height: 30
m_MinSize: {x: 0, y: 0} m_MinSize: {x: 0, y: 0}
m_MaxSize: {x: 0, y: 0} m_MaxSize: {x: 0, y: 0}
@@ -116,8 +116,8 @@ MonoBehaviour:
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 653 y: 977
width: 1366 width: 1920
height: 20 height: 20
m_MinSize: {x: 0, y: 0} m_MinSize: {x: 0, y: 0}
m_MaxSize: {x: 0, y: 0} m_MaxSize: {x: 0, y: 0}
@@ -140,12 +140,12 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 30 y: 30
width: 1366 width: 1920
height: 623 height: 947
m_MinSize: {x: 400, y: 200} m_MinSize: {x: 400, y: 200}
m_MaxSize: {x: 32384, y: 16192} m_MaxSize: {x: 32384, y: 16192}
vertical: 0 vertical: 0
controlID: 173 controlID: 108
--- !u!114 &7 --- !u!114 &7
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@@ -165,12 +165,12 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 1020 width: 1434
height: 623 height: 947
m_MinSize: {x: 300, y: 200} m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192} m_MaxSize: {x: 24288, y: 16192}
vertical: 1 vertical: 1
controlID: 174 controlID: 109
--- !u!114 &8 --- !u!114 &8
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@@ -191,12 +191,12 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 1020 width: 1434
height: 354 height: 550
m_MinSize: {x: 300, y: 100} m_MinSize: {x: 300, y: 100}
m_MaxSize: {x: 24288, y: 8096} m_MaxSize: {x: 24288, y: 8096}
vertical: 0 vertical: 0
controlID: 175 controlID: 110
--- !u!114 &9 --- !u!114 &9
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 52 m_ObjectHideFlags: 52
@@ -214,8 +214,8 @@ MonoBehaviour:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 0 y: 0
width: 173 width: 243
height: 354 height: 550
m_MinSize: {x: 201, y: 221} m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021} m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 13} m_ActualView: {fileID: 13}
@@ -238,10 +238,10 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 173 x: 243
y: 0 y: 0
width: 508 width: 714
height: 354 height: 550
m_MinSize: {x: 202, y: 221} m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021} m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 14} m_ActualView: {fileID: 14}
@@ -265,9 +265,9 @@ MonoBehaviour:
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 354 y: 550
width: 1020 width: 1434
height: 269 height: 397
m_MinSize: {x: 101, y: 121} m_MinSize: {x: 101, y: 121}
m_MaxSize: {x: 4001, y: 4021} m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 16} m_ActualView: {fileID: 16}
@@ -291,12 +291,12 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Position: m_Position:
serializedVersion: 2 serializedVersion: 2
x: 1020 x: 1434
y: 0 y: 0
width: 346 width: 486
height: 623 height: 947
m_MinSize: {x: 276, y: 71} m_MinSize: {x: 275, y: 50}
m_MaxSize: {x: 4001, y: 4021} m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 17} m_ActualView: {fileID: 17}
m_Panes: m_Panes:
- {fileID: 17} - {fileID: 17}
@@ -323,9 +323,9 @@ MonoBehaviour:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 86 y: 73
width: 172 width: 242
height: 333 height: 529
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default
@@ -333,9 +333,9 @@ MonoBehaviour:
m_SceneHierarchy: m_SceneHierarchy:
m_TreeViewState: m_TreeViewState:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs: e2f4ffff
m_LastClickedID: 0 m_LastClickedID: -2846
m_ExpandedIDs: b8faffff m_ExpandedIDs: 9af4ffffe2f4ffff34fbffff425a0000a05a0000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@@ -351,7 +351,7 @@ MonoBehaviour:
m_IsRenaming: 0 m_IsRenaming: 0
m_OriginalEventType: 11 m_OriginalEventType: 11
m_IsRenamingFilename: 0 m_IsRenamingFilename: 0
m_ClientGUIView: {fileID: 0} m_ClientGUIView: {fileID: 9}
m_SearchString: m_SearchString:
m_ExpandedScenes: [] m_ExpandedScenes: []
m_CurrenRootInstanceID: 0 m_CurrenRootInstanceID: 0
@@ -379,10 +379,10 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 173 x: 243
y: 86 y: 73
width: 506 width: 712
height: 333 height: 529
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default
@@ -617,9 +617,9 @@ MonoBehaviour:
m_PlayAudio: 0 m_PlayAudio: 0
m_AudioPlay: 0 m_AudioPlay: 0
m_Position: m_Position:
m_Target: {x: 5.276126, y: 3.061911, z: -6.65707} m_Target: {x: -0.70529556, y: 8.58622, z: -58.736225}
speed: 2 speed: 2
m_Value: {x: 5.276126, y: 3.061911, z: -6.65707} m_Value: {x: -0.70529556, y: 8.58622, z: -58.736225}
m_RenderMode: 0 m_RenderMode: 0
m_CameraMode: m_CameraMode:
drawMode: 0 drawMode: 0
@@ -666,13 +666,13 @@ MonoBehaviour:
m_GridAxis: 1 m_GridAxis: 1
m_gridOpacity: 0.5 m_gridOpacity: 0.5
m_Rotation: m_Rotation:
m_Target: {x: -0.20257631, y: 0.2837753, z: -0.061466984, w: -0.9352343} m_Target: {x: -0.24836192, y: 0.22615214, z: -0.059745934, w: -0.94}
speed: 2 speed: 2
m_Value: {x: -0.20257631, y: 0.2837753, z: -0.06146699, w: -0.93523437} m_Value: {x: -0.24836217, y: 0.22615236, z: -0.059745993, w: -0.94000095}
m_Size: m_Size:
m_Target: 11.961957 m_Target: 30.205072
speed: 2 speed: 2
m_Value: 11.961957 m_Value: 30.205072
m_Ortho: m_Ortho:
m_Target: 0 m_Target: 0
speed: 2 speed: 2
@@ -718,9 +718,9 @@ MonoBehaviour:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 440 y: 623
width: 1019 width: 1433
height: 248 height: 376
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default
@@ -738,22 +738,22 @@ MonoBehaviour:
m_SkipHidden: 0 m_SkipHidden: 0
m_SearchArea: 1 m_SearchArea: 1
m_Folders: m_Folders:
- Assets/Scripts/Network - Assets/Scripts
m_Globs: [] m_Globs: []
m_OriginalText: m_OriginalText:
m_ViewMode: 1 m_ViewMode: 1
m_StartGridSize: 64 m_StartGridSize: 64
m_LastFolders: m_LastFolders:
- Assets/Scripts/Network - Assets/Scripts
m_LastFoldersGridSize: -1 m_LastFoldersGridSize: -1
m_LastProjectPath: /home/tom/Documents/dev/zarodolgozat/ColorRunner m_LastProjectPath: C:\dev\zarodolgozat\ColorBall
m_LockTracker: m_LockTracker:
m_IsLocked: 0 m_IsLocked: 0
m_FolderTreeState: m_FolderTreeState:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: 80670000 m_SelectedIDs: 54650000
m_LastClickedID: 26496 m_LastClickedID: 25940
m_ExpandedIDs: 000000004c59000000ca9a3b m_ExpandedIDs: 0000000046650000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@@ -781,7 +781,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0} scrollPos: {x: 0, y: 0}
m_SelectedIDs: m_SelectedIDs:
m_LastClickedID: 0 m_LastClickedID: 0
m_ExpandedIDs: 000000004c59000000ca9a3b m_ExpandedIDs: 0000000046650000
m_RenameOverlay: m_RenameOverlay:
m_UserAcceptedRename: 0 m_UserAcceptedRename: 0
m_Name: m_Name:
@@ -825,7 +825,7 @@ MonoBehaviour:
m_IsRenaming: 0 m_IsRenaming: 0
m_OriginalEventType: 11 m_OriginalEventType: 11
m_IsRenamingFilename: 1 m_IsRenamingFilename: 1
m_ClientGUIView: {fileID: 0} m_ClientGUIView: {fileID: 11}
m_CreateAssetUtility: m_CreateAssetUtility:
m_EndAction: {fileID: 0} m_EndAction: {fileID: 0}
m_InstanceID: 0 m_InstanceID: 0
@@ -858,9 +858,9 @@ MonoBehaviour:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
y: 440 y: 623
width: 1019 width: 1433
height: 248 height: 376
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default
@@ -885,10 +885,10 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 1020 x: 1434
y: 86 y: 73
width: 345 width: 485
height: 602 height: 926
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default
@@ -926,10 +926,10 @@ MonoBehaviour:
m_Tooltip: m_Tooltip:
m_Pos: m_Pos:
serializedVersion: 2 serializedVersion: 2
x: 681 x: 957
y: 86 y: 73
width: 337 width: 475
height: 333 height: 529
m_ViewDataDictionary: {fileID: 0} m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas: m_OverlayCanvas:
m_LastAppliedPresetName: Default m_LastAppliedPresetName: Default
@@ -958,7 +958,7 @@ MonoBehaviour:
- UnityEditor.DeviceSimulation.ApplicationSettingsPlugin - UnityEditor.DeviceSimulation.ApplicationSettingsPlugin
pluginStates: pluginStates:
- '{}' - '{}'
scale: 11 scale: 19
fitToScreenEnabled: 1 fitToScreenEnabled: 1
rotationDegree: 0 rotationDegree: 0
highlightSafeAreaEnabled: 0 highlightSafeAreaEnabled: 0