1.5 Портретная ориентация: Удалена панель выбора количества ботов в главном меню. Количество ботов устанавливается в инспекторе объекта BotCountSetter
This commit is contained in:
parent
c53b5df3fa
commit
b367cf0d90
File diff suppressed because it is too large
Load Diff
@ -1,37 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class BotPanelController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private TextMeshProUGUI amountText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
amountText.text = (GameData.gameMaxPlayers - 1).ToString();
|
||||
}
|
||||
|
||||
public void OnIncreaseBtnClick()
|
||||
{
|
||||
GameData.gameMaxPlayers += 1;
|
||||
if (GameData.gameMaxPlayers > GameData.possibleMaxPlayers)
|
||||
{
|
||||
GameData.gameMaxPlayers = GameData.possibleMaxPlayers;
|
||||
}
|
||||
|
||||
amountText.text = (GameData.gameMaxPlayers - 1).ToString();
|
||||
}
|
||||
|
||||
public void OnDecreaseBtnClick()
|
||||
{
|
||||
GameData.gameMaxPlayers -= 1;
|
||||
if (GameData.gameMaxPlayers < 1)
|
||||
{
|
||||
GameData.gameMaxPlayers = 1;
|
||||
}
|
||||
|
||||
amountText.text = (GameData.gameMaxPlayers - 1).ToString();
|
||||
}
|
||||
}
|
@ -8,8 +8,6 @@ public class GameData : MonoBehaviour
|
||||
public static int coins = 0;
|
||||
public static int playerLevel = 5;
|
||||
public static int gameMaxPlayers = 2;
|
||||
public static int possibleMaxPlayers = 4;
|
||||
public static int currentChosenLevel = 1;
|
||||
|
||||
public static bool isMusicAllowed = true;
|
||||
public static bool isSFXAllowed = true;
|
||||
|
8
Assets/Scripts/MainMenu.meta
Normal file
8
Assets/Scripts/MainMenu.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 130987d681c9a0a408595d43a350064f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
28
Assets/Scripts/MainMenu/BotsCountSetter.cs
Normal file
28
Assets/Scripts/MainMenu/BotsCountSetter.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class BotsCountSetter : MonoBehaviour
|
||||
{
|
||||
[Range(0, 3)]
|
||||
[SerializeField] private int _botsCount = 1;
|
||||
|
||||
private int _currentBotsCount;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
SetBotsCount(_botsCount);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (_botsCount != _currentBotsCount)
|
||||
{
|
||||
SetBotsCount(_botsCount);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetBotsCount(int count)
|
||||
{
|
||||
_currentBotsCount = count;
|
||||
GameData.gameMaxPlayers = count + 1;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a265063b1756b45408e45fc63d502f53
|
||||
guid: 2a7bc1809032b184bae6f306e7ab1544
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
Loading…
x
Reference in New Issue
Block a user