CultivateImmortal/Assets/Scripts/GameObject/FeiJian.cs

30 lines
669 B
C#
Raw Normal View History

2024-11-14 18:15:51 +08:00
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<PlayerData>(E_EventType.E_Monster_Wound,GameDataMgr.Instance.player);
this.transform.position=Vector3.zero;
PoolMgr.Instance.PushObj(this.gameObject);
}
}