当前位置: 首页>>代码示例>>C#>>正文


C# EntityInfo.GetActualProperty方法代码示例

本文整理汇总了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);
        }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:8,代码来源:AttrCalculator.cs

示例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;
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:16,代码来源:DataSyncUtility.cs

示例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);
                }
            }
        }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:40,代码来源:MovementSystem.cs

示例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);
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:21,代码来源:ImpactInfo.cs

示例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);
         }
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:32,代码来源:AiLogicUtility.cs

示例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);
         }
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:31,代码来源:EntityViewModel_Npc.cs


注:本文中的GameFramework.EntityInfo.GetActualProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。