2022-06-13 23:33:19 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
public class NPCQuest : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField] public Task quest;
|
|
|
|
public Task Quest
|
|
|
|
{
|
|
|
|
get { return quest; }
|
|
|
|
set { quest = value; }
|
|
|
|
}
|
2022-06-17 22:22:19 +02:00
|
|
|
[SerializeField] public GameObject axe;
|
2022-06-13 23:33:19 +02:00
|
|
|
|
|
|
|
[SerializeField] private bool isTaskAccepted = false;
|
|
|
|
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
2022-10-22 18:04:21 +02:00
|
|
|
this.Quest = new Task(1, "Help the Lumberjack", "Find his axe in the forest and bring it back to him.", TaskDifficultyEnum.Easy);
|
2022-06-13 23:33:19 +02:00
|
|
|
}
|
|
|
|
|
2022-06-17 22:22:19 +02:00
|
|
|
// Update is called once per frame
|
2022-06-13 23:33:19 +02:00
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public Task AcceptTask()
|
|
|
|
{
|
|
|
|
this.isTaskAccepted = true;
|
|
|
|
|
|
|
|
return this.Quest;
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsTaskAccepted()
|
|
|
|
{
|
|
|
|
return this.isTaskAccepted;
|
|
|
|
}
|
2022-06-17 22:22:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
public void DropItem()
|
|
|
|
{
|
|
|
|
GameObject globalGUI = GameObject.FindGameObjectsWithTag("GUI")[0];
|
|
|
|
|
|
|
|
if(globalGUI)
|
|
|
|
{
|
|
|
|
// 1. Drop item on map
|
|
|
|
GameObject _axe = Instantiate(axe, new Vector3(37.1f, -31.7f, 0), Quaternion.identity, globalGUI.transform);
|
|
|
|
// 1.2 Fix names (prevent add "(Clone)" postfix)
|
2022-06-20 18:23:22 +02:00
|
|
|
_axe.name = axe.GetComponent<PickableController>().item.Name;
|
2022-06-17 22:22:19 +02:00
|
|
|
_axe.GetComponent<PickableController>().item.name = axe.name;
|
|
|
|
|
|
|
|
// 2. Add object to DynamicList in LocalSceneManager
|
|
|
|
SceneEquippableItemManager.Instance.AddDynamicItem(_axe);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
Debug.Log("Can't find global GUI object!!!");
|
|
|
|
}
|
|
|
|
}
|
2022-06-13 23:33:19 +02:00
|
|
|
}
|