NPC.cs 与NPC角色相关联
using UnityEngine;
using System.Collections;
public class PNC : MonoBehaviour {
//默认状态
public const int TASK_STATE_DEFAULT = 0;
//信息提示状态
public const int TASK_STATE_OVER = 1;
//打开任务窗口状态
public const int TASK_STATE_OPEN = 2;
//游戏状态
public const int TASK_STATE_GAME = 3;
//游戏完成状态
public const int TASK_STATE_COMPLETE = 4;
//游戏结束状态
public const int TASK_STATE_FINSH = 5;
//当前游戏状态
public int gameState = 0;
//游戏脚本
Hore script = null;
//任务显示窗口
Rect windowRect = new Rect(100,0,200,100);
// Use this for initialization
void Start ()
{
//得到脚本对象
script = GameObject.Find("/Main Camera").GetComponent<Hore>();
//在游戏存档中读取游戏状态数据
gameState = PlayerPrefs.GetInt("gameState",TASK_STATE_DEFAULT);
}
void OnMouseDown()
{
if(gameState == TASK_STATE_OVER)
{
//进入弹出任务窗口状态
gameState = T