using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class CombatChangeMapCom : MonoBehaviour { private Transform frontHero; public Transform[] ChangeMapTransforms; public Transform[] ChangeMapNodes; public void OnEnable() { ChangeMapTransforms[0].transform.localPosition = Vector3.zero; ChangeMapTransforms[1].transform.localPosition = Vector3.forward * 22; frontHero = null; } void Start() { } private float _timer; private bool _isEnable; private int curIndex = 1; void Update() { _timer += Time.deltaTime; if (_timer > 1) { _timer = 0; if (frontHero == null) { frontHero = Player.Instance.transform; } if (frontHero != null) { if (frontHero.position.z > ChangeMapNodes[curIndex].position.z) { if (curIndex == 1) { ChangeMapTransforms[0].position = ChangeMapNodes[curIndex].position + Vector3.forward * 22; curIndex = 0; } else { ChangeMapTransforms[1].position = ChangeMapNodes[curIndex].position + Vector3.forward * 22; curIndex = 1; } } } } } }