destroy wall

This commit is contained in:
2023-03-09 14:07:44 +01:00
parent 07697c1d20
commit 75f08b031f
10 changed files with 451 additions and 106 deletions

View File

@@ -1,10 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class CoinCounter : MonoBehaviour
{
public ulong coin = 0; //szedje le db-bol a playerhez a coint
public TMP_Text coinCounterUI;
private DatabaseData dd;
@@ -17,9 +19,11 @@ public class CoinCounter : MonoBehaviour
public void AddCoin(ulong number){
coin += number;
coinCounterUI.text = coin.ToString();
}
public void RemoveCoin(ulong number){
coin -= number;
coinCounterUI.text = coin.ToString();
}
}

View File

@@ -0,0 +1,11 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DestroyObjects : MonoBehaviour
{
private void OnTriggerEnter(Collider other) {
Debug.Log("destroy wall trigger");
Destroy(other.gameObject);
}
}

View File

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

View File

@@ -42,11 +42,11 @@ public class GroundController : MonoBehaviour
}
//ellenorzi hogy torolheto e az object
foreach (var item in ground){
/*foreach (var item in ground){
if(CheckGroundToDestroy(item)){
Destroy(item);
}
}
}*/
//cs.SpawnCoin();
}

View File

@@ -17,7 +17,7 @@ public class PlayerController : MonoBehaviour
private Vector2 startTouchPosition; //erintes kezdo pozicio
private Vector2 endTouchPosition; //erintes vegpozicio
public ControllType activeControllType;
public ControllType activeControllType; //ezt kell atallitani hogy swipe-os vagy button-os legyen a mozgas
public Button leftButton;
public Button jumpButton;
@@ -31,7 +31,7 @@ public class PlayerController : MonoBehaviour
private void Awake() {
cc = FindObjectOfType<CameraController>(); //kamera vezerlo referencia
activeControllType = ControllType.Button;
activeControllType = ControllType.Swipe;
}
public void setControllType(ControllType controlltype){
@@ -86,25 +86,40 @@ public class PlayerController : MonoBehaviour
}
}else if(activeControllType == ControllType.Button){
jumpforce = 2;
leftButton.onClick.AddListener(goRight);
/*leftButton.onClick.AddListener(goRight);
jumpButton.onClick.AddListener(jump);
rightButton.onClick.AddListener(goLeft);
rightButton.onClick.AddListener(goLeft);*/
}
}
private void goLeft(){ //helyezze at a jatekos objektumot a balra levo savba
if(rb.transform.position.x >= 2.5f) return; //ne tudjon kimenni a savbol
cc.xPostion = -3; //kamera xPozicioja
rb.transform.position = new Vector3(rb.transform.position.x + sideMovement, rb.transform.position.y, rb.transform.position.z);
}
private void goRight(){ //helyezze at a jatekos objektumot a jobbra levo savba
public void goLeft(){ //helyezze at a jatekos objektumot a balra levo savba
Debug.Log("kattintva bal");
if(rb.transform.position.x <= -2.5f) return; //ne tudjon kimenni a savbol
cc.xPostion = 3; //kamera xPozicioja
rb.transform.position = new Vector3(rb.transform.position.x - sideMovement, rb.transform.position.y, rb.transform.position.z);
//cc.xPostion = -3; //kamera xPozicioja
//rb.transform.position = new Vector3(rb.transform.position.x - sideMovement, rb.transform.position.y, rb.transform.position.z);
if(rb.transform.position.x >= 2.5f){
rb.transform.position = new Vector3(0, rb.transform.position.y, rb.transform.position.z);
}else if(rb.transform.position.x >= -2.5f){
rb.transform.position = new Vector3(-3f, rb.transform.position.y, rb.transform.position.z);
}
}
private void jump(){
public void goRight(){ //helyezze at a jatekos objektumot a jobbra levo savba
Debug.Log("kattintva jobb");
if(rb.transform.position.x >= 2.5f) return; //ne tudjon kimenni a savbol
//cc.xPostion = 3; //kamera xPozicioja
//rb.transform.position = new Vector3(rb.transform.position.x + sideMovement, rb.transform.position.y, rb.transform.position.z);
if(rb.transform.position.x <= -2.5f){
rb.transform.position = new Vector3(0, rb.transform.position.y, rb.transform.position.z);
}else if(rb.transform.position.x >= -2.5f){
rb.transform.position = new Vector3(3f, rb.transform.position.y, rb.transform.position.z);
}
}
public void jump(){
Debug.Log("jumped");
rb.AddForce(new Vector3(0, jumpforce, 0)); //ugras
}
}