Squashed commit of the following:

commit 1e4ffae4f6
Author: bance <90307762+bance23@users.noreply.github.com>
Date:   Sat May 13 14:23:47 2023 +0200

    proba athozas

    veszelyes

commit 0297a2cb78
Merge: 604088e 31b9214
Author: bance <90307762+bance23@users.noreply.github.com>
Date:   Sat May 13 14:09:48 2023 +0200

    Merge branch 'master' of https://github.com/playmaker1210/PuzzleColorBall

commit 31b9214f35
Merge: 184d2e8 89976bb
Author: Playmaker1210 <hatvanitamas09@gmail.com>
Date:   Mon May 8 14:42:34 2023 +0200

    Merge https://github.com/playmaker1210/PuzzleColorBall

commit 184d2e84da
Author: Playmaker1210 <hatvanitamas09@gmail.com>
Date:   Mon May 8 14:41:59 2023 +0200

    server mukodik

commit 89976bbcf8
Author: playmaker1210 <75033623+playmaker1210@users.noreply.github.com>
Date:   Fri May 5 12:49:28 2023 +0200

    Update README.md

commit 250cc0ffee
Author: playmaker1210 <75033623+playmaker1210@users.noreply.github.com>
Date:   Fri May 5 12:49:01 2023 +0200

    Create README.md

commit 2f0ae77e35
Author: playmaker1210 <hatvanitamas09@gmail.com>
Date:   Thu May 4 12:56:56 2023 +0200

    update

commit b94c80b293
Author: Playmaker1210 <hatvanitamas09@gmail.com>
Date:   Tue May 2 13:46:38 2023 +0200

    coin db working

commit 25d792e0fd
Author: playmaker1210 <hatvanitamas09@gmail.com>
Date:   Sat Apr 29 17:07:23 2023 +0200

    update
This commit is contained in:
bance
2023-05-13 15:09:38 +02:00
parent 1f8734a95e
commit 62354dc7b9
25 changed files with 6996 additions and 482 deletions

View File

@@ -1,46 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2758277150226478847
MonoBehaviour:
m_ObjectHideFlags: 2
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 179fc3111e144bc4688dca4038b3265d, type: 3}
m_Name: Android Settings
m_EditorClassIdentifier:
m_LoaderManagerInstance: {fileID: 7951869756074961481}
m_InitManagerOnStart: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 2
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cb0ece14d1f711a4fb9325ca819dee95, type: 3}
m_Name: AdaptivePerformanceGeneralSettings
m_EditorClassIdentifier:
Keys: 07000000
Values:
- {fileID: -2758277150226478847}
--- !u!114 &7951869756074961481
MonoBehaviour:
m_ObjectHideFlags: 2
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 536372c49e1ca914d822849d36de938c, type: 3}
m_Name: Android Providers
m_EditorClassIdentifier:
m_AutomaticLoading: 0
m_AutomaticRunning: 0
m_Loaders: []

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e470b0a1c0a80ec4eada7630c914d271
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f7d59f7a63599f64b8baffe0fe2e8eac
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,315 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 2
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b592865877cb54284a5d1d88aec9cfbb, type: 3}
m_Name: Simulator Provider Settings
m_EditorClassIdentifier:
m_Logging: 1
m_AutomaticPerformanceModeEnabled: 1
m_EnableBoostOnStartup: 1
m_StatsLoggingFrequencyInFrames: 50
m_IndexerSettings:
m_Active: 1
m_ThermalActionDelay: 10
m_PerformanceActionDelay: 4
m_ScalerSettings:
m_AdaptiveFramerate:
m_Name: Adaptive Framerate
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 2
m_Target: 7
m_MaxLevel: 45
m_MinBound: 15
m_MaxBound: 60
m_AdaptiveResolution:
m_Name: Adaptive Resolution
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 0
m_Target: 6
m_MaxLevel: 9
m_MinBound: 0.5
m_MaxBound: 1
m_AdaptiveBatching:
m_Name: Adaptive Batching
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 1
m_MaxLevel: 1
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveLOD:
m_Name: Adaptive LOD
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 2
m_Target: 2
m_MaxLevel: 3
m_MinBound: 0.4
m_MaxBound: 1
m_AdaptiveLut:
m_Name: Adaptive Lut
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 3
m_MaxLevel: 1
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveMSAA:
m_Name: Adaptive MSAA
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 6
m_MaxLevel: 2
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveShadowCascade:
m_Name: Adaptive Shadow Cascade
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 3
m_MaxLevel: 2
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveShadowDistance:
m_Name: Adaptive Shadow Distance
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 0
m_Target: 2
m_MaxLevel: 3
m_MinBound: 0.15
m_MaxBound: 1
m_AdaptiveShadowmapResolution:
m_Name: Adaptive Shadowmap Resolution
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 0
m_Target: 2
m_MaxLevel: 3
m_MinBound: 0.15
m_MaxBound: 1
m_AdaptiveShadowQuality:
m_Name: Adaptive Shadow Quality
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 2
m_Target: 3
m_MaxLevel: 3
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveSorting:
m_Name: Adaptive Sorting
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 1
m_MaxLevel: 1
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveTransparency:
m_Name: Adaptive Transparency
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 2
m_Target: 2
m_MaxLevel: 1
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveViewDistance:
m_Name: Adaptive View Distance
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 2
m_Target: 2
m_MaxLevel: 40
m_MinBound: 50
m_MaxBound: 1000
m_AdaptivePhysics:
m_Name: Adaptive Physics
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 0
m_Target: 1
m_MaxLevel: 5
m_MinBound: 0.5
m_MaxBound: 1
m_AdaptiveDecals:
m_Name: Adaptive Decals
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 2
m_MaxLevel: 20
m_MinBound: 0.01
m_MaxBound: 1
m_AdaptiveLayerCulling:
m_Name: Adaptive Layer Culling
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 1
m_MaxLevel: 40
m_MinBound: 0.01
m_MaxBound: 1
m_scalerProfileList:
- m_AdaptiveFramerate:
m_Name: Adaptive Framerate
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 2
m_Target: 7
m_MaxLevel: 45
m_MinBound: 15
m_MaxBound: 60
m_AdaptiveResolution:
m_Name: Adaptive Resolution
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 0
m_Target: 6
m_MaxLevel: 9
m_MinBound: 0.5
m_MaxBound: 1
m_AdaptiveBatching:
m_Name: Adaptive Batching
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 1
m_MaxLevel: 1
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveLOD:
m_Name: Adaptive LOD
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 2
m_Target: 2
m_MaxLevel: 3
m_MinBound: 0.4
m_MaxBound: 1
m_AdaptiveLut:
m_Name: Adaptive Lut
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 3
m_MaxLevel: 1
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveMSAA:
m_Name: Adaptive MSAA
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 6
m_MaxLevel: 2
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveShadowCascade:
m_Name: Adaptive Shadow Cascade
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 3
m_MaxLevel: 2
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveShadowDistance:
m_Name: Adaptive Shadow Distance
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 0
m_Target: 2
m_MaxLevel: 3
m_MinBound: 0.15
m_MaxBound: 1
m_AdaptiveShadowmapResolution:
m_Name: Adaptive Shadowmap Resolution
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 0
m_Target: 2
m_MaxLevel: 3
m_MinBound: 0.15
m_MaxBound: 1
m_AdaptiveShadowQuality:
m_Name: Adaptive Shadow Quality
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 2
m_Target: 3
m_MaxLevel: 3
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveSorting:
m_Name: Adaptive Sorting
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 1
m_MaxLevel: 1
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveTransparency:
m_Name: Adaptive Transparency
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 2
m_Target: 2
m_MaxLevel: 1
m_MinBound: 0
m_MaxBound: 1
m_AdaptiveViewDistance:
m_Name: Adaptive View Distance
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 2
m_Target: 2
m_MaxLevel: 40
m_MinBound: 50
m_MaxBound: 1000
m_AdaptivePhysics:
m_Name: Adaptive Physics
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 0
m_Target: 1
m_MaxLevel: 5
m_MinBound: 0.5
m_MaxBound: 1
m_AdaptiveDecals:
m_Name: Adaptive Decals
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 2
m_MaxLevel: 20
m_MinBound: 0.01
m_MaxBound: 1
m_AdaptiveLayerCulling:
m_Name: Adaptive Layer Culling
m_Enabled: 0
m_Scale: 1
m_VisualImpact: 1
m_Target: 1
m_MaxLevel: 40
m_MinBound: 0.01
m_MaxBound: 1
m_Name: Default Scaler Profile
m_DefaultScalerProfilerIndex: 0
k_AssetVersion: 2

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 15f99888c21c02c46b338a1aebdfe4de
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,6 +1,11 @@
fileFormatVersion: 2 fileFormatVersion: 2
<<<<<<<< HEAD:Assets/Resources/Models/Map objects/module3.mat.meta
guid: a165a068343ef47108ec4332d0bdc767 guid: a165a068343ef47108ec4332d0bdc767
NativeFormatImporter: NativeFormatImporter:
========
guid: 801674bb4f54353d3966591ac2876a92
PrefabImporter:
>>>>>>>> master:Assets/Resources/Prefabs/WorldObjects/World1/haz1.prefab.meta
externalObjects: {} externalObjects: {}
mainObjectFileID: 2100000 mainObjectFileID: 2100000
userData: userData:

View File

@@ -1,6 +1,12 @@
fileFormatVersion: 2 fileFormatVersion: 2
<<<<<<<< HEAD:Assets/Resources/Prefabs/Modulok/module3.prefab.meta
guid: 9a7886f1d68cf4230b9a1182099be3d2 guid: 9a7886f1d68cf4230b9a1182099be3d2
PrefabImporter: PrefabImporter:
========
guid: 7fd43fea6e592be348af51e93185cf90
folderAsset: yes
DefaultImporter:
>>>>>>>> master:Assets/Resources/Prefabs/WorldObjects/World1.meta
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
<<<<<<<< HEAD:Assets/Resources/Textures.meta
guid: ecce4db6af60044069923c10009f1f24
========
guid: 45f19baf5179cf745ba619186f664b9e
>>>>>>>> master:Assets/Resources/Prefabs/WorldObjects.meta
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
<<<<<<<< HEAD:Assets/Resources/Prefabs/Modulok/module3.prefab.meta
guid: 9a7886f1d68cf4230b9a1182099be3d2
PrefabImporter:
========
guid: 7fd43fea6e592be348af51e93185cf90
folderAsset: yes
DefaultImporter:
>>>>>>>> master:Assets/Resources/Prefabs/WorldObjects/World1.meta
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
<<<<<<<< HEAD:Assets/Resources/Models/Map objects/module3.mat.meta
guid: a165a068343ef47108ec4332d0bdc767
NativeFormatImporter:
========
guid: 801674bb4f54353d3966591ac2876a92
PrefabImporter:
>>>>>>>> master:Assets/Resources/Prefabs/WorldObjects/World1/haz1.prefab.meta
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6b0a795f90d876744b921b3441c4a3ce guid: 8500f6075c56d47809b2a1e2dfb10d39
folderAsset: yes PrefabImporter:
DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:

View File

@@ -1,5 +1,9 @@
fileFormatVersion: 2 fileFormatVersion: 2
<<<<<<<< HEAD:Assets/Resources/Textures.meta
guid: ecce4db6af60044069923c10009f1f24 guid: ecce4db6af60044069923c10009f1f24
========
guid: 45f19baf5179cf745ba619186f664b9e
>>>>>>>> master:Assets/Resources/Prefabs/WorldObjects.meta
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@@ -7,16 +7,20 @@ using System.Text;
public class CoinCounter : MonoBehaviour public class CoinCounter : MonoBehaviour
{ {
public ulong coin = ulong.MaxValue; //szedje le db-bol a playerhez a coint public ulong coin; //szedje le db-bol a playerhez a coint
public TMP_Text coinCounterUI; public TMP_Text coinCounterUI;
private string path; private string path;
private StreamWriter writer; private StreamWriter writer;
private StreamReader reader; private StreamReader reader;
private DatabaseData db; private DatabaseData db;
private UsernameHandler usernameHandler;
private void Awake() { private void Awake() {
db = FindObjectOfType<DatabaseData>(); db = FindObjectOfType<DatabaseData>();
usernameHandler = FindObjectOfType<UsernameHandler>();
/*path = Application.persistentDataPath + "/coins.txt"; /*path = Application.persistentDataPath + "/coins.txt";
if(!File.Exists(path)){ //ha nincs meg ilyen fajl hozza letre if(!File.Exists(path)){ //ha nincs meg ilyen fajl hozza letre
@@ -37,6 +41,10 @@ public class CoinCounter : MonoBehaviour
coinCounterUI.text = "Coins: " + coin.ToString();*/ coinCounterUI.text = "Coins: " + coin.ToString();*/
} }
public void SetCoin(ulong number){
coin = number;
coinCounterUI.text = "Coins: " + coin.ToString();
}
public void AddCoin(ulong number){ public void AddCoin(ulong number){
coin += number; coin += number;
@@ -49,7 +57,7 @@ public class CoinCounter : MonoBehaviour
public void RemoveCoin(ulong number){ public void RemoveCoin(ulong number){
coin -= number; coin -= number;
//coinCounterUI.text = "Coins: " + coin.ToString(); coinCounterUI.text = "Coins: " + coin.ToString();
/*writer = new StreamWriter(path, false, Encoding.Default); /*writer = new StreamWriter(path, false, Encoding.Default);
writer.Write(coin); writer.Write(coin);

View File

@@ -1,51 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
public enum Colors {
None = -1,
Grey,
Red,
Blue,
Green,
Yellow,
Rainbow
};
public class ColorManager : MonoBehaviour
{
public Material[] colorMaterials = new Material[Enum.GetNames(typeof(Colors)).Length];
public void WashColor(GameObject washed) {
SetColor(Colors.Grey, washed);
}
public void SetColor(Colors color, GameObject toPaint, Collision collision = null) {
if(color == Colors.None) {
if (collision.transform.CompareTag("ColorChanger")) {
toPaint.GetComponent<Renderer>().material.color = collision.transform.GetComponent<Renderer>().material.color;
}
} else {
toPaint.GetComponent<Renderer>().material.color = colorMaterials[(int)color].color;
}
}
public void CheckGroundColor(GameObject collided) {
if (transform.GetComponent<Renderer>().material.color != collided.transform.GetComponent<Renderer>().material.color) {
Debug.Log("The colors are not the same! GroundColor: " + collided.transform.GetComponent<Renderer>().material.color + " PlayerColor: "
+ transform.GetComponent<Renderer>().material.color);
}
}
private void OnCollisionEnter(Collision collision) {
if (collision.collider.CompareTag("Water")) {
WashColor(collision.gameObject);
} else if (collision.collider.CompareTag("Ground")) {
CheckGroundColor(collision.gameObject);
} else if (collision.collider.CompareTag("ColorChanger")) {
SetColor(Colors.None, transform.gameObject, collision);
}
}
}

View File

@@ -7,9 +7,11 @@ public class GroundController : MonoBehaviour
private GameObject[] ground; private GameObject[] ground;
public GameObject[] loadFrom; public GameObject[] loadFrom;
public GameObject[] sideObjects; public GameObject[] sideObjects;
public GameObject[] sideObjectsSpawned;
public Material[] materials; public Material[] materials;
public int materialIndex = 0; public int materialIndex = 0;
public float groundMoveSpeed = 10f; public float groundMoveSpeed = 10f;
private Vector3 lastSideObjectPos = new Vector3(0,0,0);
//private CollectibleSpawner cs; //private CollectibleSpawner cs;
@@ -18,7 +20,7 @@ public class GroundController : MonoBehaviour
//Loading modules //Loading modules
loadFrom = LoadPrefabs("Prefabs/Modulok"); loadFrom = LoadPrefabs("Prefabs/Modulok");
sideObjects = LoadPrefabs("Models/World Objects/World 1"); sideObjects = LoadPrefabs("Prefabs/WorldObjects/World1/");
Debug.Log("loadFrom length: " + loadFrom.Length); Debug.Log("loadFrom length: " + loadFrom.Length);
Debug.Log("sideObjects Length: " + sideObjects.Length); Debug.Log("sideObjects Length: " + sideObjects.Length);
@@ -33,15 +35,27 @@ public class GroundController : MonoBehaviour
private void Update() { private void Update() {
ground = GameObject.FindGameObjectsWithTag("Ground"); //torles miatt ujra le kell kerni a ground objecteket ground = GameObject.FindGameObjectsWithTag("Ground"); //torles miatt ujra le kell kerni a ground objecteket
OrderGroundArrayByZ(); //rendezzuk z szerint hogy sorba legyenek sideObjectsSpawned = GameObject.FindGameObjectsWithTag("SideObject");
OrderArrayByZ(ground); //rendezzuk z szerint a talajt
OrderArrayByZ(sideObjectsSpawned);
if(sideObjectsSpawned.Length > 0){
lastSideObjectPos = sideObjectsSpawned[sideObjectsSpawned.Length-1].transform.position;
}
for (int i = 0; i < ground.Length; i++){ //ground objecteket mozgatja for (int i = 0; i < ground.Length; i++){ //ground objecteket mozgatja
ground[i].transform.position = ground[i].transform.position + new Vector3(0,0, -groundMoveSpeed * Time.deltaTime); ground[i].transform.position = ground[i].transform.position + new Vector3(0,0, -groundMoveSpeed * Time.deltaTime);
} }
for(int i = 0; i < sideObjectsSpawned.Length; i++){
sideObjectsSpawned[i].transform.position = sideObjectsSpawned[i].transform.position + new Vector3(0,0, -groundMoveSpeed * Time.deltaTime);
}
//uj ground letrehozas //uj ground letrehozas
if(ground[ground.Length-1].transform.position.z <= 120){ if(ground[ground.Length-1].transform.position.z <= 120){
CreateNewGround(); CreateNewGround();
CreateNewSideObjects(false);
ground = GameObject.FindGameObjectsWithTag("Ground"); ground = GameObject.FindGameObjectsWithTag("Ground");
@@ -79,6 +93,23 @@ public class GroundController : MonoBehaviour
return arr; return arr;
} }
private void CreateNewSideObjects(bool isLeftSide){
int random = UnityEngine.Random.Range(0, sideObjects.Length);
GameObject inst = sideObjects[random];
Vector3 pos = new Vector3(0,0,0);
if(inst.name == "haz1" && !isLeftSide){
pos = new Vector3(4,0,0); //check pos in editor TODO!!
}else if(inst.name == "haz2"){
pos = new Vector3(9,0,0);
}
if(isLeftSide) pos.x = -pos.x;
Instantiate(inst, lastSideObjectPos + pos, ground[0].transform.rotation);
}
public void changeMaterialIndex(){ public void changeMaterialIndex(){
int materialteszt; int materialteszt;
@@ -113,14 +144,14 @@ public class GroundController : MonoBehaviour
return false; //nem torolheto return false; //nem torolheto
} }
private void OrderGroundArrayByZ(){ private void OrderArrayByZ(GameObject[] array){
GameObject csere; GameObject csere;
for (int i = 0; i < ground.Length; i++){ for (int i = 0; i < array.Length; i++){
for(int j = 0; j < i; j++){ for(int j = 0; j < i; j++){
if(ground[j].transform.position.z > ground[j+1].transform.position.z){ if(array[j].transform.position.z > array[j+1].transform.position.z){
csere = ground[j]; csere = array[j];
ground[j] = ground[j+1]; array[j] = array[j+1];
ground[j+1] = csere; array[j+1] = csere;
} }
} }
} }

View File

@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class IsGrounded : MonoBehaviour
{
public bool isGrounded = true;
private void OnCollisionEnter(Collision other) {
//Debug.Log("pc <color=blue>"+other.gameObject.name+"</color>");
isGrounded = true;
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ab4fe611c9713254e9fcc6e0de77f87f guid: 434812251bf6e1f44a54fa63754df2af
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@@ -21,17 +21,38 @@ public class DatabaseData : MonoBehaviour
public ulong coins = 0; public ulong coins = 0;
private bool forceLocalUrl = true;
private const int PORT = 24002;
#if UNITY_EDITOR || UNITY_EDITOR_64
private string url = "localhost:" + PORT.ToString();
#else
private string url = "nodejs.dszcbaross.edu.hu:" + PORT.ToString();
#endif
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
coinc = FindObjectOfType<CoinCounter>(); coinc = FindObjectOfType<CoinCounter>();
//writer = new StreamWriter(Application.persistentDataPath + "/coins.txt", false, Encoding.Default); //writer = new StreamWriter(Application.persistentDataPath + "/coins.txt", false, Encoding.Default);
/*if((Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.LinuxEditor || Application.platform == RuntimePlatform.OSXEditor) && forceLocalUrl){
//ha az editorba van
url = "http://localhost:" + PORT.ToString();
}else if(!forceLocalUrl){
url = "nodejs.dszcbaross.edu.hu:" + PORT.ToString();
}else{
url = "nodejs.dszcbaross.edu.hu:" + PORT.ToString();
}*/
url = "nodejs.dszcbaross.edu.hu:" + PORT.ToString();
Debug.Log("<color=pink>url: </color>" + url);
} }
private void Start() { private void Start() {
GetHighScoreData(); GetHighScoreData(); //highscore scenehez
//StartCoroutine(GetCoinData(1));
} }
public void jsonParser(string jsondata) { //beerkezo json adat eltarolasa public void jsonParser(string jsondata) { //beerkezo json adat eltarolasa
@@ -44,6 +65,7 @@ public class DatabaseData : MonoBehaviour
} }
public void ParserCoin(string jsondata){ public void ParserCoin(string jsondata){
//Debug.Log("<color=orange>JsonDataCoin:" + jsondata + "</color>");
string data = ""; string data = "";
for (int i = 0; i < jsondata.Length; i++) for (int i = 0; i < jsondata.Length; i++)
{ {
@@ -51,8 +73,10 @@ public class DatabaseData : MonoBehaviour
data += jsondata[i]; //kiszedi a szamokat a stringbol data += jsondata[i]; //kiszedi a szamokat a stringbol
} }
} }
Debug.Log(data); Debug.Log("data coin: " + data);
coins = ulong.Parse(data); coins = ulong.Parse(data);
Debug.Log("<color=orange>db coins: " + coins + "</color>");
coinc.SetCoin(coins);
} }
//fuggvenyek amik meghivjak a rutint //fuggvenyek amik meghivjak a rutint
@@ -62,14 +86,19 @@ public class DatabaseData : MonoBehaviour
public void PostNewScoreData(int playerid, ulong score, string time) => StartCoroutine(IPostNewScoreData(playerid, score, time)); public void PostNewScoreData(int playerid, ulong score, string time) => StartCoroutine(IPostNewScoreData(playerid, score, time));
public void PostNewPalyaData() => StartCoroutine(IPostNewPalyaData()); public void PostNewPalyaData() => StartCoroutine(IPostNewPalyaData());
public void GetCoinDataCall(int userid) => StartCoroutine(GetCoinData(userid));
public void PostNewCoinData(ulong coins, int userid) => StartCoroutine(IPostNewCoinData(coins, userid));
public ulong GetCoins(int userid){ public ulong GetCoins(int userid){
StartCoroutine(GetCoinData(userid)); StartCoroutine(GetCoinData(userid));
Debug.Log("<color=orange> Return coin: " + coins + "</color>");
return coins; return coins;
} }
private IEnumerator GetCoinData(int userid){ private IEnumerator GetCoinData(int userid){
string uri = "http://localhost:3000/coinget"; string uri = url + "/coinget";
var uwr = new UnityWebRequest(uri, "GET"); var uwr = new UnityWebRequest(uri, "GET");
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+userid+"}"); byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+userid+"}");
@@ -92,7 +121,7 @@ public class DatabaseData : MonoBehaviour
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
string uri = "http://localhost:3000/player"; //backend vegpont linkje string uri = url + "/player"; //backend vegpont linkje
using (UnityWebRequest request = UnityWebRequest.Get(uri)) { //uj webrequest objektum letrehozasa, aminek megadjuk hogy ez egy get-es lekerdezes using (UnityWebRequest request = UnityWebRequest.Get(uri)) { //uj webrequest objektum letrehozasa, aminek megadjuk hogy ez egy get-es lekerdezes
yield return request.SendWebRequest(); //amig be nem fejezodik az fv ide fog visszaterni yield return request.SendWebRequest(); //amig be nem fejezodik az fv ide fog visszaterni
@@ -120,7 +149,7 @@ public class DatabaseData : MonoBehaviour
private IEnumerator IGetCurretPlayer(int userid){ private IEnumerator IGetCurretPlayer(int userid){
string uri = "http://localhost:3000/currentplayer"; string uri = url + "/currentplayer";
var uwr = new UnityWebRequest(uri, "POST"); var uwr = new UnityWebRequest(uri, "POST");
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+userid+"}"); //palya id megadasa byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+userid+"}"); //palya id megadasa
@@ -144,7 +173,7 @@ public class DatabaseData : MonoBehaviour
} }
private IEnumerator IGetHighScoreData(){ private IEnumerator IGetHighScoreData(){
string uri = "http://localhost:3000/toplist"; string uri = url + "/toplist";
var uwr = new UnityWebRequest(uri, "GET"); var uwr = new UnityWebRequest(uri, "GET");
//byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+palya_id+"}"); //palya id megadasa //byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+palya_id+"}"); //palya id megadasa
@@ -167,7 +196,7 @@ public class DatabaseData : MonoBehaviour
private IEnumerator IGetHighScoreDataNew(){ private IEnumerator IGetHighScoreDataNew(){
string uri = "http://localhost:3000/toplist"; string uri = url + "/toplist";
var uwr = new UnityWebRequest(uri, "GET"); var uwr = new UnityWebRequest(uri, "GET");
uwr.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); uwr.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
@@ -188,7 +217,7 @@ public class DatabaseData : MonoBehaviour
private IEnumerator IGetPlayerCoins(string username){ private IEnumerator IGetPlayerCoins(string username){
string uri = "http://localhost:3000/coinget"; string uri = url + "/coinget";
var uwr = new UnityWebRequest(uri, "POST"); var uwr = new UnityWebRequest(uri, "POST");
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+username+"}"); //palya id megadasa byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+username+"}"); //palya id megadasa
@@ -211,7 +240,7 @@ public class DatabaseData : MonoBehaviour
private IEnumerator IPostNewPlayerData() { private IEnumerator IPostNewPlayerData() {
//input.text = "loading..."; //input.text = "loading...";
string uri = "http://localhost:3000/newplayer"; string uri = url + "/newplayer";
var uwr = new UnityWebRequest(uri, "POST"); //post beallitasa var uwr = new UnityWebRequest(uri, "POST"); //post beallitasa
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{ \"bevitel1\":\"postusername\"}"); //felviteli json byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{ \"bevitel1\":\"postusername\"}"); //felviteli json
@@ -232,7 +261,7 @@ public class DatabaseData : MonoBehaviour
private IEnumerator IPostNewScoreData(int playerid, ulong score, string time) { private IEnumerator IPostNewScoreData(int playerid, ulong score, string time) {
//input.text = "loading..."; //input.text = "loading...";
string uri = "http://localhost:3000/newscore"; string uri = url + "/newscore";
//felhasznalonevet ki kell irni fajlba //felhasznalonevet ki kell irni fajlba
//ha username keresve lenne es ha nincs akkor kap egy uj id-t ami ideiglenesen tarolodik (ures string a visszateres?) //ha username keresve lenne es ha nincs akkor kap egy uj id-t ami ideiglenesen tarolodik (ures string a visszateres?)
@@ -261,7 +290,7 @@ public class DatabaseData : MonoBehaviour
private IEnumerator IPostNewPalyaData() { private IEnumerator IPostNewPalyaData() {
//input.text = "loading..."; //input.text = "loading...";
string uri = "http://localhost:3000/newpalya"; string uri = url + "/newpalya";
var uwr = new UnityWebRequest(uri, "POST"); var uwr = new UnityWebRequest(uri, "POST");
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{ \"bevitel1\":\"Easy3\"}"); byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{ \"bevitel1\":\"Easy3\"}");
@@ -271,6 +300,25 @@ public class DatabaseData : MonoBehaviour
yield return uwr.SendWebRequest(); yield return uwr.SendWebRequest();
if (uwr.isNetworkError) {
Debug.Log(uwr.error);
} else {
//input.text = uwr.downloadHandler.text;
Debug.Log(uwr.downloadHandler.text);
}
}
private IEnumerator IPostNewCoinData(ulong coins, int userid) {
string uri = url + "/coinUpdate";
var uwr = new UnityWebRequest(uri, "POST");
byte[] jsonToSend = new System.Text.UTF8Encoding().GetBytes("{\"bevitel1\":"+coins+",\"bevitel2\":"+userid+"}");
uwr.uploadHandler = (UploadHandler)new UploadHandlerRaw(jsonToSend);
uwr.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
uwr.SetRequestHeader("Content-Type", "application/json");
yield return uwr.SendWebRequest();
if (uwr.isNetworkError) { if (uwr.isNetworkError) {
Debug.Log(uwr.error); Debug.Log(uwr.error);
} else { } else {

View File

@@ -7,6 +7,8 @@ public class PlayerController : MonoBehaviour
{ {
public Rigidbody rb; //jatekos teste public Rigidbody rb; //jatekos teste
private CameraController cc; private CameraController cc;
private IsGrounded isGrounded;
public float jumpforce = 5f; //mekkorat tudjon ugorni public float jumpforce = 5f; //mekkorat tudjon ugorni
private float sideMovement = 3f; //oldalra mennyit mozogjon private float sideMovement = 3f; //oldalra mennyit mozogjon
private Vector3 direction; //jatkos pozicio private Vector3 direction; //jatkos pozicio
@@ -17,13 +19,13 @@ 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; //ezt kell atallitani hogy swipe-os vagy button-os legyen a mozgas public ControlType activeControllType; //ezt kell atallitani hogy swipe-os vagy button-os legyen a mozgas
public Button leftButton; public Button leftButton;
public Button jumpButton; public Button jumpButton;
public Button rightButton; public Button rightButton;
public enum ControllType public enum ControlType
{ {
Swipe, Swipe,
Button Button
@@ -31,16 +33,18 @@ public class PlayerController : MonoBehaviour
private void Awake() { private void Awake() {
cc = FindObjectOfType<CameraController>(); //kamera vezerlo referencia cc = FindObjectOfType<CameraController>(); //kamera vezerlo referencia
activeControllType = ControllType.Button; isGrounded = FindObjectOfType<IsGrounded>();
//activeControllType = ControlType.Button;
} }
public void setControllType(ControllType controlltype){ public void setControllType(ControlType controlltype){
activeControllType = controlltype; activeControllType = controlltype;
} }
private void Update(){ private void Update(){
if(activeControllType == ControllType.Swipe){ if(activeControllType == ControlType.Swipe){
leftButton.gameObject.SetActive(false); leftButton.gameObject.SetActive(false);
jumpButton.gameObject.SetActive(false); jumpButton.gameObject.SetActive(false);
rightButton.gameObject.SetActive(false); rightButton.gameObject.SetActive(false);
@@ -59,7 +63,7 @@ public class PlayerController : MonoBehaviour
timeSinceLastTap = 0f; timeSinceLastTap = 0f;
} }
if(isTapped && rb.transform.position.y <= 0.16f){ if(isTapped && isGrounded.isGrounded){
if(Time.time - timeSinceLastTap >= holdTime){ //ha nyomva tartotta a beallitott ideig if(Time.time - timeSinceLastTap >= holdTime){ //ha nyomva tartotta a beallitott ideig
Debug.Log("Long tapped"); Debug.Log("Long tapped");
jump(); jump();
@@ -84,7 +88,7 @@ public class PlayerController : MonoBehaviour
goRight(); goRight();
} }
} }
}else if(activeControllType == ControllType.Button){ }else if(activeControllType == ControlType.Button){
//jumpforce = 100; //jumpforce = 100;
/*leftButton.onClick.AddListener(goRight); /*leftButton.onClick.AddListener(goRight);
jumpButton.onClick.AddListener(jump); jumpButton.onClick.AddListener(jump);
@@ -119,9 +123,13 @@ public class PlayerController : MonoBehaviour
} }
public void jump(){ public void jump(){
if(rb.transform.position.y <= 0.16f) if(isGrounded.isGrounded){
rb.AddForce(new Vector3(0, jumpforce, 0)); //ugras rb.AddForce(new Vector3(0, jumpforce, 0)); //ugras
isGrounded.isGrounded = false;
}
Debug.Log("jumped"); Debug.Log("jumped");
} }
} }

View File

@@ -19,11 +19,13 @@ public class UsernameHandler : MonoBehaviour
private StreamReader reader; private StreamReader reader;
private DatabaseData db; private DatabaseData db;
private PlayerList playerList; private PlayerList playerList;
private CoinCounter cc;
private void Awake() { private void Awake() {
input.gameObject.SetActive(false); input.gameObject.SetActive(false);
inputBackground.SetActive(false); inputBackground.SetActive(false);
path = Application.persistentDataPath + "/username.txt"; path = Application.persistentDataPath + "/username.txt";
cc = FindObjectOfType<CoinCounter>();
db = FindObjectOfType<DatabaseData>(); db = FindObjectOfType<DatabaseData>();
db.GetPlayerData(); db.GetPlayerData();
} }
@@ -54,6 +56,8 @@ public class UsernameHandler : MonoBehaviour
userid = item.player_id; userid = item.player_id;
} }
} }
db.GetCoinDataCall(userid);
} }
private void usernameCheck(){ private void usernameCheck(){
@@ -85,7 +89,11 @@ public class UsernameHandler : MonoBehaviour
username = data; username = data;
Debug.Log("username: " + username); Debug.Log("username: " + username);
getId(); getId();
//StartCoroutine(waitForCoins());
input.gameObject.SetActive(false); input.gameObject.SetActive(false);
inputBackground.SetActive(false); inputBackground.SetActive(false);
@@ -93,4 +101,11 @@ public class UsernameHandler : MonoBehaviour
} }
} }
} }
private IEnumerator waitForCoins(){
yield return new WaitUntil(() => db.coins != 0);
cc.SetCoin(db.GetCoins(userid));
Debug.Log("uh coin"+cc.coin);
}
} }

View File

@@ -34,6 +34,7 @@ public class jatekmanager : MonoBehaviour
private UsernameHandler usernameHandler; private UsernameHandler usernameHandler;
private Score score; private Score score;
private Timer timer; private Timer timer;
private CoinCounter cc;
private void Awake() private void Awake()
{ {
@@ -44,6 +45,7 @@ public class jatekmanager : MonoBehaviour
usernameHandler = FindObjectOfType<UsernameHandler>(); usernameHandler = FindObjectOfType<UsernameHandler>();
score = FindObjectOfType<Score>(); score = FindObjectOfType<Score>();
timer = FindObjectOfType<Timer>(); timer = FindObjectOfType<Timer>();
cc = FindObjectOfType<CoinCounter>();
} }
private void Start() private void Start()
@@ -156,6 +158,7 @@ public class jatekmanager : MonoBehaviour
homeGomb.SetActive(false); homeGomb.SetActive(false);
settingsGomb.SetActive(false); settingsGomb.SetActive(false);
shopGomb.SetActive(false); shopGomb.SetActive(false);
playButton.SetActive(false);
UpdateGameState(GameState.Game); UpdateGameState(GameState.Game);
} }
@@ -167,15 +170,18 @@ public class jatekmanager : MonoBehaviour
private async void HandleGame() private async void HandleGame()
{ {
playButton.SetActive(false);
StartCoroutine(TimerGame()); StartCoroutine(TimerGame());
GetComponent <GroundController> ().enabled = true; GetComponent <GroundController> ().enabled = true;
GetComponent <PlayerController>().enabled = true; GetComponent <PlayerController>().enabled = true;
goLeftButton.SetActive(true); goLeftButton.SetActive(true);
jumpButton.SetActive(true); jumpButton.SetActive(true);
goRightButton.SetActive(true); goRightButton.SetActive(true);
scoreText.gameObject.SetActive(true); scoreText.gameObject.SetActive(true);
timerText.gameObject.SetActive(true); timerText.gameObject.SetActive(true);
playButton.SetActive(false);
timer.playTime.Start(); timer.playTime.Start();
} }
@@ -193,9 +199,11 @@ public class jatekmanager : MonoBehaviour
//toltse fel az adatokat a run-rol //toltse fel az adatokat a run-rol
db.PostNewScoreData(usernameHandler.userid, score.score, timer.convertTimeToString()); db.PostNewScoreData(usernameHandler.userid, score.score, timer.convertTimeToString());
//coin feltoltes
db.PostNewCoinData(cc.coin, usernameHandler.userid);
SceneUIManager.LoadScene(1); //HighScore scene SceneUIManager.LoadScene(1); //HighScore scene
//
/*playButton.SetActive(false); /*playButton.SetActive(false);
homeGomb.SetActive(true); homeGomb.SetActive(true);

9
README.md Normal file
View File

@@ -0,0 +1,9 @@
# PuzzleColorBall
Záródolgozat. Balogh Bence Benedekkel készítve.
A cél egy endless runner játék elkészítése Unityben C# használatával.
Backend repo link: https://github.com/bance23/zarobackend.git
Frontend link: https://github.com/bance23/zarofrontend.git

View File

@@ -6,17 +6,17 @@ EditorUserSettings:
serializedVersion: 4 serializedVersion: 4
m_ConfigSettings: m_ConfigSettings:
RecentlyUsedSceneGuid-0: RecentlyUsedSceneGuid-0:
value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a
flags: 0
RecentlyUsedSceneGuid-1:
value: 5401000201035c0f5d5e582648710644464f4f2f7a7d24607c2f1b36bab66468 value: 5401000201035c0f5d5e582648710644464f4f2f7a7d24607c2f1b36bab66468
flags: 0 flags: 0
RecentlyUsedSceneGuid-2: RecentlyUsedSceneGuid-1:
value: 5357075101505a0f5b5e0f7745740d4446161a7d79787035287f4a32b3e3303e value: 5357075101505a0f5b5e0f7745740d4446161a7d79787035287f4a32b3e3303e
flags: 0 flags: 0
RecentlyUsedSceneGuid-3: RecentlyUsedSceneGuid-2:
value: 5b55515706060d025a5f0d2043260744414f482c7e2b7263747d4a32b0b9313b value: 5b55515706060d025a5f0d2043260744414f482c7e2b7263747d4a32b0b9313b
flags: 0 flags: 0
RecentlyUsedSceneGuid-3:
value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a
flags: 0
RecentlyUsedSceneGuid-4: RecentlyUsedSceneGuid-4:
value: 51520d5f55010c0f085d5f7142770e424216487e7b2e2035752b4864b1e36d3d value: 51520d5f55010c0f085d5f7142770e424216487e7b2e2035752b4864b1e36d3d
flags: 0 flags: 0