Finish production line logic
This commit is contained in:
21
Assets/Scripts/UI/Spinbox.cs
Normal file
21
Assets/Scripts/UI/Spinbox.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class Spinbox : MonoBehaviour
|
||||
{
|
||||
public AssignableWorker target;
|
||||
[SerializeField]
|
||||
private TMP_Text numAssignedLabel;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
target = transform.parent.GetComponent<AssignableWorker>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
numAssignedLabel.text = target.GetAssignedWorkers().ToString();
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Spinbox.cs.meta
Normal file
2
Assets/Scripts/UI/Spinbox.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e135e4c4d24079a499b77564d448e882
|
||||
28
Assets/Scripts/UI/SpinboxBtn.cs
Normal file
28
Assets/Scripts/UI/SpinboxBtn.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public enum SpinnerBtnType
|
||||
{
|
||||
UP,
|
||||
DOWN
|
||||
}
|
||||
public class SpinboxBtn : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private SpinnerBtnType type;
|
||||
|
||||
private void OnMouseUp()
|
||||
{
|
||||
if (type == SpinnerBtnType.UP)
|
||||
{
|
||||
transform.parent.gameObject.GetComponent<Spinbox>().target.AddWorker();
|
||||
|
||||
}
|
||||
|
||||
if (type == SpinnerBtnType.DOWN)
|
||||
{
|
||||
transform.parent.gameObject.GetComponent<Spinbox>().target.RemoveWorker();
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/SpinboxBtn.cs.meta
Normal file
2
Assets/Scripts/UI/SpinboxBtn.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b8370f1edd4d23141ada2da575eee2ac
|
||||
Reference in New Issue
Block a user