using System.Collections; using System.Collections.Generic; using UnityEngine; public class FeiJian : MonoBehaviour { public RectTransform rec; public float moveSpeed; private Vector3 startPos; void OnEnable() { startPos = rec.localPosition; } void Update() { startPos.x += Time.deltaTime* moveSpeed; rec.localPosition= startPos; } void OnTriggerEnter2D(Collider2D collider2D) { EventCenter.Instance.EventTrigger(E_EventType.E_Monster_Wound,GameDataMgr.Instance.player); this.transform.position=Vector3.zero; PoolMgr.Instance.PushObj(this.gameObject); } }