2026-01-16 03:05:10 +00:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class SupporterActor : MonoBehaviour
|
|
|
|
|
{
|
2026-01-16 05:24:29 +00:00
|
|
|
public Transform tf_projectile;
|
2026-01-16 03:05:10 +00:00
|
|
|
public float MaxAttackCoolTime = 2f;
|
|
|
|
|
public int Damage = 5;
|
|
|
|
|
|
|
|
|
|
float attackCoolTime;
|
|
|
|
|
ProjectileData m_PD = new ProjectileData();
|
|
|
|
|
|
|
|
|
|
private void OnEnable()
|
|
|
|
|
{
|
|
|
|
|
attackCoolTime = MaxAttackCoolTime;
|
2026-01-16 05:45:58 +00:00
|
|
|
m_PD.ActorType = eActor.Supporter;
|
2026-01-16 03:05:10 +00:00
|
|
|
m_PD.Dmg = Damage;
|
|
|
|
|
m_PD.m_Data = table_projectile.Ins.Get_Data(3201);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
|
|
|
|
attackCoolTime -= Time.deltaTime;
|
|
|
|
|
if (attackCoolTime < 0)
|
|
|
|
|
{
|
|
|
|
|
attackCoolTime = MaxAttackCoolTime;
|
|
|
|
|
var mob = IngameMgr.Ins.FindNearestMob(transform.position, null);
|
2026-01-16 03:49:39 +00:00
|
|
|
if (mob != null)
|
|
|
|
|
{
|
|
|
|
|
UpdateAngle(mob.transform.position);
|
2026-01-16 05:24:29 +00:00
|
|
|
m_PD.tf_Start = tf_projectile;
|
2026-01-16 06:21:49 +00:00
|
|
|
m_PD.Ignore_WallHP = true;
|
2026-01-16 03:49:39 +00:00
|
|
|
ProjectileMgr.Ins.Shoot_Projectile(m_PD);
|
|
|
|
|
}
|
2026-01-16 03:05:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void UpdateAngle(Vector2 targetWorldPos)
|
|
|
|
|
{
|
2026-01-16 05:24:29 +00:00
|
|
|
Vector2 dir = targetWorldPos - (Vector2)tf_projectile.position;
|
2026-01-16 03:05:10 +00:00
|
|
|
|
|
|
|
|
if (dir.sqrMagnitude < 0.0001f)
|
|
|
|
|
return;
|
|
|
|
|
|
2026-01-16 05:24:29 +00:00
|
|
|
tf_projectile.up = dir.normalized;
|
2026-01-16 03:05:10 +00:00
|
|
|
}
|
|
|
|
|
}
|