本文整理汇总了C#中GameFramework.EntityInfo.GetActualProperty方法的典型用法代码示例。如果您正苦于以下问题:C# EntityInfo.GetActualProperty方法的具体用法?C# EntityInfo.GetActualProperty怎么用?C# EntityInfo.GetActualProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameFramework.EntityInfo
的用法示例。
在下文中一共展示了EntityInfo.GetActualProperty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Calc
public static void Calc(EntityInfo entity)
{
ResetBaseProperty(entity);
RefixAttrByImpact(entity);
int hpMax = entity.GetActualProperty().HpMax;
entity.GetActualProperty().SetHpMax(Operate_Type.OT_Absolute, hpMax);
}
示例2: BuildNpcMoveMessage
internal static Msg_RC_NpcMove BuildNpcMoveMessage(EntityInfo npc)
{
ScriptRuntime.Vector3 srcPos = npc.GetMovementStateInfo().GetPosition3D();
Msg_RC_NpcMove npcMoveBuilder = new Msg_RC_NpcMove();
if (npc.GetMovementStateInfo().IsMoving) {
npcMoveBuilder.npc_id = npc.GetId();
npcMoveBuilder.velocity = ProtoHelper.EncodeFloat(npc.GetActualProperty().MoveSpeed);
ScriptRuntime.Vector3 targetPos = npc.GetMovementStateInfo().TargetPosition;
npcMoveBuilder.target_pos = ProtoHelper.EncodePosition2D(targetPos.X, targetPos.Z);
npcMoveBuilder.cur_pos = ProtoHelper.EncodePosition2D(srcPos.X, srcPos.Z);
} else {
npcMoveBuilder.npc_id = npc.GetId();
npcMoveBuilder.cur_pos = ProtoHelper.EncodePosition2D(srcPos.X, srcPos.Z);
}
return npcMoveBuilder;
}
示例3: MoveNpc
private void MoveNpc(EntityInfo obj, long deltaTime)
{
if (obj.IsHaveStateFlag(CharacterState_Type.CST_Sleep)
|| obj.IsHaveStateFlag(CharacterState_Type.CST_FixedPosition)) {
return;
}
MovementStateInfo msi = obj.GetMovementStateInfo();
//npc执行移动时忽略阻挡与避让,这些行为由ai模块在规划其路径时执行。
if (!obj.IsDead() && obj.CanMove && msi.IsMoving && !msi.IsSkillMoving) {
ScriptRuntime.Vector3 pos = msi.GetPosition3D();
float speed = (float)obj.GetActualProperty().MoveSpeed;
float distance = (speed * (float)(int)deltaTime) / 1000.0f;
ScriptRuntime.Vector3 dir = msi.TargetDir;
//LogSystem.Debug("MovementSystem npc:{0} speed:{1} deltaTime:{2} distance:{3}", obj.GetId(), speed, deltaTime, distance);
float x = 0, y = 0;
if (msi.CalcDistancSquareToTarget() < distance * distance) {
x = msi.TargetPosition.X;
y = msi.TargetPosition.Z;
ScriptRuntime.Vector2 newPos = new ScriptRuntime.Vector2(x, y);
msi.SetPosition2D(newPos);
msi.IsMoving = false;
User user = obj.CustomData as User;
if (null != user) {
Msg_RC_NpcMove npcMoveBuilder = DataSyncUtility.BuildNpcMoveMessage(obj);
if (null != npcMoveBuilder) {
Scene scene = user.OwnRoom.ActiveScene;
if (null != scene) {
scene.NotifyAllUser(RoomMessageDefine.Msg_RC_NpcMove, npcMoveBuilder);
}
}
}
} else {
ScriptRuntime.Vector3 tpos = pos + dir * distance;
msi.SetPosition(tpos);
}
}
}
示例4: RefixCharacterProperty
public void RefixCharacterProperty(EntityInfo entity)
{
if (DamageData.AddAttack != 0) {
entity.GetActualProperty().SetAttackBase(Operate_Type.OT_Relative, DamageData.AddAttack);
}
if (DamageData.AddDefence != 0) {
entity.GetActualProperty().SetDefenceBase(Operate_Type.OT_Relative, DamageData.AddDefence);
}
if (DamageData.AddRps != 0) {
entity.GetActualProperty().SetRps(Operate_Type.OT_Relative, DamageData.AddRps);
}
if (DamageData.AddCritical != 0) {
entity.GetActualProperty().SetCritical(Operate_Type.OT_Relative, DamageData.AddCritical);
}
if (DamageData.AddCriticalPow != 0) {
entity.GetActualProperty().SetCriticalPow(Operate_Type.OT_Relative, DamageData.AddCriticalPow);
}
if (Math.Abs(DamageData.AddSpeed) > Geometry.c_FloatPrecision) {
entity.GetActualProperty().SetMoveSpeed(Operate_Type.OT_Relative, DamageData.AddSpeed);
}
}
示例5: DoPursuitCommandState
internal static void DoPursuitCommandState(EntityInfo entity, long deltaTime, AbstractAiStateLogic logic)
{
AiStateInfo info = entity.GetAiStateInfo();
info.Time += deltaTime;
if (info.Time > 200) {
EntityInfo target = AiLogicUtility.GetLivingCharacterInfoHelper(entity, info.Target);
if (null != target) {
float minDist = entity.GetRadius() + target.GetRadius();
float dist = (float)entity.GetActualProperty().AttackRange + minDist;
float distGoHome = entity.GohomeRange;
Vector3 targetPos = target.GetMovementStateInfo().GetPosition3D();
ScriptRuntime.Vector3 srcPos = entity.GetMovementStateInfo().GetPosition3D();
float dir = Geometry.GetYRadian(new Vector2(targetPos.X, targetPos.Z), new Vector2(srcPos.X, srcPos.Z));
targetPos.X += (float)(minDist * Math.Sin(dir));
targetPos.Z += (float)(minDist * Math.Cos(dir));
float powDist = Geometry.DistanceSquare(srcPos, targetPos);
if (powDist < dist * dist) {
logic.AiSendStoryMessage(entity, "npc_pursuit_finish:" + entity.GetUnitId(), entity.GetId());
logic.AiSendStoryMessage(entity, "obj_pursuit_finish", entity.GetId());
logic.NotifyAiStopPursue(entity);
logic.ChangeToState(entity, (int)AiStateId.Idle);
} else {
logic.NotifyAiPursue(entity, targetPos);
}
} else {
logic.AiSendStoryMessage(entity, "npc_pursuit_exit:" + entity.GetUnitId(), entity.GetId());
logic.AiSendStoryMessage(entity, "obj_pursuit_exit", entity.GetId());
logic.NotifyAiStopPursue(entity);
logic.ChangeToState(entity, (int)AiStateId.Idle);
}
}
}
示例6: Create
internal void Create(EntityInfo entity)
{
if (null != entity) {
m_Entity = entity;
MovementStateInfo msi = m_Entity.GetMovementStateInfo();
ScriptRuntime.Vector3 pos = msi.GetPosition3D();
float dir = msi.GetFaceDir();
CreateActor(m_Entity.GetId(), m_Entity.GetModel(), pos.X, pos.Y, pos.Z, dir, m_Entity.Scale, m_Entity.GetRadius(), m_Entity.GetActualProperty().MoveSpeed);
if (null != Actor) {
m_Agent = Actor.GetComponent<NavMeshAgent>();
if (m_Agent == null) {
m_Agent = Actor.AddComponent<NavMeshAgent>();
m_Agent.angularSpeed = c_AngularSpeed;
m_Agent.acceleration = c_Acceleration;
m_Agent.radius = entity.GetRadius();
m_Agent.speed = entity.GetActualProperty().MoveSpeed;
m_Agent.obstacleAvoidanceType = ObstacleAvoidanceType.NoObstacleAvoidance;
m_Agent.ResetPath();
}
m_Animator = Actor.GetComponentInChildren<Animator>();
EntityDrawGizmos gizmos = Actor.GetComponent<EntityDrawGizmos>();
if (null == gizmos) {
gizmos = Actor.AddComponent<EntityDrawGizmos>();
gizmos.npcInfo = m_Entity;
} else {
gizmos.npcInfo = m_Entity;
}
SetMoveAgentEnable(true);
}
}
}