137 lines
3.8 KiB
C#
137 lines
3.8 KiB
C#
|
using Thousandto.Code.Center;
|
|||
|
using Thousandto.Core.Asset;
|
|||
|
|
|||
|
namespace Thousandto.Code.Logic
|
|||
|
{
|
|||
|
public class AssistPet : Character
|
|||
|
{
|
|||
|
#region//私有变量
|
|||
|
//宠物属性模块
|
|||
|
private AssistPetProperty _propMoudleEx = null;
|
|||
|
private Entity _fllowEntity = null;
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 属性信息
|
|||
|
public new AssistPetProperty PropMoudle
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_propMoudleEx == null)
|
|||
|
{
|
|||
|
_propMoudleEx = base.PropMoudle as AssistPetProperty;
|
|||
|
}
|
|||
|
return _propMoudleEx;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//是否显示选中框
|
|||
|
public override bool CanShowSelectUI
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override bool CanBeSelect
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override bool IsShowModel
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _isShowModel;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
_isShowModel = value;
|
|||
|
if (_isShowModel != Skin.IsActive())
|
|||
|
{
|
|||
|
Skin.SetActive(_isShowModel);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
public Entity FllowEntity
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _fllowEntity;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region//初始化,卸载,加载Skin等处理
|
|||
|
//加载Skin
|
|||
|
protected override FSkinBase OnSetupSkin()
|
|||
|
{
|
|||
|
FSkinModel skin = GameCenter.LuaSystem.Adaptor.CreateFSkinModel(FSkinTypeCode.Pet);
|
|||
|
skin.SetLayer(LayerUtils.LocalPlayer);
|
|||
|
skin.SetMipmapLevel(0.5f);
|
|||
|
return skin;
|
|||
|
}
|
|||
|
//初始化
|
|||
|
protected override bool OnInitializeAfter(EntityInitInfo baseInfo)
|
|||
|
{
|
|||
|
var initInfo = baseInfo as AssistPetInitInfo;
|
|||
|
base.OnInitializeAfter(baseInfo);
|
|||
|
SyncInfo(initInfo);
|
|||
|
return true;
|
|||
|
}
|
|||
|
//卸载处理
|
|||
|
protected override void OnUninitializeBefore()
|
|||
|
{
|
|||
|
HideHUD();
|
|||
|
base.OnUninitializeBefore();
|
|||
|
}
|
|||
|
//初始化信息刷新
|
|||
|
public void SyncInfo(AssistPetInitInfo initInfo)
|
|||
|
{
|
|||
|
_propMoudle = _propMoudleEx = new AssistPetProperty(this, initInfo.Cfg);
|
|||
|
_fllowEntity = initInfo.FllowEntity;
|
|||
|
|
|||
|
if (Skin.GetSkinPartCfgID(FSkinPartCode.Body) != initInfo.Cfg.Model)
|
|||
|
{
|
|||
|
Skin.SetSkinPartFromCfgID(FSkinPartCode.Body, initInfo.Cfg.Model);
|
|||
|
}
|
|||
|
IsShowModel = GameObjectLimit.IsCanShow(this);
|
|||
|
BodyScale = initInfo.Cfg.SceneScale / 100f;
|
|||
|
}
|
|||
|
protected override bool OnSetupFSMBefore()
|
|||
|
{
|
|||
|
ResetDirection();
|
|||
|
return base.OnSetupFSMBefore();
|
|||
|
}
|
|||
|
//安装设置FSM状态机
|
|||
|
protected override bool OnSetupFSM()
|
|||
|
{
|
|||
|
Fsm = new EntityFSM(this);
|
|||
|
Fsm.AddState(new AssistPetFSM.Idle());
|
|||
|
Fsm.SetDefaultStateId(EntityStateID.Idle);
|
|||
|
Fsm.Init(this);
|
|||
|
return true;
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
//接受到被击时的处理
|
|||
|
#region 受击处理
|
|||
|
public override void OnBeAttackedResponse(Character attacker, HitEffectInfo hitInfo, SkillHitType hitType, MSG_Fight.HitEffectInfo msgInfo)
|
|||
|
{
|
|||
|
//宠物不能被攻击,所以不处理受击效果
|
|||
|
base.OnBeAttackedResponse(attacker, hitInfo, hitType, msgInfo);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region//心跳处理
|
|||
|
//心跳处理
|
|||
|
protected override void OnUpdate(float elapsedTime)
|
|||
|
{
|
|||
|
base.OnUpdate(elapsedTime);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|