|
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;
|
|
protected SkillConfig m_SkillConfig;
|
|
private SFXController m_Effect;
|
|
public uint Sid { get; protected set; }
|
public int SkillID { get; protected set; }
|
public int BuffType { get; protected set; }
|
public uint CasterSid { get; protected set; }
|
public int LastTime { get; protected set; }
|
|
public DateTime receiveTime { get; private set; }
|
|
public virtual void Init(uint sid, int skillId, uint srcSid, int type, int lastTime)
|
{
|
Sid = sid;
|
SkillID = skillId;
|
BuffType = type;
|
CasterSid = srcSid;
|
receiveTime = TimeUtility.ServerNow;
|
LastTime = lastTime;
|
|
m_SkillConfig = SkillConfig.Get(skillId);
|
|
if (m_SkillConfig == null)
|
{
|
DebugEx.LogWarningFormat("配置是否出错: {0}", skillId);
|
return;
|
}
|
|
var _realSID = sid;
|
if (PersonalEnemy.m_SBindCDict.ContainsKey(sid))
|
{
|
_realSID = PersonalEnemy.m_SBindCDict[sid];
|
}
|
|
GActorFight _target = GAMgr.Instance.GetBySID(_realSID) as GActorFight;
|
if (_target == null)
|
{
|
return;
|
}
|
|
if (!(_target is GA_Player) || BattleEffectPlayRule.Instance.CanPlay(sid))
|
{
|
if (_target != null)
|
{
|
if (m_SkillConfig.BuffEffectID > 0)
|
{
|
if (m_Effect)
|
{
|
SFXPlayUtility.Instance.Release(m_Effect);
|
}
|
|
bool _playEffect = true;
|
|
if (sid != 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 (type == (int)E_BuffType.bfActionBuff)
|
{
|
GActorPlayerBase _player = _target as GActorPlayerBase;
|
if (_player != null)
|
{
|
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;
|
}
|
}
|
}
|
}
|
|
var _info = SkillHelper.Instance.Get(SkillID);
|
SkillHelper.EffectValue _effectValue;
|
if (_info.effectValue.TryGetValue(1090, out _effectValue))
|
{
|
if (m_Effect)
|
{
|
var _atker = GAMgr.Instance.GetBySID(CasterSid);
|
var _self = GAMgr.Instance.GetBySID(Sid);
|
if (_atker != null && _self != null)
|
{
|
var _ctrl = m_Effect.AddMissingComponent<FoTransmitController>();
|
_ctrl.start = _atker.MP_Hit;
|
_ctrl.end = _self.MP_Hit;
|
_ctrl.transmit = m_Effect;
|
_ctrl.enabled = true;
|
m_Effect.transform.position = _ctrl.start.position;
|
m_Effect.transform.LookAt(_self.MP_Hit);
|
if (_ctrl.start && _ctrl.end)
|
{
|
m_Effect.transform.localScale = new Vector3(1, 1, Vector3.Distance(_ctrl.end.position, _ctrl.start.position));
|
}
|
}
|
}
|
}
|
}
|
|
public virtual void Update()
|
{
|
|
}
|
public virtual bool IsComplete()
|
{
|
GActorFight _target = GAMgr.Instance.GetBySID(Sid) as GActorFight;
|
if (_target == null)
|
{
|
return true;
|
}
|
return false;
|
}
|
|
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);
|
var _ctrl = m_Effect.GetComponent<FoTransmitController>();
|
if (_ctrl)
|
{
|
_ctrl.enabled = false;
|
}
|
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();
|
}
|
}
|
}
|
}
|
|
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;
|
}
|
}
|