贺州人民医院电子沙盘
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

69 lines
2.3 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using AX.MessageSystem;
using UnityEngine;
public class StaffTask : MonoBehaviour
{
private string loadPath = "assets/prefabs/prefabs/xfpeople/";
Transform paiyanji;
Transform wuchiju;
// Use this for initialization
void Start()
{
MessageDispatcher.AddListener("TaskChange", TaskChange);
GetComponent<PowerAttribute>().Tasklist = new string[] { "待命", "出水", "侦察", "搜救", "警戒", "破拆", "排烟", "询问知情人", "占领消防控制室" };
}
public void TaskChange(IMessage Message)
{
string task = (string)Message.Data;
if (!SelectedObjs.selectedCharacters.Contains(gameObject))
return;
Execute(task);
}
public void Execute(string TaskName)
{
if (TaskName == "排烟")
{
paiyanji = transform.Find("PaiYanJi(Clone)");
//if (!paiyanji)
// StartCoroutine(LoadAssetBundles.getInstance().LoadAssetByName<GameObject>(loadPath + "paiyanji.prefab", (obj) => { paiyanji = Instantiate(obj, transform).transform; }));
//else
// paiyanji.gameObject.SetActive(true);
}
else
{
if (paiyanji)
paiyanji.gameObject.SetActive(false);
}
if (TaskName == "破拆")
{
wuchiju = transform.Find("WuChiJu(Clone)");
//if (!wuchiju)
// StartCoroutine(LoadAssetBundles.getInstance().LoadAssetByName<GameObject>(loadPath + "wuchiju.prefab", (obj) => { wuchiju = Instantiate(obj, transform).transform; }));
//else
// wuchiju.gameObject.SetActive(true);
}
else
{
if (wuchiju)
wuchiju.gameObject.SetActive(false);
}
if (TaskName.Contains("出水"))
{
//WaterFlowAttribute.Instance.gameObject.SetActive(true);
MessageDispatcher.SendMessage("SprayWater", true);
}
else
{
//WaterFlowAttribute.Instance.gameObject.SetActive(false);
MessageDispatcher.SendMessage("SprayWater", false);
}
}
private void OnDestroy()
{
MessageDispatcher.RemoveListener("TaskChange", TaskChange);
}
}