1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- 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<SceneEventAreaLock>();
- this.areaIndex = info.areaIndex;
- int curMapId = UserProxy.Instance.player.newMap.curMapId;
- List<string> 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<SceneEventGateLogic>(out door))
- {
- isUnlockDoor = true;
- door.OpenDoor();
- }
- else
- {
- Animator anim = this.gameObject.GetComponent<Animator>();
- if (anim)
- {
- anim.Play("zhandou_jiejie_end",0,0);
- }
- SceneEventExploreLogic expLogix = this.GetComponent<SceneEventExploreLogic>();
- expLogix.ExploreTrigger();
- }
- }
- public void AreaClose()
- {
- Animator anim = this.gameObject.GetComponent<Animator>();
- if (anim)
- {
- anim.Play("zhandou_jiejie_end", 0, 0);
- }
- }
- }
|