本文整理汇总了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);
}
}
}
示例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);
}
}
}
}
示例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;
}
}
示例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);
}
}
}