using System.Collections.Generic;
|
using vnxbqy.UI;
|
|
using UnityEngine;
|
using UnityEngine.Events;
|
|
public class GA_Player : GActorPlayerBase, IOtherSelectable
|
{
|
// 为守护特殊定义的当前是否装备守护id
|
public int serverGuardId;
|
|
public static UnityAction<uint, bool> s_OnSelected;
|
public static UnityAction<uint, ulong, ulong> s_OnRefreshLife;
|
private static Dictionary<int, Dictionary<int, List<int>>> m_StaticOffLineSkllList = new Dictionary<int, Dictionary<int, List<int>>>();
|
private int[] m_OffLineSkillList;
|
public H0434_tagAreaPlayerAppearEx m_H0434;
|
|
private CmdManager m_CmdManager;
|
|
private int m_ComAtkIndex;// 普攻索引
|
|
protected override void OnInit(GameNetPackBasic package)
|
{
|
m_H0434 = package as H0434_tagAreaPlayerAppearEx;
|
|
if (m_H0434 == null)
|
{
|
return;
|
}
|
|
base.OnInit(package);
|
|
if (CanBeSelected())
|
{
|
CapsuleCollider _capCollider = Root.AddMissingComponent<CapsuleCollider>();
|
_capCollider.height = 1.2f;
|
_capCollider.center = new Vector3(0, .6f, 0);
|
_capCollider.radius = .4f;
|
|
Evt_PlayerClick _evtClick = Root.AddMissingComponent<Evt_PlayerClick>();
|
_evtClick.ownerSID = ServerInstID;
|
}
|
|
Root.gameObject.layer = LayerUtility.Player;
|
|
// 初始化坐标
|
AdjustPos(m_H0434.PosX, m_H0434.PosY);
|
ActorInfo.serverBornPos = new Vector2(m_H0434.PosX, m_H0434.PosY);
|
// 计算移动速度
|
CalculateMoveSpeed(m_H0434.Speed);
|
|
CalculateAtkSpeed((ushort)m_H0434.AtkInterval);
|
|
// 处理职业配置
|
JobSetup = JobSetupConfig.Get(m_H0434.Job);
|
|
// 处理装备
|
H0434_tagAreaPlayerAppearEx.tagEquipInfo _equipInfo;
|
|
ItemConfig _itemConfig;
|
// 因为衣服是所有装备的父节点, 需要预先处理衣服
|
for (int i = 0; i < m_EquipDict.Count; ++i)
|
{
|
_equipInfo = m_H0434.EquipInfo[i];
|
_itemConfig = ItemConfig.Get((int)_equipInfo.ItemID);
|
|
m_EquipDict[_itemConfig.EquipPlace] = _equipInfo.ItemID;
|
|
if (_itemConfig.EquipPlace == (byte)RoleEquipType.FashionClothes)
|
{
|
SwitchClothes(_equipInfo.ItemID, _itemConfig.EquipPlace);
|
}
|
else if (_itemConfig.EquipPlace == (byte)RoleEquipType.Clothes)
|
{
|
SwitchClothes(_equipInfo.ItemID);
|
}
|
}
|
// 如果没有任何衣服, 则穿上默认装备
|
if (ClothesItemID == 0 || ClothesItemID == uint.MaxValue)
|
{
|
SwitchClothes(0);
|
}
|
|
// 处理其他装备
|
for (int i = 0; i < m_H0434.EquipCount; ++i)
|
{
|
_equipInfo = m_H0434.EquipInfo[i];
|
_itemConfig = ItemConfig.Get((int)_equipInfo.ItemID);
|
if (_itemConfig.EquipPlace == (int)RoleEquipType.FashionWeapon)
|
{
|
SwitchWeapon(_equipInfo.ItemID, _itemConfig.EquipPlace);
|
continue;
|
}
|
else if (_itemConfig.EquipPlace == (int)RoleEquipType.Weapon)
|
{
|
SwitchWeapon(_equipInfo.ItemID);
|
continue;
|
}
|
|
if (_itemConfig.EquipPlace == (int)RoleEquipType.FashionWeapon2)
|
{
|
SwitchSecondary(_equipInfo.ItemID, _itemConfig.EquipPlace);
|
continue;
|
}
|
else if (_itemConfig.EquipPlace == (int)RoleEquipType.Weapon2)
|
{
|
SwitchSecondary(_equipInfo.ItemID);
|
continue;
|
}
|
|
if (_itemConfig.EquipPlace == (int)RoleEquipType.Wing)
|
{
|
SwitchWing(_equipInfo.ItemID);
|
}
|
else if (_itemConfig.EquipPlace == (int)RoleEquipType.Guard)
|
{
|
var _index = BattleEffectPlayRule.Instance.GetIndex(ServerInstID);
|
if (_index != -1 && _index < BattleEffectPlayRule.Instance.petLimit)
|
{
|
SwitchGuard(_equipInfo.ItemID);
|
}
|
serverGuardId = (int)_equipInfo.ItemID;
|
}
|
else if (_itemConfig.EquipPlace == (int)RoleEquipType.Mount)
|
{
|
ActorInfo.horseItemID = _equipInfo.ItemID;
|
}
|
}
|
|
SyncSuitEffect((m_H0434.EquipShowSwitch % 10) == 1);
|
|
if (ActorInfo.horseItemID != 0 && m_H0434.PlayerState == 2)
|
{
|
OnHorse(1);
|
}
|
|
if (WeaponItemID == 0 || WeaponItemID == uint.MaxValue)
|
{
|
SwitchWeapon(0);
|
}
|
|
if (SecondaryID == 0 || SecondaryID == uint.MaxValue)
|
{
|
SwitchSecondary(0);
|
}
|
|
ActorInfo.LV = m_H0434.LV;
|
ActorInfo.familyName = m_H0434.FamilyName;
|
ActorInfo.ReincarnationLv = m_H0434.ReincarnationLv;
|
ActorInfo.Job = m_H0434.Job;
|
ActorInfo.face = (int)m_H0434.Face;
|
ActorInfo.facePic = (int)m_H0434.FacePic;
|
ActorInfo.realm = m_H0434.OfficialRank;
|
ActorInfo.titleID = m_H0434.CurDienstgradID;
|
ActorInfo.PlayerName = m_H0434.PlayerName;
|
ActorInfo.teamID = m_H0434.TeamID;
|
ActorInfo.familyID = m_H0434.FamilyID;
|
ActorInfo.faction = m_H0434.Faction;
|
ActorInfo.Hp = m_H0434.HP + m_H0434.HPEx * Constants.ExpPointValue;
|
ActorInfo.MaxHp = m_H0434.MaxHP + m_H0434.MaxHPEx * Constants.ExpPointValue;
|
ActorInfo.ExAttr1 = m_H0434.ExAttr1;
|
|
if ((package != null && package.socketType == ServerType.CrossSever && CrossServerUtility.IsCrossServerOneVsOne()))
|
{
|
if (s_OnRefreshLife != null)
|
{
|
s_OnRefreshLife(ServerInstID, ActorInfo.RealHp, ActorInfo.RealMaxHp);
|
}
|
}
|
|
RequestName();
|
|
m_CmdManager = new CmdManager();
|
|
if (m_H0434.State == 1)
|
{
|
if (!m_StaticOffLineSkllList.ContainsKey(m_H0434.Job))
|
{
|
m_StaticOffLineSkllList.Add(m_H0434.Job, new Dictionary<int, List<int>>());
|
|
var _json = LitJson.JsonMapper.ToObject(JobSetup.OffLineSkillList);
|
foreach (var _level in _json.Keys)
|
{
|
var _list = new List<int>();
|
for (int i = 0; i < _json[_level].Count; ++i)
|
{
|
_list.Add((int)_json[_level][i]);
|
}
|
m_StaticOffLineSkllList[m_H0434.Job].Add(int.Parse(_level), _list);
|
}
|
}
|
|
foreach (var _level in m_StaticOffLineSkllList[m_H0434.Job].Keys)
|
{
|
if (m_H0434.LV < _level)
|
{
|
m_OffLineSkillList = m_StaticOffLineSkllList[m_H0434.Job][_level].ToArray();
|
break;
|
}
|
}
|
}
|
}
|
|
private List<SFXController> m_SuitEffectList = new List<SFXController>();
|
|
public override void SyncSuitEffect(bool onOrOff = true)
|
{
|
RlsSuitEffect();
|
|
var _itemConfig = ItemConfig.Get((int)ClothesItemID);
|
if (_itemConfig != null)
|
{
|
Material _replaceMat = null;
|
if (onOrOff)
|
{
|
_replaceMat = MaterialLoader.LoadClothesMaterial(_itemConfig.ChangeOrd, false, true);
|
}
|
else
|
{
|
_replaceMat = MaterialLoader.LoadClothesMaterial(_itemConfig.ChangeOrd, false, false);
|
}
|
if (_replaceMat)
|
{
|
MaterialLoader.Release(m_SMRenderer.material);
|
m_SMRenderer.material = m_Material = _replaceMat;
|
MaterialUtility.SwitchXrayShader(m_SMRenderer.material, false);
|
}
|
|
if (onOrOff)
|
{
|
var _modelResConfig = ModelResConfig.Get(_itemConfig.ChangeOrd);
|
if (_modelResConfig != null)
|
{
|
var _boneList = ModelResConfig.GetBoneList(_modelResConfig.ResourcesName);
|
var _effectList = ModelResConfig.GetEffectList(_modelResConfig.ResourcesName);
|
if (_boneList != null)
|
{
|
Transform _node = null;
|
SFXController _sfx = null;
|
for (int i = 0; i < _boneList.Count; ++i)
|
{
|
_node = Root.GetChildTransformDeeply(_boneList[i]);
|
if (_node)
|
{
|
_sfx = SFXPlayUtility.Instance.PlayEffectAsync(_effectList[i], _node);
|
if (_sfx)
|
{
|
m_SuitEffectList.Add(_sfx);
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
m_SuitEffectShow = onOrOff;
|
}
|
|
private void RlsSuitEffect()
|
{
|
foreach (var _sfx in m_SuitEffectList)
|
{
|
if (_sfx != null)
|
{
|
SFXPlayUtility.Instance.Release(_sfx);
|
}
|
}
|
m_SuitEffectList.Clear();
|
}
|
|
protected sealed override void OnUnit()
|
{
|
ShowOrHideModel(true);
|
RlsSuitEffect();
|
StatusMgr.Instance.ReleaseActor(ServerInstID);
|
|
StopMoveToPosition();
|
|
m_CmdManager = null;
|
m_H0434 = null;
|
m_OffLineSkillList = null;
|
|
m_DoFly = false;
|
|
base.OnUnit();
|
}
|
|
public override void Destroy()
|
{
|
}
|
|
private bool m_DoFly = false;
|
private Vector3 m_FlyTarget = Vector3.zero;
|
private Vector3 m_StartPos;
|
private float m_InCreaseTime;
|
public void StartFly(float x, float y)
|
{
|
x = (x - GA_Hero.MapOffset.x) * .5f;
|
y = (y - GA_Hero.MapOffset.z) * .5f;
|
m_InCreaseTime = 0;
|
m_StartPos = Pos;
|
m_FlyTarget = new Vector3(x, 50, y);
|
RaycastHit _hit;
|
var _ray = new Ray(m_FlyTarget, Vector3.down);
|
if (Physics.Raycast(_ray, out _hit, 100, LayerUtility.WalkbleMask))
|
{
|
m_FlyTarget = _hit.point;
|
m_DoFly = true;
|
Play(GAStaticDefine.State_Fly);
|
Idle();
|
OnHorse(0);
|
StopMoveToPosition();
|
}
|
}
|
|
protected override void OnUpdate()
|
{
|
base.OnUpdate();
|
|
if (m_CmdManager != null)
|
{
|
m_CmdManager.Update();
|
}
|
|
if (m_DoFly)
|
{
|
Forward = MathUtility.ForwardXZ(m_FlyTarget, Pos);
|
m_InCreaseTime += .5f * Time.deltaTime;
|
Pos = Vector3.Lerp(m_StartPos, m_FlyTarget, m_InCreaseTime);
|
var _distance = MathUtility.DistanceSqrtXZ(Pos, m_FlyTarget);
|
if (_distance < 0.05f)
|
{
|
Pos = m_FlyTarget;
|
IdleImmediate();
|
StopPathFind();
|
m_DoFly = false;
|
}
|
}
|
}
|
|
protected sealed override void OnLateUpdate()
|
{
|
base.OnLateUpdate();
|
|
UpdateMove();
|
}
|
|
private bool m_StartMove;
|
private Vector3 m_TargetPos;
|
private bool m_MoveToFinalPos;
|
private Vector3 _dir;
|
private float _time = 0;
|
|
public void MoveToPosition(Vector3 pos, float angle, float speed, bool startOrStop)
|
{
|
ActorInfo.moveSpeed = 500f / speed;
|
m_StartMove = startOrStop;
|
TryGetValidPos(pos, ref m_TargetPos);
|
_dir = MathUtility.ForwardXZ(m_TargetPos, Pos);
|
|
if (m_StartMove)
|
{
|
State = E_ActorState.AutoRun;
|
Run();
|
_time = 0;
|
}
|
else
|
{
|
m_MoveToFinalPos = true;
|
}
|
}
|
|
public void StopMoveToPosition()
|
{
|
m_StartMove = false;
|
m_MoveToFinalPos = false;
|
}
|
|
private void UpdateMove()
|
{
|
if (SkillMgr.CurCastSkill != null)
|
{
|
if (!SkillMgr.CurCastSkill.SkillCompelete)
|
{
|
return;
|
}
|
|
if (SkillMgr.DoingPrepareSkill)
|
{
|
return;
|
}
|
|
if (IsRushing)
|
{
|
return;
|
}
|
}
|
|
if (m_StartMove)
|
{
|
//if (_dir != Vector3.zero)
|
//{
|
// Quaternion _quaternion = Quaternion.LookRotation(_dir, Vector3.up);
|
// Rotation = Quaternion.RotateTowards(Rotation, _quaternion, GeneralDefine.RotateSpeed);
|
// destForward = _dir;
|
//}
|
|
//Vector3 _pos = Pos + ActorInfo.moveSpeed * _dir * Time.deltaTime;
|
//if (TryGetValidPos(_pos, ref _pos))
|
//{
|
// _pos.y = Pos.y;
|
// Pos = _pos;
|
//}
|
if (MathUtility.DistanceSqrtXZ(Pos, m_TargetPos) > 0.1f)
|
{
|
MoveToPosition(m_TargetPos);
|
}
|
|
_time += Time.deltaTime;
|
if (_time > .5f)
|
{
|
m_StartMove = false;
|
m_MoveToFinalPos = true;
|
}
|
|
}
|
else if (m_MoveToFinalPos)
|
{
|
MoveToPosition(m_TargetPos);
|
|
if (MathUtility.DistanceSqrtXZ(Pos, m_TargetPos) < 0.01f)
|
{
|
Pos = new Vector3(m_TargetPos.x, Pos.y, m_TargetPos.z);
|
m_MoveToFinalPos = false;
|
Idle();
|
if (State == E_ActorState.AutoRun)
|
{
|
State = E_ActorState.Idle;
|
}
|
}
|
}
|
}
|
|
protected sealed override void OnFixedUpdate()
|
{
|
base.OnFixedUpdate();
|
}
|
|
public void UpdateData(int proType, uint proValue)
|
{
|
switch ((PlayerDataType)proType)
|
{
|
case PlayerDataType.EquipShowSwitch:
|
m_H0434.EquipShowSwitch = proValue;
|
ReqLingGenEffect((int)(m_H0434.EquipShowSwitch / 10 % 100), (int)(m_H0434.EquipShowSwitch / 1000 % 1000));
|
break;
|
case PlayerDataType.ExAttr1:
|
RequestName();
|
break;
|
}
|
}
|
|
protected sealed override void OnPutonClothes(uint clothesItemID, GameObject clothed)
|
{
|
clothed.layer = LayerUtility.Player;
|
|
SkinnedMeshRenderer _renderer = clothed.GetComponentInChildren<SkinnedMeshRenderer>();
|
_renderer.gameObject.SetLayer(LayerUtility.Player, false);
|
MaterialUtility.SwitchXrayShader(m_Material, false);
|
|
ReqLingGenEffect((int)(m_H0434.EquipShowSwitch / 10 % 100), (int)(m_H0434.EquipShowSwitch / 1000 % 1000));
|
SyncSuitEffect((m_H0434.EquipShowSwitch % 10) > 0);
|
}
|
|
protected sealed override void OnPutonSecondary(uint secondaryItemID, GameObject secondary)
|
{
|
if (!secondary)
|
{
|
return;
|
}
|
Renderer _renderer = secondary.GetComponent<Renderer>();
|
if (_renderer)
|
{
|
_renderer.gameObject.SetLayer(LayerUtility.Player, false);
|
MaterialUtility.SwitchXrayShader(m_SecondaryMaterial, false);
|
}
|
}
|
|
protected sealed override void OnPutonWeapon(uint weaponItemID, GameObject weapon)
|
{
|
Renderer _renderer = weapon.GetComponent<Renderer>();
|
if (_renderer)
|
{
|
_renderer.gameObject.SetLayer(LayerUtility.Player, false);
|
MaterialUtility.SwitchXrayShader(m_WeaponMaterial, false);
|
}
|
}
|
|
protected sealed override void OnPutonWing(uint wingItemID, GameObject wing)
|
{
|
SkinnedMeshRenderer _renderer = wing.GetComponentInChildren<SkinnedMeshRenderer>();
|
_renderer.gameObject.SetLayer(LayerUtility.Player, true);
|
MaterialUtility.SwitchXrayShader(m_WingMaterial, false);
|
}
|
|
protected sealed override void OnSwitchHorse(uint horseID, GameObject horse)
|
{
|
horse.layer = LayerUtility.Player;
|
|
SkinnedMeshRenderer _renderer = horse.GetComponentInChildren<SkinnedMeshRenderer>();
|
_renderer.gameObject.SetLayer(LayerUtility.Player, false);
|
MaterialUtility.SwitchXrayShader(m_HorseMaterial, false);
|
}
|
|
public sealed override void OnHorse(byte upOrDown)
|
{
|
if (upOrDown == 1)
|
{
|
SwitchHorse(ActorInfo.horseItemID);
|
}
|
else
|
{
|
SwitchHorse(0);
|
}
|
}
|
|
public sealed override void RequestName()
|
{
|
ReleaseName();
|
if (MovingState == E_MovingState.Ride)
|
{
|
m_HeadUpName = HeadUpName.RequireHeadUpName(HeadUpName.Pattern.Player, MP_Name1, 0, CameraController.Instance.CameraObject);
|
}
|
else
|
{
|
m_HeadUpName = HeadUpName.RequireHeadUpName(HeadUpName.Pattern.Player, MP_Name, 0, CameraController.Instance.CameraObject);
|
}
|
|
var titleId = PlayerDatas.Instance.baseData.MapID == 31160 ? 0 : ActorInfo.titleID;
|
m_HeadUpName.SetPlayerInfo(new HeadUpName.PlayerInfo()
|
{
|
realm = ActorInfo.realm,
|
title = titleId,
|
name = (UIHelper.ServerStringTrim(ActorInfo.PlayerName) + (ActorInfo.ExAttr1 > 0 ? UIHelper.AppendColor(TextColType.Green, Language.Get("HelpPlayer")) : "")),
|
alliance = ActorInfo.familyName,
|
isHang = m_H0434.State == 1,
|
faction = ActorInfo.faction,
|
}
|
);
|
RefreshShediaoEffect(titleId);
|
|
if (StatusMgr.Instance.IsExist(ServerInstID, StatusMgr.Instance.bossBelongBuffID))
|
{
|
m_HeadUpName.SetBossDropout(true);
|
}
|
|
if (StatusMgr.Instance.IsExist(ServerInstID, StatusMgr.Instance.crossKingBuffID))
|
{
|
m_HeadUpName.SetCrossKing(true);
|
}
|
|
base.SetFairyLeagueHeadUp(PlayerDatas.Instance.baseData.MapID == FairyLeagueModel.FAIRY_LEAGUE_DUNGEON);
|
CheckAncientHeadUp();
|
}
|
|
public sealed override void SwitchRedName(bool on)
|
{
|
if (PlayerDatas.Instance.baseData.MapID == FairyLeagueModel.FAIRY_LEAGUE_DUNGEON)
|
{
|
return;
|
}
|
base.SwitchRedName(on);
|
}
|
|
public sealed override void SwitchYellowName(bool on)
|
{
|
if (PlayerDatas.Instance.baseData.MapID == FairyLeagueModel.FAIRY_LEAGUE_DUNGEON)
|
{
|
return;
|
}
|
base.SwitchYellowName(on);
|
}
|
|
public sealed override void RefreshLifeBar(ulong value)
|
{
|
// Debug.LogFormat("{0} 血量改变: {1}", ServerInstID, value);
|
GA_Hero _hero = PlayerDatas.Instance.hero;
|
if (_hero != null && (_hero.SelectTarget == this
|
|| CrossServerUtility.IsCrossServerOneVsOne()))
|
{
|
if (s_OnRefreshLife != null)
|
{
|
s_OnRefreshLife(ServerInstID, ActorInfo.RealHp, ActorInfo.RealMaxHp);
|
}
|
}
|
}
|
public sealed override bool CanAtked()
|
{
|
if (ActorInfo.serverDie)
|
{
|
return false;
|
}
|
if (ActorInfo.ExAttr1 == PlayerDatas.Instance.baseData.PlayerID)
|
{
|
//协助方不可选中攻击
|
return false;
|
}
|
|
if (ActorInfo.faction != 0 && ActorInfo.faction == PlayerDatas.Instance.baseData.faction)
|
{
|
//同阵营
|
return false;
|
}
|
|
if (PlayerDatas.Instance.maliciousAtkPlayer.Contains(ServerInstID))
|
{
|
return true;
|
}
|
|
if (StatusMgr.Instance.IsInvisible(ServerInstID))
|
{
|
return false;
|
}
|
|
GA_Hero _hero = PlayerDatas.Instance.hero;
|
|
if ((E_AttackMode)PlayerDatas.Instance.baseData.AttackMode == E_AttackMode.Peace)
|
{
|
return false;
|
}
|
else if ((E_AttackMode)PlayerDatas.Instance.baseData.AttackMode == E_AttackMode.All)
|
{
|
return true;
|
}
|
else if ((E_AttackMode)PlayerDatas.Instance.baseData.AttackMode == E_AttackMode.Contest)
|
{
|
if (_hero != null)
|
{
|
// 判断队伍
|
if (ActorInfo.teamID != 0
|
&& _hero.ActorInfo.teamID != 0
|
&& ActorInfo.teamID == _hero.ActorInfo.teamID)
|
{
|
return false;
|
}
|
}
|
}
|
else if ((E_AttackMode)PlayerDatas.Instance.baseData.AttackMode == E_AttackMode.Family)
|
{
|
if (_hero != null)
|
{
|
// 判断队伍
|
if (ActorInfo.teamID != 0
|
&& _hero.ActorInfo.teamID != 0
|
&& ActorInfo.teamID == _hero.ActorInfo.teamID)
|
{
|
return false;
|
}
|
|
// 判断阵营
|
if (ActorInfo.faction != 0
|
&& _hero.ActorInfo.faction != 0
|
&& ActorInfo.faction == _hero.ActorInfo.faction)
|
{
|
return false;
|
}
|
|
// 判断仙盟
|
if (ActorInfo.familyID != 0
|
&& _hero.ActorInfo.familyID != 0
|
&& ActorInfo.familyID == _hero.ActorInfo.familyID)
|
{
|
return false;
|
}
|
}
|
|
if (StatusMgr.Instance.IsExist(ServerInstID, StatusMgr.Instance.redNameBuffID))
|
{
|
return true;
|
}
|
}
|
else if ((E_AttackMode)PlayerDatas.Instance.baseData.AttackMode == E_AttackMode.Country)
|
{
|
return false;
|
}
|
|
return true;
|
}
|
|
public override void Die()
|
{
|
base.Die();
|
StopMoveToPosition();
|
}
|
|
public bool CanBeSelected()
|
{
|
if (ActorInfo.serverDie)
|
{
|
return false;
|
}
|
|
if (StatusMgr.Instance.IsInvisible(ServerInstID))
|
{
|
return false;
|
}
|
|
return true;
|
}
|
|
public void OnClick()
|
{
|
if (ActorInfo.serverDie)
|
{
|
return;
|
}
|
|
GA_Hero _hero = PlayerDatas.Instance.hero;
|
if (_hero == null)
|
{
|
return;
|
}
|
|
_hero.LockTarget = this;
|
SelectTarget = this;
|
}
|
|
public void OnSelect()
|
{
|
if (CanAtked())
|
{
|
SelectionManager.Request(SelectionManager.E_Type.Red, this);
|
}
|
else
|
{
|
SelectionManager.Request(SelectionManager.E_Type.Green, this);
|
}
|
|
if (s_OnSelected != null)
|
{
|
s_OnSelected(ServerInstID, true);
|
}
|
}
|
|
public void OnUnSelect()
|
{
|
SelectionManager.Release(SelectionManager.E_Type.Green);
|
SelectionManager.Release(SelectionManager.E_Type.Red);
|
|
if (s_OnSelected != null)
|
{
|
s_OnSelected(ServerInstID, false);
|
}
|
}
|
|
public void Cmd_0614(H0614_tagUseSkillPos h0614)
|
{
|
Cmd0614 _cmd = new Cmd0614();
|
_cmd.Init(h0614);
|
m_CmdManager.Enqueue(_cmd);
|
}
|
|
public void Cmd_B402(HB402_tagMCRush hb402)
|
{
|
CmdB402 _cmd = new CmdB402();
|
_cmd.Init(hb402);
|
m_CmdManager.Enqueue(_cmd);
|
}
|
|
public void Cmd_0501(H0501_tagObjMove h0501)
|
{
|
Cmd0501 _cmd = new Cmd0501();
|
_cmd.Init(h0501);
|
m_CmdManager.Enqueue(_cmd);
|
}
|
|
public void ClearAllCMD()
|
{
|
m_CmdManager.Clear();
|
}
|
|
public void UpdateOffLineAction()
|
{
|
if (!IsIdle())
|
{
|
return;
|
}
|
|
if (SelectTarget == null)
|
{
|
SelectTarget = GAMgr.Instance.GetCloserFightNpc(Pos);
|
}
|
|
if (SelectTarget != null)
|
{
|
destForward = Forward = MathUtility.ForwardXZ(SelectTarget.Pos, Pos);
|
}
|
|
Skill _castSkill = null;
|
|
int _skillIndex = UnityEngine.Random.Range(0, m_OffLineSkillList.Length);
|
if (SkillMgr.Get(m_OffLineSkillList[_skillIndex]).IsValid())
|
{
|
_castSkill = SkillMgr.Get(m_OffLineSkillList[_skillIndex]);
|
}
|
|
if (_castSkill == null)
|
{
|
if (m_ComAtkIndex > JobSetup.ComAtkIdList.Length - 1)
|
{
|
m_ComAtkIndex = 0;
|
}
|
int _comSkillId = JobSetup.ComAtkIdList[m_ComAtkIndex];
|
_castSkill = SkillMgr.Get(_comSkillId);
|
m_ComAtkIndex += 1;
|
}
|
|
if (_castSkill != null)
|
{
|
SkillMgr.CastSkill(ServerInstID, _castSkill.id, true);
|
|
Vector3 _targetPosition = Pos + Forward * (_castSkill.skillInfo.config.AtkDist * .5f);
|
_targetPosition.y = 0;
|
UnityEngine.AI.NavMeshHit _navMeshHit;
|
if (UnityEngine.AI.NavMesh.Raycast(Pos, _targetPosition, out _navMeshHit, -1))
|
{
|
_targetPosition = _navMeshHit.position;
|
}
|
_targetPosition.y = Pos.y;
|
_castSkill.targetPosition = _targetPosition;
|
|
if (_castSkill.skillInfo.config.Skillactmark > 0
|
&& _castSkill.skillInfo.config.Skillactmark < 20)
|
{
|
switch (_castSkill.skillInfo.config.Skillactmark)
|
{
|
case 10:
|
Play(GAStaticDefine.State_Attack1Hash, 0);
|
break;
|
case 11:
|
Play(GAStaticDefine.State_Attack2Hash, 0);
|
break;
|
case 12:
|
Play(GAStaticDefine.State_Attack3Hash, 0);
|
break;
|
case 13:
|
Play(GAStaticDefine.State_Attack4Hash, 0);
|
break;
|
}
|
|
}
|
else
|
{
|
switch (_castSkill.skillInfo.config.Skillactmark)
|
{
|
case 21:
|
Play(GAStaticDefine.State_Skill21, 0);
|
break;
|
case 22:
|
Play(GAStaticDefine.State_Skill22, 0);
|
break;
|
case 23:
|
Play(GAStaticDefine.State_Skill23, 0);
|
break;
|
case 24:
|
Play(GAStaticDefine.State_Skill24, 0);
|
break;
|
case 25:
|
Play(GAStaticDefine.State_Skill25, 0);
|
break;
|
case 26:
|
Play(GAStaticDefine.State_Skill26, 0);
|
break;
|
case 27:
|
Play(GAStaticDefine.State_Skill27, 0);
|
break;
|
case 28:
|
Play(GAStaticDefine.State_Skill28, 0);
|
break;
|
case 29:
|
Play(GAStaticDefine.State_Skill29, 0);
|
break;
|
case 99:
|
Play(GAStaticDefine.State_RollHash, 0);
|
break;
|
}
|
}
|
}
|
}
|
}
|