|
using System;
|
using UnityEngine;
|
|
public abstract class Status_Base : IStatus
|
{
|
private const ushort sNoMove = 0x0001;
|
private const ushort sNoRide = 0x0002;
|
private const ushort sNoCollect = 0x0004;
|
private const ushort sNoSit = 0x0008;
|
private const ushort sNoCatch = 0x0010;
|
private const ushort sNoFish = 0x0020;
|
private const ushort sNoDance = 0x0040;
|
private const ushort sNoLook = 0x0080;
|
private const ushort sNoUseItem = 0x0100;
|
|
public H0605_tagObjAddBuff h0605;
|
protected SkillConfig m_SkillConfig;
|
|
private SFXController m_Effect;
|
|
public DateTime receiveTime { get; private set; }
|
|
public virtual void Init(H0605_tagObjAddBuff data)
|
{
|
h0605 = data;
|
|
receiveTime = TimeUtility.ServerNow;
|
|
m_SkillConfig = SkillConfig.Get(data.SkillID);
|
|
if (m_SkillConfig == null)
|
{
|
DebugEx.LogWarningFormat("配置是否出错: {0}", data.SkillID);
|
return;
|
}
|
|
GActorFight _target = GAMgr.Instance.GetBySID(data.ObjID) as GActorFight;
|
if (_target == null)
|
{
|
return;
|
}
|
|
if (!(_target is GA_Player) || BattleEffectPlayRule.Instance.CanPlay(data.ObjID))
|
{
|
if (_target != null)
|
{
|
if (m_SkillConfig.BuffEffectID > 0)
|
{
|
if (m_Effect)
|
{
|
SFXPlayUtility.Instance.Release(m_Effect);
|
}
|
|
bool _playEffect = true;
|
|
if (h0605.ObjID != PlayerDatas.Instance.PlayerId)
|
{
|
if (!_target.ShowOrHide
|
|| SystemSetting.Instance.GetCurrentQualityLevel() == GameQuality.Low)
|
{
|
_playEffect = false;
|
}
|
}
|
|
if (_playEffect)
|
{
|
m_Effect = SFXPlayUtility.Instance.PlayBattleEffect(m_SkillConfig.BuffEffectID, _target);
|
if (m_Effect)
|
{
|
m_Effect.m_OnFinished += OnEffectOver;
|
}
|
}
|
}
|
}
|
}
|
|
if (data.BuffType == (int)E_BuffType.bfActionBuff)
|
{
|
GActorPlayerBase _player = _target as GActorPlayerBase;
|
|
if (!CanMove())
|
{
|
if (_target is GActorPlayerBase)
|
{
|
_player = _target as GActorPlayerBase;
|
_player.OnHorse(0);
|
_player.StopRush();
|
}
|
|
if (_target.State == E_ActorState.AutoRun)
|
{
|
_target.StopPathFind();
|
}
|
|
if (_target is GA_Player)
|
{
|
GA_Player _otherPlayer = _target as GA_Player;
|
_otherPlayer.StopMoveToPosition();
|
}
|
_player.IdleImmediate();
|
}
|
|
// 调用动作
|
if (m_SkillConfig.CtrlActionID != 0)
|
{
|
if (_player != null)
|
{
|
_player = _target as GActorPlayerBase;
|
_player.OnHorse(0);
|
}
|
|
_target.NextAction = m_SkillConfig.CtrlActionID;
|
|
if (_target.SkillMgr.CurCastSkill != null)
|
{
|
_target.SkillMgr.CurCastSkill.SkillCompelete = true;
|
}
|
}
|
}
|
}
|
|
public abstract void Update();
|
|
private void OnEffectOver(SFXController sfc)
|
{
|
if (m_Effect)
|
{
|
m_Effect.m_OnFinished -= OnEffectOver;
|
m_Effect = null;
|
}
|
}
|
|
public virtual void UnInit(uint objID, byte buffType)
|
{
|
if (m_Effect)
|
{
|
m_Effect.m_OnFinished -= OnEffectOver;
|
SFXPlayUtility.Instance.Release(m_Effect);
|
m_Effect = null;
|
}
|
|
GActorFight _target = GAMgr.Instance.GetBySID(objID) as GActorFight;
|
|
if (_target != null)
|
{
|
if (buffType == (int)E_BuffType.bfActionBuff)
|
{
|
// 调用动作
|
if (m_SkillConfig.CtrlActionID != 0)
|
{
|
_target.NextAction = GAStaticDefine.Act_Idle;
|
_target.IdleImmediate();
|
}
|
}
|
}
|
|
h0605 = null;
|
}
|
|
public bool CanMove()
|
{
|
return (m_SkillConfig.ClientActionLimit & sNoMove) == 0;
|
}
|
|
public bool CanRide()
|
{
|
return (m_SkillConfig.ClientActionLimit & sNoRide) == 0;
|
}
|
|
public bool CanCollect()
|
{
|
return (m_SkillConfig.ClientActionLimit & sNoCollect) == 0;
|
}
|
|
public bool CanSit()
|
{
|
return (m_SkillConfig.ClientActionLimit & sNoSit) == 0;
|
}
|
|
public bool CanCatch()
|
{
|
return (m_SkillConfig.ClientActionLimit & sNoCatch) == 0;
|
}
|
|
public bool CanFish()
|
{
|
return (m_SkillConfig.ClientActionLimit & sNoFish) == 0;
|
}
|
|
public bool CanDance()
|
{
|
return (m_SkillConfig.ClientActionLimit & sNoDance) == 0;
|
}
|
|
public bool CanLook()
|
{
|
return (m_SkillConfig.ClientActionLimit & sNoLook) == 0;
|
}
|
|
public bool CanUseItem()
|
{
|
return (m_SkillConfig.ClientActionLimit & sNoUseItem) == 0;
|
}
|
|
public bool CanAttack(int skillSeries)
|
{
|
return (m_SkillConfig.ClientSkillSeriesLimit & skillSeries) == 0;
|
}
|
|
public bool CanUseSkill()
|
{
|
return m_SkillConfig.ClientSkillSeriesLimit == 0
|
|| (m_SkillConfig.ClientSkillSeriesLimit & 2) == 0;
|
}
|
}
|