Scriptum/Assets/Scripts/NPCs' Scripts/NPCQuest.cs

66 lines
1.7 KiB
C#
Raw Normal View History

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; }
}
[SerializeField] public GameObject axe;
2022-06-13 23:33:19 +02:00
[SerializeField] private bool isTaskAccepted = false;
[SerializeField] public MissionReward reward;
2022-06-13 23:33:19 +02:00
// 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
}
// 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;
}
public void DropItem()
{
GameObject globalGUI = GameObject.FindGameObjectWithTag("ItemCollection");
if(globalGUI)
{
// 1. Drop item on map
GameObject _axe = Instantiate(axe, new Vector3(37.1f, -31.7f, 0), Quaternion.identity, globalGUI.transform);
_axe.transform.localScale = new Vector3(1,1,1);
// 1.2 Fix names (prevent add "(Clone)" postfix)
2022-06-20 18:23:22 +02:00
_axe.name = axe.GetComponent<PickableController>().item.Name;
2022-12-06 01:58:32 +01: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
}