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


C# EntityInfo.GetMovementStateInfo方法代码示例

本文整理汇总了C#中EntityInfo.GetMovementStateInfo方法的典型用法代码示例。如果您正苦于以下问题:C# EntityInfo.GetMovementStateInfo方法的具体用法?C# EntityInfo.GetMovementStateInfo怎么用?C# EntityInfo.GetMovementStateInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EntityInfo的用法示例。


在下文中一共展示了EntityInfo.GetMovementStateInfo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnStateLogicInit

 protected override void OnStateLogicInit(EntityInfo npc, long deltaTime)
 {
     AiStateInfo info = npc.GetAiStateInfo();
     info.Time = 0;
     info.HomePos = npc.GetMovementStateInfo().GetPosition3D();
     info.Target = 0;
     NotifyAiInitDslLogic(npc);
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:8,代码来源:AiLogic_Npc_User.cs

示例2: Init

 private void Init(EntityInfo obj, EntityInfo target, SkillInstance instance)
 {
     CopySectionList();
     CalNewSpeedWithTarget(obj, target, instance);
     m_Now = instance.CurTime / 1000.0f;
     m_SectionListCopy[0].startTime = m_Now;
     m_SectionListCopy[0].lastUpdateTime = m_Now;
     m_SectionListCopy[0].curSpeedVect = m_SectionListCopy[0].speedVect;
     m_StartPos = obj.GetMovementStateInfo().GetPosition3D();
     m_StartDir = obj.GetMovementStateInfo().GetFaceDir();
     m_IsInited = true;
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:12,代码来源:MovementTrigger.cs

示例3: CalNewSpeedWithTarget

 private void CalNewSpeedWithTarget(EntityInfo obj, EntityInfo target, SkillInstance instance)
 {
     if (null == obj || null == target)
         return;
     Vector3 srcPos = obj.GetMovementStateInfo().GetPosition3D();
     Vector3 targetPos = target.GetMovementStateInfo().GetPosition3D();
     obj.GetMovementStateInfo().SetFaceDir(Geometry.GetYRadian(new Vector2(srcPos.X, srcPos.Z), new Vector2(targetPos.X, targetPos.Z)));
     float cur_distance_z = 0;
     for (int i = 0; i < m_SectionListCopy.Count; i++) {
         cur_distance_z += (m_SectionListCopy[i].speedVect.Z * m_SectionListCopy[i].moveTime +
                            m_SectionListCopy[i].accelVect.Z * m_SectionListCopy[i].moveTime * m_SectionListCopy[i].moveTime / 2.0f);
     }
     Vector3 target_motion = (targetPos - srcPos);
     target_motion.Y = 0;
     float target_distance_z = target_motion.Length();
     float speed_ratio = 1;
     if (cur_distance_z != 0) {
         speed_ratio = target_distance_z / cur_distance_z;
     }
     for (int i = 0; i < m_SectionListCopy.Count; i++) {
         m_SectionListCopy[i].speedVect.Z *= speed_ratio;
         m_SectionListCopy[i].accelVect.Z *= speed_ratio;
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:24,代码来源:MovementTrigger.cs

示例4: SetTransformRelativeSelf

 private void SetTransformRelativeSelf(EntityInfo obj)
 {
     Vector3 new_pos = TriggerUtil.TransformPoint(obj.GetMovementStateInfo().GetPosition3D(), m_Postion, obj.GetMovementStateInfo().GetFaceDir());
     TriggerUtil.MoveObjTo(obj, new_pos);
     float dir = obj.GetMovementStateInfo().GetFaceDir();
     float radian = (dir + Geometry.DegreeToRadian((Helper.Random.NextFloat() - 0.5f) * m_Rotate.Y)) % (float)(Math.PI * 2);
     obj.GetMovementStateInfo().SetFaceDir(radian);
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:8,代码来源:TransformTrigger.cs

示例5: AttachToObjectForRandomRotate

 private void AttachToObjectForRandomRotate(EntityInfo obj, EntityInfo owner)
 {
     Vector3 world_pos = TriggerUtil.TransformPoint(owner.GetMovementStateInfo().GetPosition3D(), m_Postion, owner.GetMovementStateInfo().GetFaceDir());
     TriggerUtil.MoveObjTo(obj, world_pos);
     float dir = obj.GetMovementStateInfo().GetFaceDir();
     float radian = (dir + Geometry.DegreeToRadian((Helper.Random.NextFloat() - 0.5f) * m_RandomRotate.Y)) % (float)(Math.PI * 2);
     obj.GetMovementStateInfo().SetFaceDir(radian);
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:8,代码来源:TransformTrigger.cs

示例6: AttachToObject

 private void AttachToObject(EntityInfo obj, EntityInfo owner)
 {
     Vector3 world_pos = TriggerUtil.TransformPoint(owner.GetMovementStateInfo().GetPosition3D(), m_Postion, owner.GetMovementStateInfo().GetFaceDir());
     TriggerUtil.MoveObjTo(obj, world_pos);
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:5,代码来源:TransformTrigger.cs

示例7: MoveObjTo

 internal static void MoveObjTo(EntityInfo obj, Vector3 position)
 {
     obj.GetMovementStateInfo().SetPosition(position);
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:4,代码来源:TriggerUtil.cs

示例8: Lookat

 internal static void Lookat(Scene scene, EntityInfo obj, Vector3 target)
 {
     if (scene.EntityController.GetEntityType(obj) == (int)EntityTypeEnum.Tower)
         return;
     Vector3 srcPos = obj.GetMovementStateInfo().GetPosition3D();
     obj.GetMovementStateInfo().SetFaceDir(Geometry.GetYRadian(new Vector2(srcPos.X, srcPos.Z), new Vector2(target.X, target.Z)));
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:7,代码来源:TriggerUtil.cs

示例9: GetObjFaceDir

 internal static float GetObjFaceDir(EntityInfo obj)
 {
     return obj.GetMovementStateInfo().GetFaceDir();
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:4,代码来源:TriggerUtil.cs

示例10: GetHeightWithGround

 internal static float GetHeightWithGround(EntityInfo obj)
 {
     return GetHeightWithGround(obj.GetMovementStateInfo().GetPosition3D());
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:4,代码来源:TriggerUtil.cs

示例11: AoeQuery

        public static void AoeQuery(Scene scene, EntityInfo srcObj, EntityInfo targetObj, int aoeType, float range, float angleOrLength, SkillInstance instance, int senderId, int targetType, Vector3 relativeCenter, bool relativeToTarget, MyFunc<float, int, bool> callback)
        {
            float radian;
            Vector3 center;
            Vector3 srcPos = srcObj.GetMovementStateInfo().GetPosition3D();
            if (null != targetObj && relativeToTarget) {
                Vector3 targetPos = targetObj.GetMovementStateInfo().GetPosition3D();
                radian = Geometry.GetYRadian(new ScriptRuntime.Vector2(srcPos.X, srcPos.Z), new ScriptRuntime.Vector2(targetPos.X, targetPos.Z));
                ScriptRuntime.Vector2 newOffset = Geometry.GetRotate(new ScriptRuntime.Vector2(relativeCenter.X, relativeCenter.Z), radian);
                center = targetPos + new Vector3(newOffset.X, relativeCenter.Y, newOffset.Y);
            } else {
                radian = srcObj.GetMovementStateInfo().GetFaceDir();
                ScriptRuntime.Vector2 newOffset = Geometry.GetRotate(new ScriptRuntime.Vector2(relativeCenter.X, relativeCenter.Z), radian);
                center = srcPos + new Vector3(newOffset.X, relativeCenter.Y, newOffset.Y);
            }

            if (aoeType == (int)SkillAoeType.Circle || aoeType == (int)SkillAoeType.Sector) {
                angleOrLength = Geometry.DegreeToRadian(angleOrLength);
                scene.KdTree.Query(center.X, center.Y, center.Z, range, (float distSqr, KdTreeObject kdTreeObj) => {
                    int targetId = kdTreeObj.Object.GetId();
                    if (targetType == (int)SkillTargetType.Enemy && CharacterRelation.RELATION_ENEMY == scene.EntityController.GetRelation(senderId, targetId) ||
                        targetType == (int)SkillTargetType.Friend && CharacterRelation.RELATION_FRIEND == scene.EntityController.GetRelation(senderId, targetId)) {
                        bool isMatch = false;
                        if (aoeType == (int)SkillAoeType.Circle) {
                            isMatch = true;
                        } else {
                            ScriptRuntime.Vector2 u = Geometry.GetRotate(new ScriptRuntime.Vector2(0, 1), radian);
                            isMatch = Geometry.IsSectorDiskIntersect(new ScriptRuntime.Vector2(center.X, center.Z), u, angleOrLength / 2, range, new ScriptRuntime.Vector2(kdTreeObj.Position.X, kdTreeObj.Position.Z), kdTreeObj.Radius);
                        }
                        if (isMatch) {
                            if (!callback(distSqr, kdTreeObj.Object.GetId())) {
                                return false;
                            }
                        }
                    }
                    return true;
                });
            } else {
                ScriptRuntime.Vector2 angleu = Geometry.GetRotate(new ScriptRuntime.Vector2(0, angleOrLength), radian);
                ScriptRuntime.Vector2 c = new ScriptRuntime.Vector2(center.X, center.Z) + angleu / 2;
                scene.KdTree.Query(c.X, 0, c.Y, range + angleOrLength / 2, (float distSqr, GameFramework.KdTreeObject kdTreeObj) => {
                    int targetId = kdTreeObj.Object.GetId();
                    if (targetType == (int)SkillTargetType.Enemy && CharacterRelation.RELATION_ENEMY == scene.EntityController.GetRelation(senderId, targetId) ||
                        targetType == (int)SkillTargetType.Friend && CharacterRelation.RELATION_FRIEND == scene.EntityController.GetRelation(senderId, targetId)) {
                        bool isMatch = false;
                        if (aoeType == (int)SkillAoeType.Capsule) {
                            isMatch = Geometry.IsCapsuleDiskIntersect(new ScriptRuntime.Vector2(center.X, center.Z), angleu, range, new ScriptRuntime.Vector2(kdTreeObj.Position.X, kdTreeObj.Position.Z), kdTreeObj.Radius);
                        } else {
                            ScriptRuntime.Vector2 half = new ScriptRuntime.Vector2(range / 2, angleOrLength / 2);
                            isMatch = Geometry.IsObbDiskIntersect(c, half, radian, new ScriptRuntime.Vector2(kdTreeObj.Position.X, kdTreeObj.Position.Z), kdTreeObj.Radius);
                        }
                        if (isMatch) {
                            if (!callback(distSqr, kdTreeObj.Object.GetId())) {
                                return false;
                            }
                        }
                    }
                    return true;
                });
            }
        }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:61,代码来源:TriggerUtil.cs


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