using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class DropEffectNode : MonoBehaviour { public Transform dropObj; bool _isStop = false; float desTime = 2; // Start is called before the first frame update void Start() { } // Update is called once per frame void FixedUpdate() { desTime -= Time.deltaTime; if(desTime <= 0) { Destroy(this.transform.parent.gameObject); } if (_isStop) { return; } if(dropObj) { dropObj.transform.position = this.transform.position; NavMeshHit hit; NavMesh.SamplePosition(dropObj.transform.position, out hit, 4, 1); } } public void SetDropItem(Transform item) { dropObj = item; } public void Stop() { _isStop = true; } }