elet levonas bug javitva, kezdohely animacio, harc gomb, nagyobb kocka

This commit is contained in:
2023-04-18 21:14:04 +02:00
parent c51138a8cb
commit e21cd9f100
12 changed files with 1393 additions and 158 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using System;
using System.IO; //ideiglenes amig a mac camera bug nincs javitva aztan torolheto
using System.Text; //ideiglenes
using UnityEngine;
public class AspectRatioHandler : MonoBehaviour
{
public Camera mainCamera;
private StreamWriter writer;
private void Awake() {
writer = new StreamWriter(Application.persistentDataPath + "/aspectratio.txt", false, Encoding.Default);
double aspectRatio = (double)Screen.width / (double)Screen.height;
aspectRatio = Math.Round(aspectRatio, 2);
writer.Write("felbontas: width: " + Screen.width + " height: " + Screen.height + " aspectratio: " + aspectRatio+ "unity aspect: " + mainCamera.aspect);
writer.Close();
Debug.Log("aspectratio: " + aspectRatio);
//5:4 1,25, 4:3 1,33, 16:9 1,77, 16:10 1,6, 21:9 2,33
if(aspectRatio == 1.78 || aspectRatio == 2.33){
mainCamera.orthographicSize = 10.4f; //16:9, 21:9
if(Application.platform == RuntimePlatform.OSXPlayer)
mainCamera.orthographicSize = 13f; //mac aspect ratio fix???
else
mainCamera.orthographicSize = 10.4f; //16:9, 21:9
}else if(aspectRatio == 1.6){
mainCamera.orthographicSize = 11.43f; //16:10
if(Application.platform == RuntimePlatform.OSXPlayer)
mainCamera.orthographicSize = 13f; //mac aspect ratio fix???
else
mainCamera.orthographicSize = 11.43f; //16:9, 21:9 //16:10 11.43f
}else if(aspectRatio == 1.33){
mainCamera.orthographicSize = 13.72f; //4:3
}else if(aspectRatio == 1.25){
mainCamera.orthographicSize = 14.68f;
}
}
}
}

View File

@@ -7,16 +7,19 @@ public class Dice : MonoBehaviour {
public Sprite[] diceSides = new Sprite[6];
public SpriteRenderer hely1;
public SpriteRenderer hely2;
public SpriteRenderer animacio1;
public SpriteRenderer animacio2;
[SerializeField] private int spriteSize = 60;
private Vector2 diceSpriteSize;
public Button dice1btnBtn;
public Button dice2btnBtn;
private Upgrade upgrade;
private Akciopont ap;
private Energia energiasav;
private Targyak targyak;
private Ugynok ugynok;
private movement movement;
public int[] diceResult = { 0, 0 };
public List<int> ujertek = new List<int>();
public int valasztottErtek; //a jatekos altal valasztott dobott ertek helye
@@ -47,6 +50,8 @@ public class Dice : MonoBehaviour {
targyak = FindObjectOfType<Targyak>();
ugynok = FindObjectOfType<Ugynok>();
movement = FindObjectOfType<movement>();
diceSpriteSize = new Vector2(spriteSize, spriteSize);
}
public void ertekValasztas(GameObject gomb) {
@@ -152,15 +157,15 @@ public class Dice : MonoBehaviour {
} while (diceResult[0] == diceResult[1]);
//dice porgo animacio
StartCoroutine(AnimateTheDice(hely1, diceResult[0]));
StartCoroutine(AnimateTheDice(hely2, diceResult[1]));
callAnimateDice(hely1, diceResult[0]);
callAnimateDice(hely2, diceResult[1]);
//lassa a jatekos mit dobott
hely1.sprite = diceSides[diceResult[0]-1];
hely1.size = new Vector2(38, 38);
hely1.size = diceSpriteSize;
hely2.sprite = diceSides[diceResult[1]-1];
hely2.size = new Vector2(38, 38);
hely2.size = diceSpriteSize;
if(ugynokDobas){
ugynokDobasErtek = true;
@@ -247,10 +252,10 @@ public class Dice : MonoBehaviour {
}
hely1.sprite = diceSides[diceResult[0]-1];
hely1.size = new Vector2(38, 38);
hely1.size = diceSpriteSize;
hely2.sprite = diceSides[diceResult[1]-1];
hely2.size = new Vector2(38, 38);
hely2.size = diceSpriteSize;
dobott++;
//ha vegzett mindennel kapcsolja vissza az ertekvalasztast
@@ -279,7 +284,7 @@ public class Dice : MonoBehaviour {
this.adrenalinMegerosites = adrenalinMegerosites;
}
public void callAnimateDice(SpriteRenderer rend, int diceErtek) => StartCoroutine(AnimateTheDice(rend, diceErtek));
private IEnumerator AnimateTheDice(SpriteRenderer rend, int diceErtek)
{
int randomDiceSide;
@@ -295,12 +300,12 @@ public class Dice : MonoBehaviour {
randomDiceSide = Random.Range(0, 5);
rend.sprite = diceSides[Random.Range(0, 5)];
rend.size = new Vector2(38, 38);
rend.size = diceSpriteSize;
yield return new WaitForSeconds(0.05f);
}
rend.sprite = diceSides[diceErtek - 1];
rend.size = new Vector2(38, 38);
rend.size = diceSpriteSize;
}
}

View File

@@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Kezdohelyszin : MonoBehaviour
{
public SpriteRenderer dice1;
public SpriteRenderer dice2;
public TMP_Text eredmenyText;
public Button nextButton;
private int random;
private Dice dice;
private void Awake() {
dice = FindObjectOfType<Dice>();
nextButton.interactable = false;
}
public void KezdoHelyszinSorsolas(int x, int y, string helynev){
StartCoroutine(waitForDiceAnimation(helynev));
dice.callAnimateDice(dice1, x);
dice.callAnimateDice(dice2, y);
}
private IEnumerator waitForDiceAnimation(string helynev){
yield return new WaitForSeconds(5f);
eredmenyText.text = "A kezdőhelyszíned: " + helynev;
nextButton.interactable = true;
}
public void Debugl(){
Debug.Log("clicked");
}
}

View File

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

View File

@@ -29,7 +29,7 @@ public class Ugynok : MonoBehaviour
public bool droidagyuAktivalva = false;
public bool canKill = false;
public bool canShoot = false; //harchoz bool
private string[] previus_ugynok_csapatok;
[SerializeField] private string[] previus_ugynok_csapatok;
private int elozo_x;
private int elozo_y ;
public void setCanKillTrue(){ canKill = true; }
@@ -288,7 +288,12 @@ public class Ugynok : MonoBehaviour
}
public void ugynokOles(TMP_Text ugynokText){
public void ugynokOles(TMP_Text ugynokText){
if(!canKill){
Debug.Log("Nem nyomtal a harc gombra!!");
return;
}
//string tmp = ugynokText.gameObject.name;
string s = ugynokText.gameObject.name;
//Debug.Log("gomb name: " + s);
@@ -333,6 +338,7 @@ public class Ugynok : MonoBehaviour
}
akciok.Loves(ugynokcsapatletszama / upgrade.harc[upgrade.getHarcIndex()]);
canKill = false;
Debug.Log("tolteny szama:" + ugynokcsapatletszama / upgrade.harc[upgrade.getHarcIndex()]);
}
@@ -352,8 +358,12 @@ public class Ugynok : MonoBehaviour
if(elozo_x != movement.jelenlegi_x || elozo_y != movement.jelenlegi_y){
foreach(var item in previus_ugynok_csapatok){
if(!item.Equals("")){
Debug.Log("|"+item+"|");
//ha nem ures a text vagyis volt atirva szamra nezze meg hogy X-e
if(!item.Equals("x") ||!item.Equals("X")){
//if(!item.Equals("x") || !item.Equals("X"))
if(item.Equals("1") || item.Equals("2") || item.Equals("3") || item.Equals("4") || item.Equals("5") || item.Equals("6"))
{
Debug.Log("belep ugynok item: |"+item+"|");
//vonjon le egy eletet
elet.Eletvesztes();
break;

View File

@@ -6,7 +6,7 @@ using System.Threading;
public class fps : MonoBehaviour
{
public TMP_Text fpsText;
public TMP_Text fpsText; //ideiglenesen megvaltoztatva az uzenet boxra!!
[SerializeField] private float _hudRefreshRate = 1f;
private float _timer;

View File

@@ -67,9 +67,21 @@ public class jatekmanager : MonoBehaviour
public TMP_Text nev;
public GameObject mainCanvas;
public GameObject helyszinCanvas;
public GameObject helyszinSorsolasCanvas;
public GameObject palyaSprite;
public GameObject playerSprite;
private void Awake()
{
Instance = this;
mainCanvas.SetActive(false); //helyszin sorsolas animacio miatt
helyszinCanvas.SetActive(false);
helyszinSorsolasCanvas.SetActive(true);
palyaSprite.SetActive(false);
playerSprite.SetActive(false);
}
private void Start()
@@ -405,7 +417,7 @@ public class jatekmanager : MonoBehaviour
Debug.Log("Játékos nyerésének vizsgálata.");
Debug.Log("A forrás oszlopa:" + source.oszlop);
Debug.Log("A forrás sora:" + source.sor[0]);
Debug.Log("");
//Debug.Log("");
Debug.Log("A te jelenlegi oszlopod:" + movement.jelenlegi_y);
Debug.Log("A te jelenlegi sorod:" + movement.jelenlegi_x);
if (source.isNyitva == true && source.oszlop == movement.jelenlegi_x && source.sor[0] == movement.jelenlegi_y) //+ ugynokcsapat oles a helyszinen

View File

@@ -76,6 +76,7 @@ public class movement : MonoBehaviour
private Targyak targyak;
private jatekmanager jatekmanager;
private Dice dice;
private Kezdohelyszin kezdohelyszin;
private int oneonecount = 0;
private int twoonecount = 0;
@@ -114,9 +115,10 @@ public class movement : MonoBehaviour
targyak = FindObjectOfType<Targyak>();
jatekmanager = FindObjectOfType<jatekmanager>();
dice = FindObjectOfType<Dice>();
kezdohelyszin = FindObjectOfType<Kezdohelyszin>();
}
void Start()
private void Start()
{
eromulepes1.SetActive(false);
eromulepes2.SetActive(false);
@@ -168,7 +170,9 @@ public class movement : MonoBehaviour
eromulepes1.SetActive(true);
eromulepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 1;
jelenlegi_y = 1;
jelenlegi_y = 1;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Erőmű");
}
else if (random == 2)
{
@@ -177,6 +181,7 @@ public class movement : MonoBehaviour
feketepiaclepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 2;
jelenlegi_y = 1;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Fekete piac");
}
else if (random == 3)
{
@@ -185,6 +190,7 @@ public class movement : MonoBehaviour
metrolepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 3;
jelenlegi_y = 1;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Metró");
}
else if (random == 4)
{
@@ -193,6 +199,7 @@ public class movement : MonoBehaviour
szervereklepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 1;
jelenlegi_y = 2;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Szerverek");
}
else if (random == 5)
{
@@ -201,6 +208,7 @@ public class movement : MonoBehaviour
kingcasinolepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 2;
jelenlegi_y = 2;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "King Kaszinó");
}
else if (random == 6)
{
@@ -209,6 +217,7 @@ public class movement : MonoBehaviour
feltoltolepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 3;
jelenlegi_y = 2;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Feltöltő");
}
else if (random == 7)
{
@@ -217,6 +226,7 @@ public class movement : MonoBehaviour
kutatolaborlepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 1;
jelenlegi_y = 3;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Kutatólabor");
}
else if (random == 8)
{
@@ -225,6 +235,7 @@ public class movement : MonoBehaviour
kriptoklublepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 2;
jelenlegi_y = 3;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Kripto club");
}
else if (random == 9)
{
@@ -233,6 +244,7 @@ public class movement : MonoBehaviour
cyberplazalepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 3;
jelenlegi_y = 3;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Cyber pláza");
}
else if (random == 10)
{
@@ -241,6 +253,7 @@ public class movement : MonoBehaviour
hadiuzemlepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 1;
jelenlegi_y = 4;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Hadiüzem");
}
else if (random == 11)
{
@@ -249,6 +262,7 @@ public class movement : MonoBehaviour
konyvtarlepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 2;
jelenlegi_y = 4;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Könyvtár");
}
else if (random == 12)
{
@@ -257,6 +271,7 @@ public class movement : MonoBehaviour
korhazlepes1.GetComponent<TMP_Text>().text = moveCounter.ToString();
jelenlegi_x = 3;
jelenlegi_y = 4;
kezdohelyszin.KezdoHelyszinSorsolas(jelenlegi_x, jelenlegi_y, "Kórház");
}
//ugynok.UgynokSorsolas(jelenlegi_x, jelenlegi_y);

File diff suppressed because one or more lines are too long