shaoxiadiablo/Assets/AGame/Scripts/Game/Stat/Stat_CommonAniAction.cs

83 lines
2.3 KiB
C#
Raw Permalink Normal View History

2025-05-18 01:04:31 +08:00
// ***********************************************************************
// 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_CommonAniAction : Stat_Base
{
#pragma warning disable CS0649 // 从未对字段“Stat_CommonAniAction.m_curAniLength”赋值字段将一直保持其默认值 0
private float m_curAniLength;
#pragma warning restore CS0649 // 从未对字段“Stat_CommonAniAction.m_curAniLength”赋值字段将一直保持其默认值 0
private bool m_end;
private string m_aniName;
public Stat_CommonAniAction(Stat_StateManager statMgr)
: base(statMgr)
{
}
public override bool Enter(Dictionary<string, object> param, bool clearDelegates = false)
{
m_end = false;
//m_char.m_animation.Stop();
bool flag = false;
flag = base.Enter(param, clearDelegates);
//m_curAniLength = m_char.PlayAnimationByName((string)param["name"]);
if (m_curAniLength == -1f)
{
Debug.LogError("Can not find AniName:" + (string)param["name"]);
return false;
}
m_aniName = (string)param["name"];
m_statMgr.AddTimer(m_curAniLength, AnimationEnd_CB);
return flag;
}
private bool AnimationEnd_CB(object[] param)
{
m_end = true;
//if (m_aniName == "evade" && LevelData.levelType != LevelType.Arena && m_char.m_data.HasBuffState(141))
//{
// m_statMgr.SetCurActionState(enStat.STAT_ACTION_DASHATTACK);
// return true;
//}
m_statMgr.SetCurActionState(enStat.STAT_ACTION_IDLE);
return true;
}
public override bool CanTransition(enStat stat)
{
switch (stat)
{
case enStat.STAT_ACTION_DEAD:
return true;
case enStat.STAT_ACTION_CHACKLES:
return true;
default:
//if (MonoInstancePool.getInstance<GuideLocalData>().curGuideModule == 0)
//{
// return true;
//}
if (m_end)
{
return true;
}
return false;
}
}
}
}