2025-05-18 01:04:31 +08:00

71 lines
1.9 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using G;
using UnityEngine;
public class Ef_toudan : Ef_base
{
public Vector3 m_targetPos = default(Vector3);
public float m_speed = 1.5f;
public Transform fx;
#pragma warning disable CS0414 // 字段“Ef_toudan.m_direction”已被赋值但从未使用过它的值
private Vector3 m_direction = default(Vector3);
#pragma warning restore CS0414 // 字段“Ef_toudan.m_direction”已被赋值但从未使用过它的值
#pragma warning disable CS0414 // 字段“Ef_toudan.m_endPosition”已被赋值但从未使用过它的值
private Vector3 m_endPosition = default(Vector3);
#pragma warning restore CS0414 // 字段“Ef_toudan.m_endPosition”已被赋值但从未使用过它的值
private Quaternion m_fromRotation;
private float m_currentLerp;
private void Start()
{
}
private void OnEnable()
{
m_transform = base.transform;
if (base.m_user)
{
m_transform.position = base.m_user.position + Vector3.up * 0.03f;
base.m_scriptUser = base.m_user.GetComponent<EntityCha>();
if (base.m_scriptUser.target != null)
{
base.m_scriptUser.LookToTarget(base.m_scriptUser.target.transform);
m_targetPos = base.m_scriptUser.GetTargetPos();
}
}
}
private void Update()
{
//if (base.m_user)
{
UserToTargetBezier();
}
}
private void UserToTargetBezier()
{
float num = Vector3.Distance(m_targetPos, m_transform.position);
if (num <= 0.1f)
{
if (m_scriptUser)
{
Transform transform = PrefabManager.Instance().Spawn(fx, m_targetPos, base.m_user.rotation);
transform.GetComponent<Ef_fixed>().m_user = base.m_user;
transform.GetComponent<Ef_fixed>().m_skillId = base.m_skillId;
transform.GetComponent<Ef_fixed>().m_param[0] = m_param[0];
}
Destroy(this.gameObject);
}
else
{
Vector3 a = m_targetPos - m_transform.position;
a.Normalize();
m_transform.position += a * Time.deltaTime * m_speed;
}
}
}