using System.Collections; using System.Collections.Generic; using UnityEngine; public class SceneEventAreaLockLogic : MonoBehaviour { public int areaIndex = 0; private bool isUnlockDoor = false; // Start is called before the first frame update void Start() { AIManager.Instance.AddAreaLockCmpt(this); SceneEventAreaLock info = this.gameObject.GetComponent(); this.areaIndex = info.areaIndex; int curMapId = UserProxy.Instance.player.newMap.curMapId; List unlockInfo = MapProxy.Instance.getMapUnlockInfoList(curMapId); foreach(var item in unlockInfo) { string[] unlock = item.Split('_'); if(curMapId == int.Parse(unlock[0]) && int.Parse(unlock[1]) == (int)(SceneEventExplore.ExploreType.Border) && areaIndex == int.Parse(unlock[2])) { AreaClose(); } } } public bool IsUnlockDoor { get { return this.isUnlockDoor; } } public void AreaUnlock() { SceneEventGateLogic door; if (this.TryGetComponent(out door)) { isUnlockDoor = true; door.OpenDoor(); } else { Animator anim = this.gameObject.GetComponent(); if (anim) { anim.Play("zhandou_jiejie_end",0,0); } SceneEventExploreLogic expLogix = this.GetComponent(); expLogix.ExploreTrigger(); } } public void AreaClose() { Animator anim = this.gameObject.GetComponent(); if (anim) { anim.Play("zhandou_jiejie_end", 0, 0); } } }