using ShadowStudio.Model; using System.Collections; using System.Collections.Generic; using UnityEngine; using XRTool.Util; using static ArtTaskAction; using static ArtTaskInfo; public class ArtTaskChild : MonoBehaviour { public TaskType ttype; public ArtContainerHandler artContainerHandler; private void OnDestroy() { ArtTaskInfo.removeChild(this); } private void Start() { ArtTaskInfo.addChild(this); } // Update is called once per frame void Update() { checkPos(); } public bool isFinish; void checkPos() { if(!isFinish&& !CommonMethod.isLookRoom()) { List ata = ArtTaskInfo.getTaskList(); for (int i = 0; i < ata.Count; i++) { GameObject TaskGame = ata[i].actionGame; ArtTaskAction taskAction = ata[i]; if(ata[i].ttype==ttype) { if (taskAction.aaType == ArtActionType.ACTION) { float dic = Vector3.Distance(this.transform.position, TaskGame.transform.position); if (dic < 0.1f) { taskAction.showFinishAction(true); isFinish = true; if (artContainerHandler != null) { Debug.Log("删除Container"); artContainerHandler.DelArtSync(); } } } } else { if (taskAction.aaType == ArtActionType.ACTION) { float dic = Vector3.Distance(this.transform.position, TaskGame.transform.position); if (dic < 0.1f) { taskAction.ShowTipError(); isFinish = true; if (artContainerHandler != null) { Debug.Log("删除Container"); artContainerHandler.DelArtSync(); } } } } } } } }