mirror of
https://github.com/zoriya/Magical-Garden.git
synced 2026-06-01 08:25:13 +00:00
Merge branch 'master' of https://github.com/AnonymusRaccoon/New-Unity-Project
This commit is contained in:
@@ -38,7 +38,7 @@ RenderSettings:
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.37311992, g: 0.38074034, b: 0.35872713, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
@@ -14479,9 +14479,12 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: b4b4a071451fb1c47af7fedbbf6a4179, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
difficulte: 5
|
||||
easy: 4
|
||||
hard: 8
|
||||
minDrop: 1
|
||||
itemDrop: 5
|
||||
maxDrop: 10
|
||||
fewTree: 0
|
||||
manyTree: 4
|
||||
WinUI: {fileID: 1264435080}
|
||||
LooseUI: {fileID: 1470635746}
|
||||
--- !u!1 &1774186325 stripped
|
||||
|
||||
@@ -63,9 +63,17 @@ public class InventoryManager : MonoBehaviour
|
||||
if (Input.GetKeyDown(KeyCode.R))
|
||||
{
|
||||
ClearBoard();
|
||||
//GetComponent<Mission>().GenerateMission();
|
||||
GetComponent<Mission>().WinUI.SetActive(false);
|
||||
GetComponent<Pokedex>().UpdateMissionText();
|
||||
turnCount.text = "Turn: 01";
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.N))
|
||||
{
|
||||
ClearBoard();
|
||||
GetComponent<Mission>().GenerateMission();
|
||||
GetComponent<Mission>().WinUI.SetActive(false);
|
||||
GetComponent<Pokedex>().UpdateMissionText();
|
||||
turnCount.text = "Turn: 01";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +143,28 @@ public class InventoryManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaceRandomTrees(int number)
|
||||
{
|
||||
TreeItem[] trees = items.Where(x => x.type != TreeType.Nothing).ToArray();
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
TreeItem tree = trees[Random.Range(0, trees.Length)];
|
||||
int index = Random.Range(0, plots.Length);
|
||||
|
||||
while(!CanPlantAt(index, tree))
|
||||
{
|
||||
index++;
|
||||
if (index == plots.Length)
|
||||
break;
|
||||
}
|
||||
|
||||
if (index != plots.Length)
|
||||
PlaceTree(tree, index);
|
||||
else
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteTreeAt(int index)
|
||||
{
|
||||
Vector2Int plotPos = GetPlotPositionByIndex(index);
|
||||
@@ -371,7 +401,8 @@ public class InventoryManager : MonoBehaviour
|
||||
{
|
||||
for (int i = 0; i < slots.Length; i++)
|
||||
{
|
||||
slots[i].GetComponentInChildren<TextMeshProUGUI>().text = items[i].count.ToString().Length < 10 ? ("0" + items[i].count.ToString()) : items[i].count.ToString();
|
||||
if(slots[i].GetComponentInChildren<TextMeshProUGUI>() != null)
|
||||
slots[i].GetComponentInChildren<TextMeshProUGUI>().text = items[i].count.ToString().Length < 10 ? ("0" + items[i].count.ToString()) : items[i].count.ToString();
|
||||
if(items[i].count == 0)
|
||||
slots[i].transform.GetChild(1).GetComponent<Image>().sprite = items[i].iconGris;
|
||||
else
|
||||
|
||||
@@ -4,11 +4,20 @@ using UnityEngine;
|
||||
|
||||
public class Mission : MonoBehaviour {
|
||||
|
||||
TreeItem[] items;
|
||||
public float difficulte;
|
||||
|
||||
public int easy;
|
||||
public int hard;
|
||||
|
||||
[Space]
|
||||
public int minDrop;
|
||||
public int itemDrop;
|
||||
public int maxDrop;
|
||||
|
||||
[Space]
|
||||
public int fewTree;
|
||||
public int manyTree;
|
||||
|
||||
public Dictionary<TreeType, int> Objectifs = new Dictionary<TreeType, int>();
|
||||
TreeItem[] items;
|
||||
public GameObject WinUI;
|
||||
public GameObject LooseUI;
|
||||
private void Start()
|
||||
@@ -19,7 +28,7 @@ public class Mission : MonoBehaviour {
|
||||
Debug.Log("eroor");
|
||||
}
|
||||
|
||||
if (difficulte> items.Length)
|
||||
if (hard > items.Length)
|
||||
{
|
||||
Debug.LogError("difficulté trop grande");
|
||||
}
|
||||
@@ -33,7 +42,8 @@ public class Mission : MonoBehaviour {
|
||||
public void GenerateMission()
|
||||
{
|
||||
Objectifs = new Dictionary<TreeType, int>();
|
||||
for (int i = 0; i < difficulte; i++)
|
||||
int loop = Random.Range(easy, hard);
|
||||
for (int i = 0; i < loop; i++)
|
||||
{
|
||||
AddTree();
|
||||
}
|
||||
@@ -43,7 +53,9 @@ public class Mission : MonoBehaviour {
|
||||
mission = mission + "Place: " + i.Value + " " + i.Key.ToString() +"\n";
|
||||
}
|
||||
|
||||
GetComponent<InventoryManager>().PlaceRandomTrees(Random.Range(fewTree, manyTree));
|
||||
GiveTrees();
|
||||
GetComponent<Pokedex>().UpdateMissionText();
|
||||
}
|
||||
|
||||
private void GiveTrees()
|
||||
@@ -54,7 +66,7 @@ public class Mission : MonoBehaviour {
|
||||
if (manager.items[i].type == TreeType.Nothing)
|
||||
continue;
|
||||
|
||||
manager.items[i].count = Random.Range(minDrop, itemDrop);
|
||||
manager.items[i].count = Random.Range(minDrop, maxDrop);
|
||||
|
||||
if (Objectifs.ContainsKey(manager.items[i].type))
|
||||
{
|
||||
@@ -85,7 +97,7 @@ public class Mission : MonoBehaviour {
|
||||
{
|
||||
int i = Random.Range(0, trees.Length);
|
||||
TreeType type = trees[i].type;
|
||||
int number = Random.Range(items[i].maxInstanceForWin / 2, items[i].maxInstanceForWin);
|
||||
int number = Random.Range(items[i].maxInstanceForWin / 2 + 1, items[i].maxInstanceForWin);
|
||||
Objectifs.Add(type, number);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ GraphicsSettings:
|
||||
- {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_PreloadedShaders: []
|
||||
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
|
||||
type: 0}
|
||||
|
||||
@@ -113,11 +113,11 @@ PlayerSettings:
|
||||
vulkanEnableSetSRGBWrite: 0
|
||||
vulkanUseSWCommandBuffers: 0
|
||||
m_SupportedAspectRatios:
|
||||
4:3: 1
|
||||
5:4: 1
|
||||
16:10: 1
|
||||
4:3: 0
|
||||
5:4: 0
|
||||
16:10: 0
|
||||
16:9: 1
|
||||
Others: 1
|
||||
Others: 0
|
||||
bundleVersion: 0.1
|
||||
preloadedAssets: []
|
||||
metroInputSource: 0
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
--- !u!310 &1
|
||||
UnityConnectSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
m_Enabled: 0
|
||||
m_Enabled: 1
|
||||
m_TestMode: 0
|
||||
m_TestEventUrl:
|
||||
m_TestConfigUrl:
|
||||
|
||||
Reference in New Issue
Block a user