200 lines
3.7 KiB
C#
Raw Permalink Normal View History

2025-05-18 01:04:31 +08:00
using UnityEngine;
namespace G
{
public class NormalAtkDouble : NormalAtkBase
{
private int[] ADD_RIGIDBODY_FORCE = new int[5]
{
120,
120,
0,
150,
0
};
private bool[] EF_SWING1_ENABLE = new bool[5]
{
true,
true,
true,
true,
true
};
private Quaternion[] EF_SWING1_ROTATION = new Quaternion[5]
{
Quaternion.Euler(0f, 0f, 180f),
Quaternion.Euler(0f, 0f, 340f),
Quaternion.Euler(0f, 0f, 90f),
Quaternion.Euler(-20f, 0f, -90f),
Quaternion.Euler(0f, 0f, 170f)
};
private Vector3[] EF_SWING1_OFF = new Vector3[5]
{
Vector3.up * 0.06f,
Vector3.up * 0.06f,
Vector3.up * 0.14f,
Vector3.up * 0.06f,
Vector3.up * 0.06f
};
private bool[] EF_SWING1_RISING = new bool[5]
{
false,
false,
true,
false,
true
};
private float[] EF_SWING1_DELAY = new float[5]
{
0.3f,
0.2f,
0.15f,
0.11f,
0.35f
};
private int[] EF_SWING1_FORCE = new int[5]
{
0,
0,
140,
0,
180
};
private float[] EF_SWING1_RIGHT_OFF = new float[5]
{
0f,
0f,
0f,
0f,
-0.07f
};
private bool[] EF_SWING2_ENABLE = new bool[5]
{
true,
true,
true,
false,
true
};
private Quaternion[] EF_SWING2_ROTATION = new Quaternion[5]
{
Quaternion.Euler(0f, 0f, -40f),
Quaternion.Euler(0f, 0f, 10f),
Quaternion.Euler(0f, 0f, 90f),
Quaternion.identity,
Quaternion.Euler(0f, 0f, 10f)
};
private Vector3[] EF_SWING2_OFF = new Vector3[5]
{
Vector3.up * 0.08f,
Vector3.up * 0.06f,
Vector3.up * 0.16f,
Vector3.zero,
Vector3.up * 0.055f
};
private bool[] EF_SWING2_RISING = new bool[5]
{
false,
false,
true,
false,
true
};
private float[] EF_SWING2_DELAY = new float[5]
{
0.6f,
0.4f,
0.31f,
0f,
0.35f
};
private int[] EF_SWING2_FORCE = new int[5]
{
100,
100,
80,
0,
0
};
private float[] EF_SWING2_RIGHT_OFF = new float[5]
{
0f,
0f,
0f,
0f,
0.07f
};
public NormalAtkDouble()
{
m_weaponType = 2;
}
protected override float UpdateStep(int nStep)
{
float result = 0f;
if (nStep < 0 || nStep > m_totalStep)
{
return result;
}
OnFog(0);
float atkSpeed = m_unit.GetAtkSpeed();
m_unit.PlayAnimation(ANIM_NAME[nStep]);
//result = m_unit.GetAnimationTime(ANIM_NAME[nStep]);
//if (EX_ANIM_NAME[nStep].Length > 0)
//{
// m_tmpAttack = m_unit.PlayAnimationQueued(EX_ANIM_NAME[nStep]);
// m_tmpAttack.speed = 0.719999969f;
// m_tmpAttack.layer = 1;
//}
int num = 0;
Vector3 value = m_target.position - m_unit.position;
value.y = 0f;
Vector3 vector = Vector3.Normalize(value);
if (ADD_RIGIDBODY_FORCE[nStep] > 0)
{
m_unit.MoveWithNormalAtk(vector * ADD_RIGIDBODY_FORCE[nStep]);
}
m_unit.LookToTarget(m_target.transform);
if (EF_SWING1_ENABLE[nStep])
{
m_efSwing1.localRotation = EF_SWING1_ROTATION[nStep];
m_efSwing1.position = m_transform.position + m_transform.right * EF_SWING1_RIGHT_OFF[nStep] + EF_SWING1_OFF[nStep];
//m_swingScript.m_attackRising = EF_SWING1_RISING[nStep];
num = EF_SWING1_FORCE[nStep];
m_swingScript.SwingOn(EF_SWING1_DELAY[nStep] - atkSpeed, 2, 2, 20, 1, num);
}
if (EF_SWING2_ENABLE[nStep])
{
m_efSwing2.localRotation = EF_SWING2_ROTATION[nStep];
m_efSwing2.position = m_transform.position + m_transform.right * EF_SWING2_RIGHT_OFF[nStep] + EF_SWING2_OFF[nStep];
//m_swingScript2.m_attackRising = EF_SWING2_RISING[nStep];
num = EF_SWING2_FORCE[nStep];
m_swingScript2.SwingOn(EF_SWING2_DELAY[nStep] - atkSpeed, 2, 2, 20, 1, num);
}
m_unit.SetCurDir(vector);
return result;
}
public override void CancelAtk()
{
base.CancelAtk();
m_swingScript.SwingOff();
m_swingScript2.SwingOff();
}
}
}