我想在游戏中制作一个任务系统,一切正常,但是现在当我添加另一个脚本时,团结一致给我这个错误:Assets \ QuestManager.cs(6,12):error CS0246:类型或名称空间名称找不到“ QuestObject”(您是否缺少using指令或程序集引用?)我该如何解决?很抱歉,如果是斯洛伐克写错了话
在此脚本中告诉我错误
using System.Collections;
using UnityEngine;
public class QuestManager : MonoBehaviour
{
public QuestObject[] quests;
public bool[] questCompleted;
public DialogueManager theDM;
public string itemCollected;
public string enemyKilled;
// Start is called before the first frame update
void Start()
{
questCompleted = new bool[quests.Length];
}
// Update is called once per frame
void Update()
{
}
public void ShowQuestText(string questText)
{
theDM.dialogLines = new string[1];
theDM.dialogLines[0] = questText;
theDM.currentLine = 0;
theDM.ShowDialogue();
}
}
我想参考这个脚本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class QuestObject : MonoBehaviour
{
public int questNumber;
public QuestManager theQM;
public string startText;
public string endText;
public bool isItemQuest;
public string targetItem;
public bool isEnemyQuest;
public string targetEnemy;
public int enemiesToKill;
private int enemyKillCount;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if(isItemQuest)
{
if(theQM.itemCollected == targetItem)
{
theQM.itemCollected = null;
EndQuest();
}
}
if(isEnemyQuest)
{
if(theQM.enemyKilled == targetEnemy)
{
theQM.enemyKilled = null;
enemyKillCount++;
}
if(enemyKillCount >= enemiesToKill)
{
EndQuest();
}
}
}
public void StartQuest()
{
theQM.ShowQuestText(startText);
}
public void EndQuest()
{
theQM.ShowQuestText(endText);
theQM.questCompleted[questNumber] = true;
gameObject.SetActive(false);
}
}
有人可以帮我吗?