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


C# EntityInfo.GetRadius方法代码示例

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


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

示例1: 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

示例2: GoHomeHandler

 private void GoHomeHandler(EntityInfo entity, long deltaTime)
 {
     AiStateInfo info = entity.GetAiStateInfo();
     info.Time += deltaTime;
     if (info.Time > c_IntervalTime) {
         info.Time = 0;
         AiData_General data = GetAiData(entity);
         if (null != data) {
             EntityInfo leader = AiLogicUtility.GetLivingCharacterInfoHelper(entity, info.LeaderID);
             if (null != leader) {
                 float minDist = entity.GetRadius() + leader.GetRadius();
                 Vector3 targetPos = GetHomePos(entity.GetMovementStateInfo().FormationIndex, leader);
                 ScriptRuntime.Vector3 srcPos = entity.GetMovementStateInfo().GetPosition3D();
                 float powDistToHome = Geometry.DistanceSquare(srcPos, targetPos);
                 if (powDistToHome <= (minDist + 1) * (minDist + 1)) {
                     NotifyAiStopPursue(entity);
                     ChangeToState(entity, (int)AiStateId.Idle);
                 } else {
                     NotifyAiPursue(entity, targetPos);
                 }
             } else {
                 NotifyAiStopPursue(entity);
                 ChangeToState(entity, (int)AiStateId.Idle);
             }
         }
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:27,代码来源:AiLogic_Npc_Member.cs

示例3: CopyFrom

 public void CopyFrom(EntityInfo obj)
 {
     if (null != obj) {
         Object = obj;
         Position = obj.GetMovementStateInfo().GetPosition3D();
         Radius = obj.GetRadius();
         MaxX = Position.X + Radius;
         MinX = Position.X - Radius;
         MaxZ = Position.Z + Radius;
         MinZ = Position.Z - Radius;
         Indexed = false;
     } else {
         Object = null;
         Position = new Vector3();
         Radius = 0;
         MaxX = MinX = 0;
         MaxZ = MinZ = 0;
         Indexed = false;
     }
 }
开发者ID:dreamanlan,项目名称:CSharpGameFramework,代码行数:20,代码来源:KdObjectTree.cs

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