CultivateImmortal/Assets/Scripts/GameObject/FeiJian.cs

40 lines
1006 B
C#
Raw Permalink 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;
GameMgr.Instance.isFeijianClose = false;
2024-11-14 18:15:51 +08:00
}
void Update()
{
//<2F>ɽ<EFBFBD><C9BD>ڷ<EFBFBD><DAB7>й<EFBFBD><D0B9><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB>˵<EFBFBD>ͼ<EFBFBD><CDBC>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (GameMgr.Instance.isFeijianClose)
{
this.transform.position = Vector3.zero;
PoolMgr.Instance.PushObj(this.gameObject);
return;
}
2024-11-14 18:15:51 +08:00
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;
rec.localScale = Vector3.one;
2024-11-14 18:15:51 +08:00
PoolMgr.Instance.PushObj(this.gameObject);
}
}