ugynok rework

This commit is contained in:
2023-02-21 17:21:15 +01:00
parent aa638ee67c
commit 37d43ace38
6 changed files with 2436 additions and 345 deletions

View File

@@ -117,6 +117,7 @@ public class Dice : MonoBehaviour {
adrenalinMegerosites = true;
}else{
adrenalinMegerosites = false;
HelyszinKiBekapcs(false); //nem hasznalja fel ezert visszakapcsoljuk
}
adrenalinHasznalat.gameObject.SetActive(false);

View File

@@ -14,6 +14,7 @@ public class Targyak : MonoBehaviour
private Energia energia;
private Ugynok ugynok;
private Dice dice;
private jatekmanager jatekmanager;
public TMP_InputField kocka1ertek;
public TMP_InputField kocka2ertek;
public int ujertek1;
@@ -57,6 +58,7 @@ public class Targyak : MonoBehaviour
energia = FindObjectOfType<Energia>();
ugynok = FindObjectOfType<Ugynok>();
dice = FindObjectOfType<Dice>();
jatekmanager = FindObjectOfType<jatekmanager>();
}
public void RandomTargy()
@@ -198,9 +200,15 @@ public class Targyak : MonoBehaviour
lathatatlanFelhasznalva.text = "X";
}
public void DroidGepagyu() { //kesz
//ugynok cucc
ugynok.canKill = true; //barhol meg tud olni ha kattint
public void DroidGepagyu() {
//deaktivalni minden objectet kiveve a ugynok text boxokat es addig nem vissza aktivalni amig nem kattintott ra valamelyikre
//ugynok.canKill = true; //barhol meg tud olni ha kattint
//deaktivalas
jatekmanager.ugynokDeaktivalas(true);
Debug.Log("kattints egy ugynok csapatra!");
droidgepagyu = 0; //targy elvesztese
Debug.Log("droid felhasznalva");

View File

@@ -5,39 +5,48 @@ using TMPro;
public class Ugynok : MonoBehaviour
{
private Akciok akciok;
private Upgrade upgrade;
private jatekmanager jatekmanager;
public TMP_Text[] oneone;
public BoxCollider2D[] oneoneCollider;
//public BoxCollider2D[] oneoneCollider;
public TMP_Text[] twoone;
public BoxCollider2D[] twooneCollider;
//public BoxCollider2D[] twooneCollider;
public TMP_Text[] threeone;
public BoxCollider2D[] threeoneCollider;
//public BoxCollider2D[] threeoneCollider;
public TMP_Text[] onetwo;
public BoxCollider2D[] onetwoCollider;
//public BoxCollider2D[] onetwoCollider;
public TMP_Text[] twotwo;
public BoxCollider2D[] twotwoCollider;
//public BoxCollider2D[] twotwoCollider;
public TMP_Text[] threetwo;
public BoxCollider2D[] threetwoCollider;
//public BoxCollider2D[] threetwoCollider;
public TMP_Text[] onethree;
public BoxCollider2D[] onethreeCollider;
//public BoxCollider2D[] onethreeCollider;
public TMP_Text[] twothree;
public BoxCollider2D[] twothreeCollider;
//public BoxCollider2D[] twothreeCollider;
public TMP_Text[] threethree;
public BoxCollider2D[] threethreeCollider;
//public BoxCollider2D[] threethreeCollider;
public TMP_Text[] onefour;
public BoxCollider2D[] onefourCollider;
//public BoxCollider2D[] onefourCollider;
public TMP_Text[] twofour;
public BoxCollider2D[] twofourCollider;
//public BoxCollider2D[] twofourCollider;
public TMP_Text[] threefour;
public BoxCollider2D[] threefourCollider;
//public BoxCollider2D[] threefourCollider;
public bool droidagyuAktivalva = false;
public bool canKill = false;
public bool canShoot = false; //harchoz bool
public void setCanKillTrue()
{
canKill = true;
}
public void setCanKillTrue(){ canKill = true; }
public Camera maincamera;
private void Awake() {
akciok = FindObjectOfType<Akciok>();
upgrade = FindObjectOfType<Upgrade>();
jatekmanager = FindObjectOfType<jatekmanager>();
}
private void Start()
{
for (int i = 0; i < oneone.Length; i++)
@@ -93,7 +102,217 @@ public class Ugynok : MonoBehaviour
}
private void Update()
public void UgynokSorsolas(int x, int y)
{
if (x == 1 && y == 1)
{
if (oneone[0].text.Equals(""))
{
oneone[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (oneone[1].text.Equals(""))
{
oneone[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (oneone[2].text.Equals(""))
{
oneone[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 1 && y == 2)
{
if (onetwo[0].text.Equals(""))
{
onetwo[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onetwo[1].text.Equals(""))
{
onetwo[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onetwo[2].text.Equals(""))
{
onetwo[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 1 && y == 3)
{
if (onethree[0].text.Equals(""))
{
onethree[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onethree[1].text.Equals(""))
{
onethree[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onethree[2].text.Equals(""))
{
onethree[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 1 && y == 4)
{
if (onefour[0].text.Equals(""))
{
onefour[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onefour[1].text.Equals(""))
{
onefour[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onefour[2].text.Equals(""))
{
onefour[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 2 && y == 1)
{
if (twoone[0].text.Equals(""))
{
twoone[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twoone[1].text.Equals(""))
{
twoone[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twoone[2].text.Equals(""))
{
twoone[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 2 && y == 2)
{
if (twotwo[0].text.Equals(""))
{
twotwo[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twotwo[1].text.Equals(""))
{
twotwo[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twotwo[2].text.Equals(""))
{
twotwo[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 2 && y == 3)
{
if (twothree[0].text.Equals(""))
{
twothree[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twothree[1].text.Equals(""))
{
twothree[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twothree[2].text.Equals(""))
{
twothree[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 2 && y == 4)
{
if (twofour[0].text.Equals(""))
{
twofour[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twofour[1].text.Equals(""))
{
twofour[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twofour[2].text.Equals(""))
{
twofour[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 3 && y == 1)
{
if (threeone[0].text.Equals(""))
{
threeone[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threeone[1].text.Equals(""))
{
threeone[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threeone[2].text.Equals(""))
{
threeone[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 3 && y == 2)
{
if (threetwo[0].text.Equals(""))
{
threetwo[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threetwo[1].text.Equals(""))
{
threetwo[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threetwo[2].text.Equals(""))
{
threetwo[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 3 && y == 3)
{
if (threethree[0].text.Equals(""))
{
threethree[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threethree[1].text.Equals(""))
{
threethree[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threethree[2].text.Equals(""))
{
threethree[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 3 && y == 4)
{
if (threefour[0].text.Equals(""))
{
threefour[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threefour[1].text.Equals(""))
{
threefour[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threefour[2].text.Equals(""))
{
threefour[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
}
public void ugynokOles(TMP_Text ugynokText){
if(ugynokText.text.Equals("")){ //ha nincs ott ugynok csapat ne csinaljon semmit
Debug.Log("itt nincs ugynok csapat!!");
return;
}
if(!droidagyuAktivalva){ //toltenyek levonasa
int ugynokcsapatletszama = int.Parse(ugynokText.text);
if(ugynokcsapatletszama > akciok.betarazott_tolteny / upgrade.harc[upgrade.getHarcIndex()]){ //ha nincs eleg tolteny
Debug.Log("nincs eleg tolteny");
return;
}
akciok.Loves(ugynokcsapatletszama / upgrade.hack[upgrade.getHackIndex()]);
}
ugynokText.text = "X"; //ugynok csapat megolve
//minden vissza kapcsolasa
jatekmanager.ugynokDeaktivalas(false);
}
/* private void Update()
{
if(canShoot){
if(oneone[0].text.Equals("")){
@@ -551,188 +770,5 @@ public class Ugynok : MonoBehaviour
}
}
}
public void UgynokSorsolas(int x, int y)
{
if (x == 1 && y == 1)
{
if (oneone[0].text.Equals(""))
{
oneone[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (oneone[1].text.Equals(""))
{
oneone[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (oneone[2].text.Equals(""))
{
oneone[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 1 && y == 2)
{
if (onetwo[0].text.Equals(""))
{
onetwo[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onetwo[1].text.Equals(""))
{
onetwo[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onetwo[2].text.Equals(""))
{
onetwo[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 1 && y == 3)
{
if (onethree[0].text.Equals(""))
{
onethree[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onethree[1].text.Equals(""))
{
onethree[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onethree[2].text.Equals(""))
{
onethree[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 1 && y == 4)
{
if (onefour[0].text.Equals(""))
{
onefour[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onefour[1].text.Equals(""))
{
onefour[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (onefour[2].text.Equals(""))
{
onefour[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 2 && y == 1)
{
if (twoone[0].text.Equals(""))
{
twoone[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twoone[1].text.Equals(""))
{
twoone[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twoone[2].text.Equals(""))
{
twoone[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 2 && y == 2)
{
if (twotwo[0].text.Equals(""))
{
twotwo[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twotwo[1].text.Equals(""))
{
twotwo[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twotwo[2].text.Equals(""))
{
twotwo[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 2 && y == 3)
{
if (twothree[0].text.Equals(""))
{
twothree[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twothree[1].text.Equals(""))
{
twothree[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twothree[2].text.Equals(""))
{
twothree[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 2 && y == 4)
{
if (twofour[0].text.Equals(""))
{
twofour[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twofour[1].text.Equals(""))
{
twofour[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (twofour[2].text.Equals(""))
{
twofour[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 3 && y == 1)
{
if (threeone[0].text.Equals(""))
{
threeone[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threeone[1].text.Equals(""))
{
threeone[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threeone[2].text.Equals(""))
{
threeone[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 3 && y == 2)
{
if (threetwo[0].text.Equals(""))
{
threetwo[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threetwo[1].text.Equals(""))
{
threetwo[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threetwo[2].text.Equals(""))
{
threetwo[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 3 && y == 3)
{
if (threethree[0].text.Equals(""))
{
threethree[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threethree[1].text.Equals(""))
{
threethree[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threethree[2].text.Equals(""))
{
threethree[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
else if (x == 3 && y == 4)
{
if (threefour[0].text.Equals(""))
{
threefour[0].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threefour[1].text.Equals(""))
{
threefour[1].text = UnityEngine.Random.Range(1, 7).ToString();
}
else if (threefour[2].text.Equals(""))
{
threefour[2].text = UnityEngine.Random.Range(1, 7).ToString();
}
}
}
}
*/
}

View File

@@ -1,9 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Net.Sockets;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class jatekmanager : MonoBehaviour
{
@@ -20,7 +18,6 @@ public class jatekmanager : MonoBehaviour
public GameObject rolldice;
public GameObject test;
//script-ek implementalasa
private Elet elet;
private Akciok akciok;
@@ -45,6 +42,7 @@ public class jatekmanager : MonoBehaviour
public TMP_Text[] onefour;
public TMP_Text[] twofour;
public TMP_Text[] threefour;
public Button helyszinaktivalasBtn;
//nyert es vesztett bool lethrehozas
public bool jatekosnyert = false;
@@ -63,6 +61,48 @@ public class jatekmanager : MonoBehaviour
source = FindObjectOfType<Source>();
}
public void ugynokDeaktivalas(bool kikapcsolas){
energiafejlesztés.SetActive(kikapcsolas);
akciofejlesztés.SetActive(kikapcsolas);
harcfejlesztés.SetActive(kikapcsolas);
ujradobasfejlesztés.SetActive(kikapcsolas);
hackfejlesztés.SetActive(kikapcsolas);
kovetkezokor.SetActive(kikapcsolas);
betarazas.SetActive(kikapcsolas);
nyomozas.SetActive(kikapcsolas);
hackeles.SetActive(kikapcsolas);
//roll dice gomb
rolldice.SetActive(kikapcsolas);
//kovetkezo kor
kovetkezokor.SetActive(kikapcsolas);
//helyszinaktivalas
helyszinaktivalasBtn.gameObject.SetActive(kikapcsolas);
movement.oneone_Collider.gameObject.SetActive(kikapcsolas);
movement.onetwo_Collider.gameObject.SetActive(kikapcsolas);
movement.onethree_Collider.gameObject.SetActive(kikapcsolas);
movement.onefour_Collider.gameObject.SetActive(kikapcsolas);
movement.twoone_Collider.gameObject.SetActive(kikapcsolas);
movement.twotwo_Collider.gameObject.SetActive(kikapcsolas);
movement.twothree_Collider.gameObject.SetActive(kikapcsolas);
movement.twofour_Collider.gameObject.SetActive(kikapcsolas);
movement.threeone_Collider.gameObject.SetActive(kikapcsolas);
movement.threetwo_Collider.gameObject.SetActive(kikapcsolas);
movement.threethree_Collider.gameObject.SetActive(kikapcsolas);
movement.threefour_Collider.gameObject.SetActive(kikapcsolas);
targyak.hackerFelhasznalva.GetComponent<Button>().gameObject.SetActive(kikapcsolas);
targyak.lathatatlanFelhasznalva.GetComponent<Button>().gameObject.SetActive(kikapcsolas);
targyak.droidFelhasznalva.GetComponent<Button>().gameObject.SetActive(kikapcsolas);
targyak.matavFelhasznalva.GetComponent<Button>().gameObject.SetActive(kikapcsolas);
targyak.alomhozoFelhasznalva.GetComponent<Button>().gameObject.SetActive(kikapcsolas);
dice.dice1btnBtn.gameObject.SetActive(kikapcsolas);
dice.dice2btnBtn.gameObject.SetActive(kikapcsolas);
}
// Update is called once per frame
void Update()
{