1186 lines
45 KiB
C#
1186 lines
45 KiB
C#
|
/********************************************************************************
|
|||
|
* 文件名: Obj_OtherPlayer.cs
|
|||
|
* 全路径: \Script\Obj\Obj_OtherPlayer.cs
|
|||
|
* 创建人: 李嘉
|
|||
|
* 创建时间:2013-10-25
|
|||
|
*
|
|||
|
* 功能说明:游戏其他玩家Obj逻辑类
|
|||
|
* 修改记录:
|
|||
|
*********************************************************************************/
|
|||
|
using Games.ChatHistory;
|
|||
|
using Games.Events;
|
|||
|
using Games.GlobeDefine;
|
|||
|
using Games.Scene;
|
|||
|
using GCGame;
|
|||
|
using GCGame.Table;
|
|||
|
using Module.Log;
|
|||
|
using System;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.AI;
|
|||
|
|
|||
|
namespace Games.LogicObj
|
|||
|
{
|
|||
|
|
|||
|
public class Obj_Player_Init_Data : Obj_Character_Init_Data
|
|||
|
{
|
|||
|
public string ServerName; //跨服场景中头顶名字显示所在服务器
|
|||
|
public string m_strTitleName; //称号名
|
|||
|
public int m_CurTitleID; //称号ID
|
|||
|
public int m_AdvanceMountId; // 坐骑ID
|
|||
|
public int m_MountState; //双人坐骑
|
|||
|
public ulong m_LinkID; //双人坐骑
|
|||
|
public int m_MagicID; //法宝ID
|
|||
|
public int m_nOtherVipCost; //vip info
|
|||
|
public UInt64 m_GuildGuid; //帮会GUID
|
|||
|
public int m_GuildJob; //帮会职位
|
|||
|
public int m_nOtherCombatValue; //战力
|
|||
|
public bool m_bIsWildEnemyForMainPlayer; //是否与主角敌对
|
|||
|
public int m_nPaoShangState; //跑商状态
|
|||
|
public int m_nLightSkillLevel; //轻功等级
|
|||
|
public int _TeamLeader;
|
|||
|
public int _CaptainWelfareLevel; //队长福利等级
|
|||
|
public bool _IsInMeditate; //是否在打坐
|
|||
|
public int m_hideMask; // 部件隐藏掩码
|
|||
|
public bool m_IsShowWing;//是否显示翅膀
|
|||
|
public ChildData.ChildInitData m_CurCarryChildData; //当前携带的孩子数据
|
|||
|
|
|||
|
public Obj_Player_Init_Data()
|
|||
|
{
|
|||
|
CleanUp();
|
|||
|
}
|
|||
|
public override void CleanUp()
|
|||
|
{
|
|||
|
base.CleanUp();
|
|||
|
ServerName = string.Empty;
|
|||
|
m_strTitleName = string.Empty;
|
|||
|
m_CurTitleID = GlobeVar.INVALID_ID;
|
|||
|
m_AdvanceMountId = -1;
|
|||
|
m_MagicID = -1;
|
|||
|
m_nOtherVipCost = -1;
|
|||
|
m_GuildGuid = GlobeVar.INVALID_GUID;
|
|||
|
m_GuildJob = (int)GameDefine_Globe.GUILD_JOB.INVALID;
|
|||
|
m_nOtherCombatValue = 0;
|
|||
|
m_bIsWildEnemyForMainPlayer = false;
|
|||
|
m_nPaoShangState = -1;
|
|||
|
m_nLightSkillLevel = -1;
|
|||
|
_CaptainWelfareLevel = -1;
|
|||
|
m_CurCarryChildData = new ChildData.ChildInitData();
|
|||
|
//LinkId = 0;
|
|||
|
//name = "";
|
|||
|
//masterName = "";
|
|||
|
//model = -1;
|
|||
|
//weapon = -1;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public partial class Obj_OtherPlayer : Obj_Character
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Obj包含的身份部件类型
|
|||
|
/// </summary>
|
|||
|
public override int[] bodyParts
|
|||
|
{
|
|||
|
get { return new[] { ModelPart.body, ModelPart.weaponLeft, ModelPart.weaponRight, ModelPart.wing, ModelPart.mount }; }
|
|||
|
}
|
|||
|
|
|||
|
public override UIPathData HeadUiPath
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return Obj_PlayerHeadUI.pathData;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public Obj_OtherPlayer()
|
|||
|
{
|
|||
|
m_ObjType = GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER;
|
|||
|
SetObjPoolLevel(ObjPoolLevel.otherPlayer);
|
|||
|
}
|
|||
|
// 暂时使用这个后期赋值的接口处理,似乎没有找到其他安全的位置
|
|||
|
protected void SetObjPoolLevel(ObjPoolLevel objPoolLevel)
|
|||
|
{
|
|||
|
var models = GetPlayerModels();
|
|||
|
for (var i = 0; i < models.Length; i++)
|
|||
|
models[i].poolLevel = objPoolLevel;
|
|||
|
}
|
|||
|
|
|||
|
protected ObjModelRecord[] GetPlayerModels()
|
|||
|
{
|
|||
|
return new []
|
|||
|
{
|
|||
|
ModelNode,
|
|||
|
mountModel,
|
|||
|
weaponLeft,
|
|||
|
weaponRight,
|
|||
|
wingObj,
|
|||
|
effectAura,
|
|||
|
weaponEffectLeft,
|
|||
|
weaponEffectRight
|
|||
|
};
|
|||
|
}
|
|||
|
|
|||
|
public Obj_PlayerHeadUI m_headUIObj { get; private set; }
|
|||
|
|
|||
|
private int m_GuildJob = (int)GameDefine_Globe.GUILD_JOB.INVALID;
|
|||
|
public virtual int GuildJob
|
|||
|
{
|
|||
|
get { return m_GuildJob; }
|
|||
|
set { m_GuildJob = value; }
|
|||
|
}
|
|||
|
|
|||
|
private UInt64 m_GuildGUID = GlobeVar.INVALID_GUID;
|
|||
|
public virtual System.UInt64 GuildGUID
|
|||
|
{
|
|||
|
get { return m_GuildGUID; }
|
|||
|
set { m_GuildGUID = value; }
|
|||
|
}
|
|||
|
|
|||
|
private int m_fellowID;
|
|||
|
public int FellowID
|
|||
|
{
|
|||
|
get { return m_fellowID; }
|
|||
|
set { m_fellowID = value; }
|
|||
|
}
|
|||
|
|
|||
|
public ChildData.ChildInitData m_CurCarryChildData;
|
|||
|
protected string m_ServerName = "";
|
|||
|
private string m_PaoShangTitle = "";
|
|||
|
private bool m_bIsWildEnemyForMainPlayer = false;
|
|||
|
public bool IsWildEnemyForMainPlayer
|
|||
|
{
|
|||
|
get { return m_bIsWildEnemyForMainPlayer; }
|
|||
|
set { m_bIsWildEnemyForMainPlayer = value; }
|
|||
|
}
|
|||
|
public bool _IsTeamLeader = false;
|
|||
|
public bool _IsInMeditate { get; set; }
|
|||
|
public override bool Init(ObjParent_Init_Data initData1)
|
|||
|
{
|
|||
|
speedAdaption = true;
|
|||
|
var result = base.Init(initData1);
|
|||
|
if (result == false)
|
|||
|
return false;
|
|||
|
Obj_Player_Init_Data initData = initData1 as Obj_Player_Init_Data;
|
|||
|
if (initData == null)
|
|||
|
return false;
|
|||
|
m_ServerName = initData.ServerName;
|
|||
|
modelHideMask = initData.m_hideMask;
|
|||
|
PkModle = initData.m_PkModel;
|
|||
|
PkValue = initData.m_PkValue;
|
|||
|
VipCost = initData.m_nOtherVipCost;
|
|||
|
GuildGUID = initData.m_GuildGuid;
|
|||
|
GuildJob = initData.m_GuildJob;
|
|||
|
OtherCombatValue = initData.m_nOtherCombatValue;
|
|||
|
IsWildEnemyForMainPlayer = initData.m_bIsWildEnemyForMainPlayer;
|
|||
|
_IsTeamLeader = initData._TeamLeader > 0;
|
|||
|
m_strTitleInvestitive = initData.m_strTitleName;
|
|||
|
m_CurTitleID = initData.m_CurTitleID;
|
|||
|
IsInMainPlayerPKList = initData.m_isInMainPlayerPKList;
|
|||
|
AdcaneMountId = initData.m_AdvanceMountId;
|
|||
|
DoubleRidingState = initData.m_MountState;
|
|||
|
_LinkID = initData.m_LinkID;
|
|||
|
IsShowWing = initData.m_IsShowWing;
|
|||
|
|
|||
|
#region childData
|
|||
|
m_CurCarryChildData = new ChildData.ChildInitData()
|
|||
|
{
|
|||
|
childLevel = initData.m_CurCarryChildData.childLevel,
|
|||
|
childName = initData.m_CurCarryChildData.childName,
|
|||
|
childFashionId = initData.m_CurCarryChildData.childFashionId,
|
|||
|
childGender = initData.m_CurCarryChildData.childGender,
|
|||
|
childGuid = initData.m_CurCarryChildData.childGuid
|
|||
|
};
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
OrnamentFootPrintID = initData.m_OrnamentFootPrintId;
|
|||
|
BaseAttr.HP = initData._InitCurHP;
|
|||
|
BaseAttr.MaxHP = initData._InitMaxHP;
|
|||
|
BaseAttr.CaptainWelfareLevel = initData._CaptainWelfareLevel;
|
|||
|
m_ObjTransform.localRotation = Utils.DirServerToClient(initData.m_fDir);
|
|||
|
m_nPaoShangState = initData.m_nPaoShangState;
|
|||
|
_IsInMeditate = initData._IsInMeditate;
|
|||
|
OptChangPKModle();
|
|||
|
CreateNameBoard();
|
|||
|
InitBindFromData(initData);
|
|||
|
InitImpactInfo(initData);
|
|||
|
CanLogic = true;
|
|||
|
//初始化寻路代理
|
|||
|
InitNavAgent();
|
|||
|
CreateModel(ForceUseModel == null ? ModelID : ForceUseModel.modelData.Id);
|
|||
|
CreateMagicModel(initData.m_MagicID);
|
|||
|
CreateChildModel(new Child_Init_Data() {
|
|||
|
childFashionId = initData.m_CurCarryChildData.childFashionId,
|
|||
|
childName = initData.m_CurCarryChildData.childName,
|
|||
|
childLevel = initData.m_CurCarryChildData.childLevel,
|
|||
|
childGender = initData.m_CurCarryChildData.childGender,
|
|||
|
childGuid = initData.m_CurCarryChildData.childGuid,
|
|||
|
bindPlayerGuid = BaseAttr.Guid,
|
|||
|
}, transform.position);
|
|||
|
ObjManager.Instance.AddPoolObj(this);
|
|||
|
Hashtable tab = new Hashtable();
|
|||
|
tab["profession"] = initData.m_nProfession;
|
|||
|
tab["type"] = Obj_Fellow.FellowDialogType.OtherPlayerCheck;
|
|||
|
EventDispatcher.Instance.SendMessage(Games.Events.EventId.FellowDialogEvent, tab);
|
|||
|
EventDispatcher.Instance.Dispatch(Events.EventId.FellowOwerEvent);
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
// 重载模型回调
|
|||
|
protected override void CreateModelOver(Hashtable table)
|
|||
|
{
|
|||
|
base.CreateModelOver(table);
|
|||
|
//if (m_nPaoShangState != -1)
|
|||
|
// UpdatePaoShangStateEffect(m_nPaoShangState);
|
|||
|
RealoadPlayerWeaponVisual();
|
|||
|
if (ForceUseModel == null || ForceUseModel.useModel)
|
|||
|
ReloadPlayerEffect();
|
|||
|
RealoadWingModel();
|
|||
|
if (SkillCore != null)
|
|||
|
SkillCore.UserCacheSkill();
|
|||
|
RideOrUnMount(AdcaneMountId);
|
|||
|
ReloadOrnamentFootPrint(AdcaneMountId > 0);
|
|||
|
if (_IsInMeditate)
|
|||
|
EnterMeditateState(AdcaneMountId);
|
|||
|
|
|||
|
IsNeedBindWC();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
public void IsNeedBindWC()
|
|||
|
{
|
|||
|
if (GameManager.gameManager.PlayerDataPool._WCBindObjDic.ContainsKey(GUID))
|
|||
|
{
|
|||
|
var info = GameManager.gameManager.PlayerDataPool._WCBindObjDic[GUID];
|
|||
|
BindCloneModelToWC(info._BindParent, info._AnimationId, info._ScaleVal);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//创建孩子
|
|||
|
protected virtual void CreateChildModel(Child_Init_Data _ChildData, Vector3 pos)
|
|||
|
{
|
|||
|
Child_Init_Data childData = new Child_Init_Data();
|
|||
|
childData.childFashionId = _ChildData.childFashionId;
|
|||
|
childData.childName = _ChildData.childName;
|
|||
|
childData.childLevel = _ChildData.childLevel;
|
|||
|
childData.childGender = _ChildData.childGender;
|
|||
|
childData.childGuid = _ChildData.childGuid;
|
|||
|
childData.bindPlayerGuid = GUID;
|
|||
|
|
|||
|
childData.m_fX = pos.x;
|
|||
|
childData.m_fZ = pos.z;
|
|||
|
childData.m_MoveSpeed = MoveSpeed;
|
|||
|
childData.bindPlayerGuid = GUID;
|
|||
|
|
|||
|
childData.m_StrName = "Child";
|
|||
|
var childObjParent = Singleton<ObjManager>.Instance.NewCharacterObj(GameDefine_Globe.OBJ_TYPE.OBJ_CHILD, childData);
|
|||
|
|
|||
|
if(m_CurCarryChild != null)
|
|||
|
{
|
|||
|
m_CurCarryChild.DestroyObj();
|
|||
|
}
|
|||
|
m_CurCarryChild = childObjParent.GetComponent<Obj_Child>();
|
|||
|
}
|
|||
|
|
|||
|
public virtual void ReloadChildModel(Vector3 pos, ChildData.ChildInitData initData)
|
|||
|
{
|
|||
|
Child_Init_Data childData = new Child_Init_Data();
|
|||
|
childData.childFashionId = initData.childFashionId;
|
|||
|
childData.childName = initData.childName;
|
|||
|
childData.childLevel = initData.childLevel;
|
|||
|
childData.childGender = initData.childGender;
|
|||
|
childData.childGuid = initData.childGuid;
|
|||
|
childData.bindPlayerGuid = GUID;
|
|||
|
|
|||
|
childData.m_fX = pos.x;
|
|||
|
childData.m_fZ = pos.z;
|
|||
|
childData.m_MoveSpeed = MoveSpeed;
|
|||
|
if (initData.childLevel == -1
|
|||
|
|| initData.childGuid == -1)
|
|||
|
{
|
|||
|
if (m_CurCarryChild != null)
|
|||
|
{
|
|||
|
m_CurCarryChild.DestroyObj();
|
|||
|
m_CurCarryChild = null;
|
|||
|
}
|
|||
|
return;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (m_CurCarryChild != null)
|
|||
|
{
|
|||
|
m_CurCarryChild.ReloadChildModel(childData);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
var childObjParent = Singleton<ObjManager>.Instance.NewCharacterObj(GameDefine_Globe.OBJ_TYPE.OBJ_CHILD, childData);
|
|||
|
m_CurCarryChild = childObjParent.GetComponent<Obj_Child>();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected override void Update()
|
|||
|
{
|
|||
|
//UpdateQingGong(); //由于轻功可能改变玩家坐标,所以放在UpdateTargetMove之后进行
|
|||
|
//UpdateLightSkill();
|
|||
|
UpdateMagic();
|
|||
|
base.Update();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public List<MyTuple<string, string>> GetAssetReference()
|
|||
|
{
|
|||
|
var result = new List<MyTuple<string, string>>();
|
|||
|
GetAssetReference(result);
|
|||
|
return result;
|
|||
|
}
|
|||
|
|
|||
|
public void GetAssetReference(List<MyTuple<string, string>> list)
|
|||
|
{
|
|||
|
var models = GetPlayerModels();
|
|||
|
for (var i = 0; i < models.Length; i++)
|
|||
|
{
|
|||
|
var model = models[i];
|
|||
|
if (!string.IsNullOrEmpty(model.targetBundle) && !string.IsNullOrEmpty(model.targetModel))
|
|||
|
{
|
|||
|
var add = true;
|
|||
|
for (var j = 0; j < list.Count; j++)
|
|||
|
if (list[j].first == model.targetBundle && list[j].second == model.targetModel)
|
|||
|
{
|
|||
|
add = false;
|
|||
|
break;
|
|||
|
}
|
|||
|
if (add)
|
|||
|
list.Add(new MyTuple<string, string>(model.targetBundle, model.targetModel));
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//改成了不管有没有跑商任务,都显示帮会名字
|
|||
|
public void ChangePaoShangState(string title)
|
|||
|
{
|
|||
|
if (m_headUIObj != null)
|
|||
|
{
|
|||
|
m_headUIObj.UpdatePaoShangIcon(title);
|
|||
|
}
|
|||
|
m_PaoShangTitle = title;
|
|||
|
}
|
|||
|
|
|||
|
public void UpdateTeamInfo(bool state)
|
|||
|
{
|
|||
|
if(m_headUIObj!=null)
|
|||
|
m_headUIObj.UpdateCaptainIcon(state);
|
|||
|
}
|
|||
|
|
|||
|
public override void InitNameBoard(Obj_HeadUI headUiItem)
|
|||
|
{
|
|||
|
base.InitNameBoard(headUiItem);
|
|||
|
m_headUIObj = (Obj_PlayerHeadUI)headUiItem;
|
|||
|
ShowTitleInvestitive();
|
|||
|
UpdateVipInfo();
|
|||
|
m_headUIObj.ShowOriginalHeadInfo(true);
|
|||
|
m_headUIObj.UpdateCaptainIcon(true);
|
|||
|
m_headUIObj.UpdateOtherPkModel(this);
|
|||
|
m_headUIObj.UpdatePaoShangIcon(m_PaoShangTitle);
|
|||
|
SetSpricelName();
|
|||
|
}
|
|||
|
|
|||
|
public void SetSpricelName()
|
|||
|
{
|
|||
|
if (m_headUIObj == null)
|
|||
|
return;
|
|||
|
string name = BaseAttr.RoleName;
|
|||
|
if (string.IsNullOrEmpty(m_ServerName) == false)
|
|||
|
{
|
|||
|
var fuben = TableManager.GetFubenByID(GlobalData.GetCurSceenFubenId(), 0);
|
|||
|
if(fuben.IsShowCamp == 1)
|
|||
|
{
|
|||
|
if (BaseAttr.Force == 6)
|
|||
|
name = StrDictionary.GetClientDictionaryString("#{5820}") + name;
|
|||
|
if (BaseAttr.Force == 7)
|
|||
|
name = StrDictionary.GetClientDictionaryString("#{5821}") + name;
|
|||
|
if (BaseAttr.Force == 27)
|
|||
|
name = StrDictionary.GetClientDictionaryString("#{5822}") + name;
|
|||
|
}
|
|||
|
|
|||
|
if(fuben != null && fuben.CrossSrvType == 1)
|
|||
|
{
|
|||
|
name = m_ServerName + name;
|
|||
|
}
|
|||
|
m_headUIObj.ResetNameBoradPos(true);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
m_headUIObj.ResetNameBoradPos(false);
|
|||
|
}
|
|||
|
|
|||
|
m_headUIObj.SetName(name);
|
|||
|
int Force = BaseAttr.Force;
|
|||
|
if(ObjType == GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
|
|||
|
{
|
|||
|
Force = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Force;
|
|||
|
}
|
|||
|
int WarForce = BaseAttr.WarForce;
|
|||
|
if (ObjType == GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
|
|||
|
{
|
|||
|
WarForce = GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.WarForce;
|
|||
|
}
|
|||
|
Color nameColor = GCGame.Utils.GetColorByString(StrDictionary.GetClientDictionaryString("#{5554}"));
|
|||
|
//暂时按照阵营来确定是不是在战场
|
|||
|
if (WarForce != 0)
|
|||
|
{
|
|||
|
if (GameManager.gameManager.RunningScene == (int)GameDefine_Globe.SCENE_DEFINE.SCENE_GUANNING)
|
|||
|
{
|
|||
|
if (Force == 6)
|
|||
|
{
|
|||
|
m_headUIObj.SetName(StrDictionary.GetClientDictionaryString("#{9210}"));
|
|||
|
}
|
|||
|
else if (Force == 7)
|
|||
|
{
|
|||
|
m_headUIObj.SetName(StrDictionary.GetClientDictionaryString("#{9211}"));
|
|||
|
}
|
|||
|
}
|
|||
|
if (Singleton<ObjManager>.Instance.MainPlayer!=null && (WarForce != GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.WarForce || Force != GameManager.gameManager.PlayerDataPool.MainPlayerBaseAttr.Force))
|
|||
|
{
|
|||
|
nameColor = GCGame.Utils.GetColorByString(StrDictionary.GetClientDictionaryString("#{5556}"));
|
|||
|
//m_headUIObj.HideHp(true);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
//m_headUIObj.HideHp(ObjType == GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER || GameManager.gameManager.PlayerDataPool.IsTeamMem(GUID));
|
|||
|
}
|
|||
|
m_headUIObj.SetNameColor(nameColor);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
if (ObjType == GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER
|
|||
|
&& GameManager.gameManager.RunningScene == (int)GameDefine_Globe.SCENE_DEFINE.SCENE_GUILD
|
|||
|
&& SceneData.sceneGuildGuid != GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid
|
|||
|
&& m_GuildGUID != GlobeVar.INVALID_GUID
|
|||
|
&& m_GuildGUID != GameManager.gameManager.PlayerDataPool.GuildInfo.GuildGuid
|
|||
|
&& Reputation.IsEnemy(this)==false)
|
|||
|
{
|
|||
|
m_headUIObj.SetNameColor(GCGame.Utils.GetColorByString(StrDictionary.GetClientDictionaryString("#{5556}")));
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
m_headUIObj.SetNameColor(GetNameBoardColor());
|
|||
|
}
|
|||
|
//m_headUIObj.HideHp(ObjType == GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER || GameManager.gameManager.PlayerDataPool.IsTeamMem(GUID));
|
|||
|
}
|
|||
|
m_headUIObj.HpSliderShowLogic();
|
|||
|
m_headUIObj.HideChatBubble(false);
|
|||
|
OptHPChange();
|
|||
|
ChangeFellowNameColor();
|
|||
|
}
|
|||
|
|
|||
|
//public virtual void UpdateCombatValue()
|
|||
|
//{
|
|||
|
// int nNeedEffect = -1;
|
|||
|
// if (m_nOtherCombatValue >= GlobeVar.COMBAT_LEVEL_5)
|
|||
|
// {
|
|||
|
// nNeedEffect = GlobeVar.COMBAT_EFFECT_5;
|
|||
|
// }
|
|||
|
// else if (m_nOtherCombatValue >= GlobeVar.COMBAT_LEVEL_4)
|
|||
|
// {
|
|||
|
// nNeedEffect = GlobeVar.COMBAT_EFFECT_4;
|
|||
|
// }
|
|||
|
// else if (m_nOtherCombatValue >= GlobeVar.COMBAT_LEVEL_3)
|
|||
|
// {
|
|||
|
// nNeedEffect = GlobeVar.COMBAT_EFFECT_3;
|
|||
|
// }
|
|||
|
// else if (m_nOtherCombatValue >= GlobeVar.COMBAT_LEVEL_2)
|
|||
|
// {
|
|||
|
// nNeedEffect = GlobeVar.COMBAT_EFFECT_2;
|
|||
|
// }
|
|||
|
// else if (m_nOtherCombatValue >= GlobeVar.COMBAT_LEVEL_1)
|
|||
|
// {
|
|||
|
// nNeedEffect = GlobeVar.COMBAT_EFFECT_1;
|
|||
|
// }
|
|||
|
//if (nNeedEffect > 0)
|
|||
|
//{
|
|||
|
// Tab_Effect EffectInfo = TableManager.GetEffectByID(nNeedEffect, 0);
|
|||
|
// if (EffectInfo != null && IsHaveBindPoint(EffectInfo.ParentName) && GetEffectCountById(nNeedEffect) < 1)
|
|||
|
// {
|
|||
|
// StopEffect(GlobeVar.COMBAT_EFFECT_5);
|
|||
|
// StopEffect(GlobeVar.COMBAT_EFFECT_4);
|
|||
|
// StopEffect(GlobeVar.COMBAT_EFFECT_3);
|
|||
|
// StopEffect(GlobeVar.COMBAT_EFFECT_2);
|
|||
|
// StopEffect(GlobeVar.COMBAT_EFFECT_1);
|
|||
|
// PlayEffect(nNeedEffect);
|
|||
|
// }
|
|||
|
//}
|
|||
|
//else
|
|||
|
//{
|
|||
|
// StopEffect(GlobeVar.COMBAT_EFFECT_5);
|
|||
|
// StopEffect(GlobeVar.COMBAT_EFFECT_4);
|
|||
|
// StopEffect(GlobeVar.COMBAT_EFFECT_3);
|
|||
|
// StopEffect(GlobeVar.COMBAT_EFFECT_2);
|
|||
|
// StopEffect(GlobeVar.COMBAT_EFFECT_1);
|
|||
|
//}
|
|||
|
//}
|
|||
|
public virtual void UpdateVipInfo()
|
|||
|
{
|
|||
|
if (null != m_headUIObj)
|
|||
|
{
|
|||
|
m_headUIObj.UpdateVipInfo(m_nVipCost);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private string m_strTitleInvestitive;
|
|||
|
public string StrTitleInvestitive
|
|||
|
{
|
|||
|
get { return m_strTitleInvestitive; }
|
|||
|
set { m_strTitleInvestitive = value; }
|
|||
|
}
|
|||
|
|
|||
|
private int m_CurTitleID;
|
|||
|
public int CurTitleID
|
|||
|
{
|
|||
|
get { return m_CurTitleID; }
|
|||
|
set { m_CurTitleID = value; }
|
|||
|
}
|
|||
|
|
|||
|
public void ShowTitleInvestitive()
|
|||
|
{
|
|||
|
if (null != m_headUIObj && m_ObjType != GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
|
|||
|
{
|
|||
|
m_headUIObj.ShowTitleInvestitiveByTable(m_CurTitleID, m_strTitleInvestitive);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//VIP
|
|||
|
private int m_nVipCost = -1;
|
|||
|
public virtual int VipCost
|
|||
|
{
|
|||
|
get { return m_nVipCost; }
|
|||
|
set { m_nVipCost = value; UpdateVipInfo(); }
|
|||
|
}
|
|||
|
private int m_nOtherCombatValue = -1;
|
|||
|
public virtual int OtherCombatValue
|
|||
|
{
|
|||
|
get { return m_nOtherCombatValue; }
|
|||
|
set { m_nOtherCombatValue = value; }
|
|||
|
}
|
|||
|
//PK模式
|
|||
|
private int m_nPkModle = -1;
|
|||
|
public virtual int PkModle
|
|||
|
{
|
|||
|
get { return m_nPkModle; }
|
|||
|
set { m_nPkModle = value; }
|
|||
|
}
|
|||
|
private int m_nPkValue = -1;
|
|||
|
public virtual int PkValue
|
|||
|
{
|
|||
|
get { return m_nPkValue; }
|
|||
|
set { m_nPkValue = value; }
|
|||
|
}
|
|||
|
//是否在主角的反击列表中
|
|||
|
public bool IsInMainPlayerPKList { get; set; }
|
|||
|
|
|||
|
public Color GetOutLineColor()
|
|||
|
{
|
|||
|
if (Reputation.IsEnemy(this))
|
|||
|
return Utils.GetColorByString(StrDictionary.GetClientDictionaryString("#{5559}"));
|
|||
|
int blueMin = 0;
|
|||
|
int blueMax = 0;
|
|||
|
int purpleMin = 1;
|
|||
|
int purpleMax = 59;
|
|||
|
int redMin = 60;
|
|||
|
Tab_PKDetailInfo pkdata = TableManager.GetPKDetailInfoByID(1, 0);
|
|||
|
if (pkdata != null)
|
|||
|
{
|
|||
|
blueMin = pkdata.BluePKValueMin;
|
|||
|
blueMax = pkdata.BluePKValueMax;
|
|||
|
purpleMin = pkdata.PurplePKValueMin;
|
|||
|
purpleMax = pkdata.PurplePKValueMax;
|
|||
|
redMin = pkdata.RedPKValueMin;
|
|||
|
}
|
|||
|
|
|||
|
//新规则按PK值来定
|
|||
|
string strColor = StrDictionary.GetClientDictionaryString("#{5557}");
|
|||
|
if (BaseAttr.PKValue >= blueMin && BaseAttr.PKValue <= blueMax)
|
|||
|
{
|
|||
|
strColor = StrDictionary.GetClientDictionaryString("#{5557}");
|
|||
|
}
|
|||
|
if (BaseAttr.PKValue >= purpleMin && BaseAttr.PKValue <= purpleMax)
|
|||
|
{
|
|||
|
strColor = StrDictionary.GetClientDictionaryString("#{5558}");
|
|||
|
}
|
|||
|
|
|||
|
if (BaseAttr.PKValue >= redMin)
|
|||
|
{
|
|||
|
strColor = StrDictionary.GetClientDictionaryString("#{5559}");
|
|||
|
}
|
|||
|
return GCGame.Utils.GetColorByString(strColor);
|
|||
|
}
|
|||
|
|
|||
|
public Color GetColorByPK()
|
|||
|
{
|
|||
|
int blueMin = 0;
|
|||
|
int blueMax = 0;
|
|||
|
int purpleMin = 1;
|
|||
|
int purpleMax = 59;
|
|||
|
int redMin = 60;
|
|||
|
Tab_PKDetailInfo pkdata = TableManager.GetPKDetailInfoByID(1, 0);
|
|||
|
if (pkdata != null)
|
|||
|
{
|
|||
|
blueMin = pkdata.BluePKValueMin;
|
|||
|
blueMax = pkdata.BluePKValueMax;
|
|||
|
purpleMin = pkdata.PurplePKValueMin;
|
|||
|
purpleMax = pkdata.PurplePKValueMax;
|
|||
|
redMin = pkdata.RedPKValueMin;
|
|||
|
}
|
|||
|
|
|||
|
//新规则按PK值来定
|
|||
|
string strColor = StrDictionary.GetClientDictionaryString("#{5554}");
|
|||
|
if (BaseAttr.PKValue >= blueMin && BaseAttr.PKValue <= blueMax)
|
|||
|
{
|
|||
|
strColor = StrDictionary.GetClientDictionaryString("#{5554}");
|
|||
|
if (ObjType == GameDefine_Globe.OBJ_TYPE.OBJ_MAIN_PLAYER)
|
|||
|
strColor = StrDictionary.GetClientDictionaryString("#{5557}");
|
|||
|
}
|
|||
|
if (BaseAttr.PKValue >= purpleMin && BaseAttr.PKValue <= purpleMax)
|
|||
|
{
|
|||
|
strColor = StrDictionary.GetClientDictionaryString("#{5555}");
|
|||
|
}
|
|||
|
|
|||
|
if (BaseAttr.PKValue >= redMin)
|
|||
|
{
|
|||
|
strColor = StrDictionary.GetClientDictionaryString("#{5556}");
|
|||
|
}
|
|||
|
return GCGame.Utils.GetColorByString(strColor);
|
|||
|
}
|
|||
|
|
|||
|
public virtual Color GetNameBoardColor()
|
|||
|
{
|
|||
|
return Reputation.IsEnemy(this) ? Utils.GetColorByString(StrDictionary.GetClientDictionaryString("#{5556}")) : GetColorByPK();
|
|||
|
}
|
|||
|
|
|||
|
public virtual void OptChangPKModle()
|
|||
|
{
|
|||
|
if (null != m_headUIObj)
|
|||
|
m_headUIObj.UpdateOtherPkModel(this);
|
|||
|
ChangeFellowNameColor();
|
|||
|
}
|
|||
|
|
|||
|
public void ChangeTeamLeaderFlag(int teamLeaderFlag)
|
|||
|
{
|
|||
|
_IsTeamLeader = teamLeaderFlag > 0;
|
|||
|
if (m_headUIObj != null)
|
|||
|
{
|
|||
|
m_headUIObj.UpdateCaptainIcon(true);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override void UpdateAttrBroadcastPackt(GC_BROADCAST_ATTR packet)
|
|||
|
{
|
|||
|
base.UpdateAttrBroadcastPackt(packet);
|
|||
|
}
|
|||
|
public void SetNameBoardColor()
|
|||
|
{
|
|||
|
if (m_headUIObj != null)
|
|||
|
{
|
|||
|
m_headUIObj.SetNameColor(GetNameBoardColor());
|
|||
|
}
|
|||
|
}
|
|||
|
public override void OptNameChange()//名字变化后的操作
|
|||
|
{
|
|||
|
if (m_headUIObj != null)
|
|||
|
SetSpricelName();
|
|||
|
//m_headUIObj.SetName(BaseAttr.RoleName);
|
|||
|
}
|
|||
|
public override void OptHPChange() //血量变化后的操作
|
|||
|
{
|
|||
|
float rate = 1;
|
|||
|
if (BaseAttr.MaxHP > 0)
|
|||
|
{
|
|||
|
rate = BaseAttr.HP / (float)BaseAttr.MaxHP;
|
|||
|
}
|
|||
|
if (m_headUIObj != null)
|
|||
|
{
|
|||
|
m_headUIObj.SetNewHp(rate);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void ChangeFellowNameColor()
|
|||
|
{
|
|||
|
var ObjFellow = Singleton<ObjManager>.Instance.FindObjInScene(FellowID) as Obj_Fellow;
|
|||
|
if (null != ObjFellow)
|
|||
|
{
|
|||
|
ObjFellow.ChangeNameColor(Reputation.IsEnemy(this));
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override void OptPKValueChange()
|
|||
|
{
|
|||
|
base.OptPKValueChange();
|
|||
|
SetSpricelName();
|
|||
|
}
|
|||
|
public override void OptWarForceChange()
|
|||
|
{
|
|||
|
base.OptWarForceChange();
|
|||
|
SetSpricelName();
|
|||
|
if (Singleton<ObjManager>.Instance.MainPlayer != null)
|
|||
|
Singleton<ObjManager>.Instance.MainPlayer.SetSpricelName();
|
|||
|
}
|
|||
|
public override void OptForceChange()
|
|||
|
{
|
|||
|
base.OptForceChange();
|
|||
|
SetSpricelName();
|
|||
|
if (Singleton<ObjManager>.Instance.MainPlayer != null)
|
|||
|
Singleton<ObjManager>.Instance.MainPlayer.SetSpricelName();
|
|||
|
}
|
|||
|
public override bool OnCorpse()
|
|||
|
{
|
|||
|
ChangeCorpseCapsule();
|
|||
|
return base.OnCorpse();
|
|||
|
}
|
|||
|
//Obj死亡时候调用
|
|||
|
public override bool OnDie()
|
|||
|
{
|
|||
|
var result = base.OnDie();
|
|||
|
if (result)
|
|||
|
{
|
|||
|
if (SceneLogic.CameraController != null && SceneLogic.CameraController.IsCurrFocus(this))
|
|||
|
EventDispatcher.Instance.SendMessage(Events.EventId.MainCameraFocusValid);
|
|||
|
ChangeCorpseCapsule();
|
|||
|
}
|
|||
|
return result;
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 胶囊像尸体一样横放
|
|||
|
/// </summary>
|
|||
|
private void ChangeCorpseCapsule()
|
|||
|
{
|
|||
|
// 特殊处理 - 非主角的其他玩家死亡后,胶囊碰撞体像尸体一样横放
|
|||
|
if (ObjType == GameDefine_Globe.OBJ_TYPE.OBJ_OTHER_PLAYER)
|
|||
|
{
|
|||
|
var capsulaCollider = GetComponent<CapsuleCollider>();
|
|||
|
if (capsulaCollider == null)
|
|||
|
LogModule.WarningLog(string.Format("角色{0}没有胶囊碰撞体", gameObject.name));
|
|||
|
else
|
|||
|
{
|
|||
|
// 居然不是枚举
|
|||
|
capsulaCollider.direction = 2;
|
|||
|
capsulaCollider.center = Vector3.back * capsulaCollider.height * 0.5f;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override bool OnRelife(bool isMotion = false)
|
|||
|
{
|
|||
|
base.OnRelife(isMotion);
|
|||
|
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
// 放技能时换装需要等待
|
|||
|
private bool m_UpdateModelWait = false;
|
|||
|
private bool m_UpdateWeaponWait = false;
|
|||
|
private bool m_UpdateWeaponGemWait = false;
|
|||
|
private bool m_UpdateWingModelWait = false;
|
|||
|
|
|||
|
public void UpdateVisualAfterSkill()
|
|||
|
{
|
|||
|
if (m_UpdateModelWait)
|
|||
|
{
|
|||
|
ReloadPlayerModelVisual();
|
|||
|
}
|
|||
|
|
|||
|
if (m_UpdateWeaponWait)
|
|||
|
{
|
|||
|
RealoadPlayerWeaponVisual();
|
|||
|
}
|
|||
|
|
|||
|
if (m_UpdateWeaponGemWait)
|
|||
|
{
|
|||
|
ReloadPlayerEffect();
|
|||
|
}
|
|||
|
|
|||
|
if (m_UpdateWingModelWait)
|
|||
|
{
|
|||
|
RealoadWingModel();
|
|||
|
}
|
|||
|
|
|||
|
m_UpdateModelWait = false;
|
|||
|
m_UpdateWeaponWait = false;
|
|||
|
m_UpdateWeaponGemWait = false;
|
|||
|
m_UpdateWingModelWait = false;
|
|||
|
}
|
|||
|
|
|||
|
//玩家轻功部分处理
|
|||
|
private bool m_bQingGongState = false;
|
|||
|
public bool QingGongState
|
|||
|
{
|
|||
|
get { return m_bQingGongState; }
|
|||
|
set { m_bQingGongState = value; }
|
|||
|
}
|
|||
|
|
|||
|
private float m_DistanceValue = 0f;
|
|||
|
private Vector3 m_QingGongSrc = Vector3.zero;
|
|||
|
private Vector3 m_QingGongDst = Vector3.zero;
|
|||
|
private int m_nQingGongType = GlobeVar.INVALID_ID;
|
|||
|
private int m_nQingGongPointID = GlobeVar.INVALID_ID;
|
|||
|
public int QingGongPointID
|
|||
|
{
|
|||
|
get { return m_nQingGongPointID; }
|
|||
|
}
|
|||
|
private float m_fQingGongMaxHeight = 0;
|
|||
|
private float m_fQingGongTime = 0;
|
|||
|
private float m_fQingGongBeginTime = 0;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//public virtual void BeginQingGong(GameEvent _event)
|
|||
|
//{
|
|||
|
// if (_event.EventID != GameDefine_Globe.EVENT_DEFINE.EVENT_QINGGONG)
|
|||
|
// {
|
|||
|
// return;
|
|||
|
// }
|
|||
|
//
|
|||
|
// //得到目标点坐标
|
|||
|
// Vector3 dstPos = new Vector3(_event.GetFloatParam(0), _event.GetFloatParam(1), _event.GetFloatParam(2));
|
|||
|
// //dstPos.y = Terrain.activeTerrain.SampleHeight(dstPos);
|
|||
|
//
|
|||
|
// if (m_ObjTransform == null)
|
|||
|
// {
|
|||
|
// m_ObjTransform = transform;
|
|||
|
// }
|
|||
|
//
|
|||
|
// m_bQingGongState = true;
|
|||
|
// m_QingGongDst = dstPos;
|
|||
|
// m_QingGongSrc = m_ObjTransform.position;
|
|||
|
//
|
|||
|
// //忽略阻挡前进
|
|||
|
// if (null != NavAgent && NavAgent.enabled)
|
|||
|
// {
|
|||
|
// NavAgent.enabled = false;
|
|||
|
// }
|
|||
|
//
|
|||
|
// m_fMoveSpeed = _event.GetFloatParam(3);
|
|||
|
// m_nQingGongType = _event.GetIntParam(0);
|
|||
|
// m_fQingGongMaxHeight = _event.GetFloatParam(4);
|
|||
|
//
|
|||
|
// m_nQingGongPointID = _event.GetIntParam(1);
|
|||
|
//
|
|||
|
// //记录朝向,注意抛物线轨迹由UpdateQingGong进行位移操作,不使用系统MoveTo
|
|||
|
// FaceTo(m_QingGongDst);
|
|||
|
//
|
|||
|
// //根据不同类型模拟线路和调整玩家角度
|
|||
|
// if (m_nQingGongType == (int)GameDefine_Globe.QINGGONG_TRAIL_TYPE.PARABOLA)
|
|||
|
// {
|
|||
|
// //如果是抛物线移动
|
|||
|
// CurObjAnimState = GameDefine_Globe.OBJ_ANIMSTATE.STATE_JUMP;
|
|||
|
//
|
|||
|
// //根据起始点和目标点计算本次轻功运动时间
|
|||
|
// float fTreckDistance = Vector3.Distance(m_QingGongSrc, m_QingGongDst);
|
|||
|
// if (m_fMoveSpeed > 0)
|
|||
|
// {
|
|||
|
// m_fQingGongTime = fTreckDistance / m_fMoveSpeed;
|
|||
|
// }
|
|||
|
//
|
|||
|
// //本次允许最大浮动值
|
|||
|
// m_DistanceValue = (fTreckDistance + Mathf.Abs(m_fQingGongMaxHeight)) * 1.5f;
|
|||
|
//
|
|||
|
// //记录轻功开始时间
|
|||
|
// m_fQingGongBeginTime = Time.time;
|
|||
|
// }
|
|||
|
// else if (m_nQingGongType == (int)GameDefine_Globe.QINGGONG_TRAIL_TYPE.TURN_LEFT)
|
|||
|
// {
|
|||
|
// //如果是线性移动
|
|||
|
// CurObjAnimState = GameDefine_Globe.OBJ_ANIMSTATE.STATE_FASTRUN_LEFT;
|
|||
|
// //直线移动,使用底层MoveTo即可
|
|||
|
// MoveAsMainPlayer(m_QingGongDst);
|
|||
|
// }
|
|||
|
// else if (m_nQingGongType == (int)GameDefine_Globe.QINGGONG_TRAIL_TYPE.TURN_RIGHT)
|
|||
|
// {
|
|||
|
// //如果是线性移动
|
|||
|
// CurObjAnimState = GameDefine_Globe.OBJ_ANIMSTATE.STATE_FASTRUN_RIGHT;
|
|||
|
// //直线移动,使用底层MoveTo即可
|
|||
|
// MoveAsMainPlayer(m_QingGongDst);
|
|||
|
// }
|
|||
|
//
|
|||
|
// //播放轻功特效
|
|||
|
// if (null != ObjEffectLogic)
|
|||
|
// {
|
|||
|
// PlayEffect(GlobeVar.QINGGONG_EFFECT);
|
|||
|
// }
|
|||
|
//}
|
|||
|
//
|
|||
|
//public virtual void EndQingGong()
|
|||
|
//{
|
|||
|
// StopMove(MoveState.JumpDelay);
|
|||
|
// m_bQingGongState = false;
|
|||
|
//
|
|||
|
// //恢复数据
|
|||
|
// if (NavAgent)
|
|||
|
// {
|
|||
|
// NavAgent.enabled = true;
|
|||
|
// }
|
|||
|
//
|
|||
|
// m_fMoveSpeed = BaseAttr.MoveSpeed;
|
|||
|
//
|
|||
|
// //重置参数
|
|||
|
// m_fQingGongMaxHeight = 0;
|
|||
|
// m_fQingGongTime = 0;
|
|||
|
// m_fQingGongBeginTime = 0;
|
|||
|
//
|
|||
|
// m_DistanceValue = 0f;
|
|||
|
// m_QingGongSrc = Vector3.zero;
|
|||
|
// m_QingGongDst = Vector3.zero;
|
|||
|
//}
|
|||
|
//
|
|||
|
//public virtual void UpdateQingGong()
|
|||
|
//{
|
|||
|
// if (false == m_bQingGongState)
|
|||
|
// {
|
|||
|
// return;
|
|||
|
// }
|
|||
|
//
|
|||
|
// //计算从轻功开始到结束的流逝时间
|
|||
|
// float fElapseTime = Time.time - m_fQingGongBeginTime;
|
|||
|
//
|
|||
|
// //到达目的地,轻功结束
|
|||
|
// if (Vector3.Distance(m_ObjTransform.position, m_QingGongDst) < 0.4f
|
|||
|
// || fElapseTime > m_fQingGongTime * 2) //添加时间限制。如果时间超出正常时间2倍后,结束轻功
|
|||
|
// {
|
|||
|
// m_ObjTransform.position = m_QingGongDst;
|
|||
|
// EndQingGong();
|
|||
|
// return;
|
|||
|
// }
|
|||
|
//
|
|||
|
// //如果是抛物线轨迹,根据最大高度进行抛物线轨迹更新
|
|||
|
// if (m_nQingGongType == (int)GameDefine_Globe.QINGGONG_TRAIL_TYPE.PARABOLA)
|
|||
|
// {
|
|||
|
// //更新运动轨迹
|
|||
|
// Vector3 fMoveDirection = (m_QingGongDst - m_QingGongSrc).normalized;
|
|||
|
//
|
|||
|
// //当前点
|
|||
|
// Vector3 curPos = m_QingGongSrc + fMoveDirection * m_fMoveSpeed * fElapseTime;
|
|||
|
//
|
|||
|
// if (m_fQingGongMaxHeight > 0 && m_fQingGongTime > 0)
|
|||
|
// {
|
|||
|
// //获得当前时间在轻功总行程中的路径比例
|
|||
|
// float fRate = fElapseTime / m_fQingGongTime;
|
|||
|
//
|
|||
|
// float fHeightRefix = 0.0f;
|
|||
|
// //抛物线分前半段和后半段,分别处于上升和下降
|
|||
|
// if (fRate < 0.5f)
|
|||
|
// {
|
|||
|
// fHeightRefix = m_fQingGongMaxHeight * (fRate / 0.5f);
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// fHeightRefix = m_fQingGongMaxHeight * ((1 - fRate) / 0.5f);
|
|||
|
// }
|
|||
|
//
|
|||
|
// //修正MainPlayer的高度
|
|||
|
// //Vector3 pos = transform.position;
|
|||
|
// curPos.y = curPos.y + fHeightRefix;
|
|||
|
//
|
|||
|
// //对位置进行验证。如果发现位置计算失败,直接到目的位置,结束本次轻功
|
|||
|
// float difValue = Vector3.Distance(m_QingGongSrc, curPos);
|
|||
|
// if (difValue > m_DistanceValue)
|
|||
|
// {
|
|||
|
// m_ObjTransform.position = m_QingGongDst;
|
|||
|
// EndQingGong();
|
|||
|
// return;
|
|||
|
// }
|
|||
|
//
|
|||
|
// m_ObjTransform.position = curPos;
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// //数据出错
|
|||
|
// m_ObjTransform.position = m_QingGongDst;
|
|||
|
// EndQingGong();
|
|||
|
// }
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
public override void ShowChatBubble(ChatHistoryItem history)
|
|||
|
{
|
|||
|
if (null != m_headUIObj)
|
|||
|
{
|
|||
|
m_headUIObj.ShowChatBubble(history);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override void SetVisible(bool bVisible)
|
|||
|
{
|
|||
|
base.SetVisible(bVisible);
|
|||
|
OnSwithObjAnimState(CurObjAnimState);
|
|||
|
|
|||
|
Obj_Character curFellow = Singleton<ObjManager>.Instance.FindObjInScene(m_fellowID) as Obj_Character;
|
|||
|
if (null == curFellow)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
curFellow.SetVisible(bVisible);
|
|||
|
}
|
|||
|
//跑商
|
|||
|
private int m_nPaoShangState = -1;
|
|||
|
public int PaoShangState
|
|||
|
{
|
|||
|
get { return m_nPaoShangState; }
|
|||
|
set { m_nPaoShangState = value; }
|
|||
|
}
|
|||
|
//public void UpdatePaoShangStateEffect(int nState)
|
|||
|
//{
|
|||
|
// //名字图标
|
|||
|
// //if (m_headUIObj)
|
|||
|
// //{
|
|||
|
// // m_headUIObj.UpdatePaoShangIcon(nState);
|
|||
|
// //}
|
|||
|
// //特效
|
|||
|
// switch (nState)
|
|||
|
// {
|
|||
|
// case (int)GC_BROADCASTPSSTATE.PSSTATE.REMOVE:
|
|||
|
// StopEffect(238);
|
|||
|
// StopEffect(239);
|
|||
|
// break;
|
|||
|
// case (int)GC_BROADCASTPSSTATE.PSSTATE.CANROB:
|
|||
|
// StopEffect(239);
|
|||
|
// PlayEffect(238);
|
|||
|
// break;
|
|||
|
// case (int)GC_BROADCASTPSSTATE.PSSTATE.NOTCANROB:
|
|||
|
// StopEffect(238);
|
|||
|
// PlayEffect(239);
|
|||
|
// break;
|
|||
|
// }
|
|||
|
//}
|
|||
|
|
|||
|
// #region Jump功能
|
|||
|
// private bool _jumpState;
|
|||
|
// private float _jumpTimeStart = 1.0f;
|
|||
|
// private float _jumpTime1;
|
|||
|
// private float _jumpTime2;
|
|||
|
// private float _jumpTime3;
|
|||
|
// private string _jumpName1;
|
|||
|
// private string _jumpName2;
|
|||
|
// private string _jumpName3;
|
|||
|
// private int _playingJumpAnim;
|
|||
|
//
|
|||
|
//protected void UpdateJumpState()
|
|||
|
//{
|
|||
|
// if (NavAgent != null && NavAgent.isActiveAndEnabled)
|
|||
|
// {
|
|||
|
// if (NavAgent.isOnOffMeshLink && !_jumpState)
|
|||
|
// {
|
|||
|
// if (!SkillAllowMove)
|
|||
|
// return;
|
|||
|
// if (AnimLogic.AnimationControl == null)
|
|||
|
// return;
|
|||
|
// //NavAgent.speed = NavAgent.currentOffMeshLinkData.offMeshLink.costOverride;
|
|||
|
// _jumpState = true;
|
|||
|
// _jumpTimeStart = Time.time;
|
|||
|
// if (NavAgent.currentOffMeshLinkData.offMeshLink.costOverride <= 1)
|
|||
|
// {
|
|||
|
// var animTab =
|
|||
|
// TableManager.GetAnimationByID((int)CharacterDefine.CharacterAnimId.Jump01, 0);
|
|||
|
// _jumpName1 = animTab.AnimName;
|
|||
|
// animTab = TableManager.GetAnimationByID((int)CharacterDefine.CharacterAnimId.Jump01_Loop,
|
|||
|
// 0);
|
|||
|
// _jumpName2 = animTab.AnimName;
|
|||
|
// animTab = TableManager.GetAnimationByID((int)CharacterDefine.CharacterAnimId.Jump01_End,
|
|||
|
// 0);
|
|||
|
// _jumpName3 = animTab.AnimName;
|
|||
|
// }
|
|||
|
// else if (NavAgent.currentOffMeshLinkData.offMeshLink.costOverride <= 2)
|
|||
|
// {
|
|||
|
// var animTab =
|
|||
|
// TableManager.GetAnimationByID((int)CharacterDefine.CharacterAnimId.Jump02, 0);
|
|||
|
// _jumpName1 = animTab.AnimName;
|
|||
|
// animTab = TableManager.GetAnimationByID((int)CharacterDefine.CharacterAnimId.Jump02_Loop,
|
|||
|
// 0);
|
|||
|
// _jumpName2 = animTab.AnimName;
|
|||
|
// animTab = TableManager.GetAnimationByID((int)CharacterDefine.CharacterAnimId.Jump02_End,
|
|||
|
// 0);
|
|||
|
// _jumpName3 = animTab.AnimName;
|
|||
|
// }
|
|||
|
// var anims = AnimLogic.AnimationControl.runtimeAnimatorController.animationClips;
|
|||
|
// foreach (var anim in anims)
|
|||
|
// if (anim.name == _jumpName1)
|
|||
|
// _jumpTime1 = anim.length;
|
|||
|
// else if (anim.name == _jumpName2)
|
|||
|
// _jumpTime2 = anim.length;
|
|||
|
// else if (anim.name == _jumpName3)
|
|||
|
// _jumpTime3 = anim.length;
|
|||
|
// _playingJumpAnim = 0;
|
|||
|
// CurObjAnimState = GameDefine_Globe.OBJ_ANIMSTATE.STATE_JUMP;
|
|||
|
// NavAgent.transform.LookAt(new Vector3(NavAgent.currentOffMeshLinkData.endPos.x,
|
|||
|
// NavAgent.transform.position.y, NavAgent.currentOffMeshLinkData.endPos.z));
|
|||
|
// //AnimLogic.m_animator.Play(_JumpName1);
|
|||
|
// }
|
|||
|
// if (_jumpState)
|
|||
|
// {
|
|||
|
// var newPos = Vector3.zero;
|
|||
|
// var deltaTime = Time.time - _jumpTimeStart;
|
|||
|
// if (deltaTime < _jumpTime1)
|
|||
|
// {
|
|||
|
// newPos = NavAgent.currentOffMeshLinkData.startPos;
|
|||
|
// //NavAgent.enabled = false;
|
|||
|
// NavAgent.transform.position = newPos;
|
|||
|
// NavAgent.transform.LookAt(new Vector3(NavAgent.currentOffMeshLinkData.endPos.x,
|
|||
|
// NavAgent.transform.position.y, NavAgent.currentOffMeshLinkData.endPos.z));
|
|||
|
// if (_playingJumpAnim != 1)
|
|||
|
// {
|
|||
|
// AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Jump01);
|
|||
|
// _playingJumpAnim = 1;
|
|||
|
// EnableMovingRotation(false);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else if (deltaTime < _jumpTime1 + _jumpTime2)
|
|||
|
// {
|
|||
|
// var moveDelta = (deltaTime - _jumpTime1) / _jumpTime2;
|
|||
|
// newPos = Vector3.Lerp(NavAgent.currentOffMeshLinkData.startPos,
|
|||
|
// NavAgent.currentOffMeshLinkData.endPos, moveDelta);
|
|||
|
// newPos.y += 2f * Mathf.Sin(Mathf.PI * moveDelta);
|
|||
|
// NavAgent.transform.position = newPos;
|
|||
|
//
|
|||
|
// if (_playingJumpAnim != 2)
|
|||
|
// {
|
|||
|
// AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Jump01_Loop);
|
|||
|
// _playingJumpAnim = 2;
|
|||
|
// }
|
|||
|
// NavAgent.transform.LookAt(new Vector3(NavAgent.currentOffMeshLinkData.endPos.x,
|
|||
|
// NavAgent.transform.position.y, NavAgent.currentOffMeshLinkData.endPos.z));
|
|||
|
// }
|
|||
|
// else if (deltaTime < _jumpTime1 + _jumpTime2 + _jumpTime3)
|
|||
|
// {
|
|||
|
// newPos = NavAgent.currentOffMeshLinkData.endPos;
|
|||
|
// NavAgent.transform.position = newPos;
|
|||
|
// if (_playingJumpAnim != 3)
|
|||
|
// {
|
|||
|
// AnimLogic.Play((int)CharacterDefine.CharacterAnimId.Jump01_End);
|
|||
|
// _playingJumpAnim = 3;
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else
|
|||
|
// {
|
|||
|
// _playingJumpAnim = 0;
|
|||
|
// NavAgent.CompleteOffMeshLink();
|
|||
|
// NavAgent.Resume();
|
|||
|
// CurObjAnimState = GameDefine_Globe.OBJ_ANIMSTATE.STATE_WALK;
|
|||
|
// _jumpState = false;
|
|||
|
// EnableMovingRotation(true);
|
|||
|
// }
|
|||
|
// }
|
|||
|
// //else
|
|||
|
// //{
|
|||
|
// // if (_JumpState)
|
|||
|
// // {
|
|||
|
// // NavAgent.speed = BaseAttr.MoveSpeed;
|
|||
|
// // _JumpState = false;
|
|||
|
// // CurObjAnimState = GameDefine_Globe.OBJ_ANIMSTATE.STATE_WALK;
|
|||
|
// // }
|
|||
|
// //}
|
|||
|
// }
|
|||
|
//}
|
|||
|
//#endregion
|
|||
|
}
|
|||
|
}
|