95 lines
2.7 KiB
C#
95 lines
2.7 KiB
C#
// ***********************************************************************
|
||
// Assembly : Game
|
||
// Author : Kimch
|
||
// Created : 2020-09-02
|
||
// Description :
|
||
// Last Modified By :
|
||
// Last Modified On :
|
||
// ***********************************************************************
|
||
// <copyright file= "Stat_IdleAction" company="Kimch"></copyright>
|
||
// <summary></summary>
|
||
// ***********************************************************************
|
||
using System.Collections.Generic;
|
||
using UnityEngine;
|
||
namespace G
|
||
{
|
||
public class Stat_DashAttackAction : Stat_BaseAction
|
||
{
|
||
#pragma warning disable CS0414 // 字段“Stat_DashAttackAction.skillID”已被赋值,但从未使用过它的值
|
||
private int skillID;
|
||
#pragma warning restore CS0414 // 字段“Stat_DashAttackAction.skillID”已被赋值,但从未使用过它的值
|
||
|
||
private bool end;
|
||
|
||
public Stat_DashAttackAction(Stat_StateManager statMgr)
|
||
: base(statMgr)
|
||
{
|
||
}
|
||
|
||
public override bool Enter(Dictionary<string, object> param, bool clearDelegates = false)
|
||
{
|
||
end = false;
|
||
base.Enter(param, clearDelegates);
|
||
//string animName = m_char.GetAnimName("dash_attack");
|
||
//if (m_char.PlayAnimation(animName) == -1f)
|
||
//{
|
||
// return false;
|
||
//}
|
||
skillID = 444004;
|
||
m_char.ResetRigidBody();
|
||
m_char.SetAtkCollision(false);
|
||
//((EntityPlayer)m_char).m_canDashAttack = false;
|
||
m_statMgr.AddTimer(m_curAniLength + 0.8f, AnimationEnd_CB);
|
||
m_statMgr.AddTimer(0.55f, PlayFx_CB);
|
||
m_statMgr.AddTimer(0.1f, Force_CB);
|
||
m_char.invincible = true;
|
||
return true;
|
||
}
|
||
|
||
private bool PlayFx_CB(object[] param)
|
||
{
|
||
Transform transform = PrefabManager.Instance().Spawn("dash_attack");
|
||
transform.gameObject.SetActive(false);
|
||
int posType = transform.GetComponent<Ef_base>().m_posType;
|
||
bool rotationWithTarget = transform.GetComponent<Ef_base>().m_rotationWithTarget;
|
||
Ef_base.GetPosByType(transform, m_char.transform, posType, rotationWithTarget);
|
||
Ef_base component = transform.GetComponent<Ef_base>();
|
||
component.m_user = m_char.transform;
|
||
component.m_param[0] = 1f;
|
||
transform.gameObject.SetActive(true);
|
||
//HeroSounds.Instance.PlayHitSound((EntityPlayer)m_char, 1);
|
||
return false;
|
||
}
|
||
|
||
private bool AnimationEnd_CB(object[] param)
|
||
{
|
||
end = true;
|
||
m_char.invincible = false;
|
||
return SetCurActionState(enStat.STAT_ACTION_MOVE);
|
||
}
|
||
|
||
private bool Force_CB(object[] param)
|
||
{
|
||
Vector3 a = m_char.position - m_char.GetTargetPos();
|
||
a.Normalize();
|
||
a.y = 0f;
|
||
m_char.AddForce(-a * 150f);
|
||
return false;
|
||
}
|
||
|
||
public override bool CanTransition(enStat stat)
|
||
{
|
||
if (stat == enStat.STAT_ACTION_DEAD)
|
||
{
|
||
m_char.invincible = false;
|
||
return true;
|
||
}
|
||
if (end)
|
||
{
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
}
|