Whole interactable world-board with different zones and jobs ready to be completed. - party voting for job selection & scene swapping - fully working scene change between inn and skellyard - updated many systems with lots of new information - bunch of new UIs to acomodate new job and scene swapping voting systems
76 lines
1.8 KiB
C#
76 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class JobListingButton : MonoBehaviour
|
|
{
|
|
[Header("Data:")]
|
|
[SerializeField] private ZoneData zoneData;
|
|
[Header("Components:")]
|
|
[SerializeField] private TMP_Text zoneName;
|
|
[SerializeField] private Button button;
|
|
[SerializeField] private GameObject interactableBlocker;
|
|
[Header("Events:")]
|
|
[SerializeField] private GameEvent_JobData onJobSelected;
|
|
|
|
|
|
[Header("Runtime Data:")]
|
|
public JobData jobData = new JobData();
|
|
|
|
|
|
public ZoneData GetZoneData()
|
|
{
|
|
return zoneData;
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
if (button == null)
|
|
button = GetComponent<Button>();
|
|
if (zoneName == null)
|
|
zoneName = GetComponentInChildren<TMP_Text>();
|
|
|
|
if (zoneData == null)
|
|
{
|
|
button.interactable = false;
|
|
interactableBlocker.SetActive(!button.interactable);
|
|
this.enabled = false;
|
|
return;
|
|
}
|
|
|
|
jobData.zoneData = zoneData;
|
|
|
|
zoneName.text = jobData.zoneData.zoneName;
|
|
|
|
button.onClick.AddListener(SendSelectedJobData);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (button == null) return;
|
|
if (interactableBlocker == null) return;
|
|
|
|
interactableBlocker.SetActive(!button.interactable);
|
|
}
|
|
public void ToggleInteractable(bool interactable)
|
|
{
|
|
button.interactable = interactable;
|
|
interactableBlocker.SetActive(!button.interactable);
|
|
}
|
|
|
|
public void UpdateJobData(JobData jobData)
|
|
{
|
|
this.jobData.experienceFinalReward = jobData.experienceFinalReward;
|
|
this.jobData.coinFinalReward = jobData.coinFinalReward;
|
|
}
|
|
|
|
private void SendSelectedJobData()
|
|
{
|
|
onJobSelected.Raise(jobData);
|
|
}
|
|
|
|
|
|
}
|