first commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class CraftingDemoController : MonoBehaviour
|
||||
{
|
||||
public Inventory inventory;
|
||||
public CraftingSystem craftingSystem;
|
||||
public GameObject craftingPanel;
|
||||
public Text hintText;
|
||||
public bool addStartingResources;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (addStartingResources && inventory != null && inventory.slots.Count == 0)
|
||||
{
|
||||
inventory.AddTestResources();
|
||||
}
|
||||
|
||||
if (craftingSystem != null)
|
||||
{
|
||||
craftingSystem.lastMessage = "Нажмите кнопку рецепта, чтобы создать предмет.";
|
||||
craftingSystem.Refresh();
|
||||
}
|
||||
|
||||
UpdateHint();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.R) && inventory != null)
|
||||
{
|
||||
inventory.AddTestResources();
|
||||
if (craftingSystem != null)
|
||||
{
|
||||
craftingSystem.lastMessage = "Инвентарь сброшен к тестовому набору ресурсов.";
|
||||
craftingSystem.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.C) && craftingPanel != null)
|
||||
{
|
||||
craftingPanel.SetActive(!craftingPanel.activeSelf);
|
||||
UpdateHint();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateHint()
|
||||
{
|
||||
if (hintText != null)
|
||||
{
|
||||
hintText.text = "WASD - движение | E - подобрать | 1-9/0 - выбрать слот | F - использовать | R - тестовые ресурсы | C - UI";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user