adrenalin update

This commit is contained in:
2023-02-08 11:47:47 +01:00
parent 04874baf19
commit 079776f1fa
5 changed files with 193 additions and 87 deletions

View File

@@ -78,7 +78,7 @@ public class Dice : MonoBehaviour {
diceResult[0] = RollDice();
diceResult[1] = RollDice();
if(targyak.adrenalinloket > 0) {
/*if(targyak.adrenalinloket > 0) {
//text aktivalasa kerdesre hogy akarja e hasznalni a targyat
adrenalinHasznalat.SetActive(true);
//ha igen gomb -> valtozo igaz, targy fv meghivas, deaktivalas
@@ -90,9 +90,26 @@ public class Dice : MonoBehaviour {
//deaktivalas
adrenalinHasznalat.gameObject.SetActive(false);
adrenalinMegerosites = false;
}
}*/
} while (diceResult[0] == diceResult[1]);
if(targyak.adrenalinloket > 0) {
Debug.Log("belep");
//text aktivalasa kerdesre hogy akarja e hasznalni a targyat
adrenalinHasznalat.SetActive(true);
//ha igen gomb -> valtozo igaz, targy fv meghivas, deaktivalas
//VARNIA KELL A GOMBRA
if (adrenalinMegerosites) {
int[] ujertek = targyak.AdrenalinLoket();
diceResult[0] = ujertek[0];
diceResult[1] = ujertek[1];
}
//deaktivalas
adrenalinHasznalat.gameObject.SetActive(false);
adrenalinMegerosites = false;
}
hely1.sprite = diceSides[diceResult[0]-1];
hely1.size = new Vector2(38, 38);

View File

@@ -87,10 +87,12 @@ public class Targyak : MonoBehaviour
}
public int[] AdrenalinLoket() {
kocka1ertek.text = dice.getDices()[0].ToString();
kocka2ertek.text = dice.getDices()[1].ToString();
//kocka1ertek.text = dice.getDices()[0].ToString(); //maradjon uresen es jelenjen meg kepen a kocka ertekek, hogy while-al varakoztatni lehessen?
//kocka2ertek.text = dice.getDices()[1].ToString();
kocka1ertek.gameObject.SetActive(true); //aktivalja az input mezot hogy meg lehessen adni az uj erteket
kocka2ertek.gameObject.SetActive(true);
//ITT IS VARNI KELL?
ujertek1 = int.Parse(kocka1ertek.text);
ujertek2 = int.Parse(kocka2ertek.text); //hogy tunik el az elozo? || egymas melle kerul a ket input vagy gomb ami deaktivalja a inputot
int[] eredmeny = {ujertek1, ujertek2};

View File

@@ -0,0 +1,76 @@
//Code provided by Bunny83 on https://answers.unity.com/questions/1651268/need-help-setting-up-ui-button-functionality-in-co.html
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
public class WaitForUIButtons : CustomYieldInstruction, System.IDisposable
{
private struct ButtonCallback
{
public Button button;
public UnityAction listener;
}
private List<ButtonCallback> m_Buttons = new List<ButtonCallback>();
private System.Action<Button> m_Callback = null;
public override bool keepWaiting { get { return PressedButton == null; }}
public Button PressedButton { get; private set; } = null;
public WaitForUIButtons(System.Action<Button> aCallback, params Button[] aButtons)
{
m_Callback = aCallback;
m_Buttons.Capacity = aButtons.Length;
foreach(var b in aButtons)
{
if (b == null)
continue;
var bc = new ButtonCallback { button = b };
bc.listener = () => OnButtonPressed(bc.button);
m_Buttons.Add(bc);
}
Reset();
}
public WaitForUIButtons(params Button[] aButtons) : this(null, aButtons) { }
private void OnButtonPressed(Button button)
{
PressedButton = button;
RemoveListeners();
if (m_Callback != null)
m_Callback(button);
}
private void InstallListeners()
{
foreach (var bc in m_Buttons)
if (bc.button != null)
bc.button.onClick.AddListener(bc.listener);
}
private void RemoveListeners()
{
foreach (var bc in m_Buttons)
if (bc.button != null)
bc.button.onClick.RemoveListener(bc.listener);
}
public new WaitForUIButtons Reset()
{
RemoveListeners();
PressedButton = null;
InstallListeners();
base.Reset();
return this;
}
public WaitForUIButtons ReplaceCallback(System.Action<Button> aCallback)
{
m_Callback = aCallback;
return this;
}
public void Dispose()
{
RemoveListeners();
m_Callback = null;
m_Buttons.Clear();
}
}

View File

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

View File

@@ -15,11 +15,11 @@ MonoBehaviour:
m_PixelRect:
serializedVersion: 2
x: 0
y: 43
width: 1920
height: 997
y: 28
width: 1366
height: 672
m_ShowMode: 4
m_Title: Game
m_Title: Hierarchy
m_RootView: {fileID: 2}
m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000}
@@ -44,8 +44,8 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1920
height: 997
width: 1366
height: 672
m_MinSize: {x: 875, y: 300}
m_MaxSize: {x: 10000, y: 10000}
m_UseTopView: 1
@@ -69,7 +69,7 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1920
width: 1366
height: 30
m_MinSize: {x: 0, y: 0}
m_MaxSize: {x: 0, y: 0}
@@ -90,8 +90,8 @@ MonoBehaviour:
m_Position:
serializedVersion: 2
x: 0
y: 977
width: 1920
y: 652
width: 1366
height: 20
m_MinSize: {x: 0, y: 0}
m_MaxSize: {x: 0, y: 0}
@@ -114,12 +114,12 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 30
width: 1920
height: 947
width: 1366
height: 622
m_MinSize: {x: 300, y: 200}
m_MaxSize: {x: 24288, y: 16192}
vertical: 0
controlID: 41
controlID: 84
--- !u!114 &6
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -139,12 +139,12 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1421
height: 947
width: 1011
height: 622
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 16192, y: 16192}
vertical: 1
controlID: 42
controlID: 85
--- !u!114 &7
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -164,12 +164,12 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 1421
height: 574
width: 1011
height: 377
m_MinSize: {x: 200, y: 100}
m_MaxSize: {x: 16192, y: 8096}
vertical: 0
controlID: 43
controlID: 86
--- !u!114 &8
MonoBehaviour:
m_ObjectHideFlags: 52
@@ -187,10 +187,10 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 0
width: 282
height: 574
m_MinSize: {x: 201, y: 221}
m_MaxSize: {x: 4001, y: 4021}
width: 221
height: 377
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 13}
m_Panes:
- {fileID: 13}
@@ -211,12 +211,12 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 282
x: 221
y: 0
width: 1139
height: 574
m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021}
width: 790
height: 377
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 14}
m_Panes:
- {fileID: 14}
@@ -239,9 +239,9 @@ MonoBehaviour:
m_Position:
serializedVersion: 2
x: 0
y: 574
width: 1421
height: 373
y: 377
width: 1011
height: 245
m_MinSize: {x: 231, y: 271}
m_MaxSize: {x: 10001, y: 10021}
m_ActualView: {fileID: 15}
@@ -265,10 +265,10 @@ MonoBehaviour:
m_Children: []
m_Position:
serializedVersion: 2
x: 1421
x: 1011
y: 0
width: 499
height: 947
width: 355
height: 622
m_MinSize: {x: 276, y: 71}
m_MaxSize: {x: 4001, y: 4021}
m_ActualView: {fileID: 17}
@@ -296,10 +296,10 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 282
y: 73
width: 1137
height: 553
x: 221
y: 86
width: 788
height: 356
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@@ -310,7 +310,7 @@ MonoBehaviour:
m_ShowGizmos: 0
m_TargetDisplay: 0
m_ClearColor: {r: 0, g: 0, b: 0, a: 0}
m_TargetSize: {x: 1137, y: 532}
m_TargetSize: {x: 788, y: 335}
m_TextureFilterMode: 0
m_TextureHideFlags: 61
m_RenderIMGUI: 1
@@ -325,10 +325,10 @@ MonoBehaviour:
m_VRangeLocked: 0
hZoomLockedByDefault: 0
vZoomLockedByDefault: 0
m_HBaseRangeMin: -568.5
m_HBaseRangeMax: 568.5
m_VBaseRangeMin: -266
m_VBaseRangeMax: 266
m_HBaseRangeMin: -394
m_HBaseRangeMax: 394
m_VBaseRangeMin: -167.5
m_VBaseRangeMax: 167.5
m_HAllowExceedBaseRangeMin: 1
m_HAllowExceedBaseRangeMax: 1
m_VAllowExceedBaseRangeMin: 1
@@ -337,7 +337,7 @@ MonoBehaviour:
m_HSlider: 0
m_VSlider: 0
m_IgnoreScrollWheelUntilClicked: 0
m_EnableMouseInput: 0
m_EnableMouseInput: 1
m_EnableSliderZoomHorizontal: 0
m_EnableSliderZoomVertical: 0
m_UniformScale: 1
@@ -346,23 +346,23 @@ MonoBehaviour:
serializedVersion: 2
x: 0
y: 21
width: 1137
height: 532
width: 788
height: 335
m_Scale: {x: 1, y: 1}
m_Translation: {x: 568.5, y: 266}
m_Translation: {x: 394, y: 167.5}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -568.5
y: -266
width: 1137
height: 532
x: -394
y: -167.5
width: 788
height: 335
m_MinimalGUI: 1
m_defaultScale: 1
m_LastWindowPixelSize: {x: 1137, y: 553}
m_LastWindowPixelSize: {x: 788, y: 356}
m_ClearInEditMode: 1
m_NoCameraWarning: 1
m_LowResolutionForAspectRatios: 01000000000000000000
@@ -389,19 +389,19 @@ MonoBehaviour:
m_Pos:
serializedVersion: 2
x: 0
y: 73
width: 281
height: 553
y: 86
width: 220
height: 356
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
m_SaveData: []
m_SceneHierarchy:
m_TreeViewState:
scrollPos: {x: 0, y: 204}
m_SelectedIDs: 3abdffff
m_LastClickedID: -17094
m_ExpandedIDs: 3abdffff8ecdffff2cfbffffe46f0000c6760000
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 28fbffff
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@@ -445,10 +445,10 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 282
y: 73
width: 1137
height: 553
x: 221
y: 86
width: 788
height: 356
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@@ -698,16 +698,16 @@ MonoBehaviour:
m_WindowGUID: cc27987af1a868c49b0894db9c0f5429
m_Gizmos: 1
m_OverrideSceneCullingMask: 6917529027641081856
m_SceneIsLit: 1
m_SceneIsLit: 0
m_SceneLighting: 1
m_2DMode: 1
m_isRotationLocked: 0
m_PlayAudio: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: -0.50129414, y: 0.69531596, z: -0.018057432}
m_Target: {x: -2.9889002, y: 0.2662518, z: 0.06300003}
speed: 2
m_Value: {x: -0.50129414, y: 0.69531596, z: -0.018057432}
m_Value: {x: -2.9889002, y: 0.2662518, z: 0.06300003}
m_RenderMode: 0
m_CameraMode:
drawMode: 0
@@ -758,9 +758,9 @@ MonoBehaviour:
speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 10.010393
m_Target: 6.8079257
speed: 2
m_Value: 10.010393
m_Value: 6.8079257
m_Ortho:
m_Target: 1
speed: 2
@@ -806,9 +806,9 @@ MonoBehaviour:
m_Pos:
serializedVersion: 2
x: 0
y: 647
width: 1420
height: 352
y: 463
width: 1010
height: 224
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@@ -834,14 +834,14 @@ MonoBehaviour:
m_LastFolders:
- Assets/Scripts
m_LastFoldersGridSize: 66
m_LastProjectPath: C:\dev\find the source\projekt\FindTheSource
m_LastProjectPath: /home/tom/Documents/dev/find the source
m_LockTracker:
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 04790000
m_LastClickedID: 30980
m_ExpandedIDs: 00000000c6780000
m_SelectedIDs: 3a790000
m_LastClickedID: 31034
m_ExpandedIDs: 000000001679000000ca9a3b
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@@ -869,7 +869,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 00000000c6780000
m_ExpandedIDs: 0000000016790000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
@@ -921,7 +921,7 @@ MonoBehaviour:
m_Icon: {fileID: 0}
m_ResourceFile:
m_NewAssetIndexInList: -1
m_ScrollPosition: {x: 0, y: 0}
m_ScrollPosition: {x: 0, y: 129}
m_GridSize: 66
m_SkipHiddenPackages: 0
m_DirectoriesAreaWidth: 193
@@ -946,9 +946,9 @@ MonoBehaviour:
m_Pos:
serializedVersion: 2
x: 0
y: 647
width: 1420
height: 352
y: 463
width: 1010
height: 224
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default
@@ -973,10 +973,10 @@ MonoBehaviour:
m_Tooltip:
m_Pos:
serializedVersion: 2
x: 1421
y: 73
width: 498
height: 926
x: 1011
y: 86
width: 354
height: 601
m_ViewDataDictionary: {fileID: 0}
m_OverlayCanvas:
m_LastAppliedPresetName: Default