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


C# ActorController.GetDistance2D方法代码示例

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


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

示例1: CombatCamEffect

 private bool CombatCamEffect(ref Vector3 basePos, GameObject obj, ActorController actorCtrler)
 {
     if (this.resultCamPlay)
     {
         return false;
     }
     if (actorCtrler != null)
     {
         if (actorCtrler.AiCtrler.Target != null && actorCtrler.GetDistance2D(actorCtrler.AiCtrler.Target.gameObject.transform.position) < actorCtrler.AiCtrler.AttackDistance)
         {
             if (actorCtrler.NavAgent.velocity.sqrMagnitude <= 0f)
             {
                 basePos += (actorCtrler.AiCtrler.Target.gameObject.transform.position - basePos) * 0.5f;
             }
             else
             {
                 basePos += obj.transform.forward * this.camTargetOffset;
             }
         }
         else if (actorCtrler.AiCtrler.EnableAI)
         {
             Vector3 vector = obj.transform.forward * this.camTargetOffset2;
             if (this.camCurForward != vector)
             {
                 this.camCurForward = UtilFunc.SpringDamp(this.camCurForward, vector, Time.smoothDeltaTime, 0.05f, 0.01f);
             }
             basePos += this.camCurForward;
         }
         else
         {
             basePos += obj.transform.forward * this.camTargetOffset;
         }
     }
     else
     {
         basePos += obj.transform.forward * this.camTargetOffset;
     }
     return true;
 }
开发者ID:floatyears,项目名称:Decrypt,代码行数:39,代码来源:CameraManager.cs

示例2: FindTower

 public ActorController FindTower(ActorController actor, float findDist)
 {
     if (actor == null)
     {
         return null;
     }
     float num = 3.40282347E+38f;
     ActorController result = null;
     if (this.towerActor1 != null && !this.towerActor1.IsDead)
     {
         float distance2D = actor.GetDistance2D(this.towerActor1);
         if (distance2D <= findDist && distance2D < num)
         {
             num = distance2D;
             result = this.towerActor1;
         }
     }
     if (this.towerActor2 != null && !this.towerActor2.IsDead)
     {
         float distance2D = actor.GetDistance2D(this.towerActor2);
         if (distance2D <= findDist && distance2D < num)
         {
             num = distance2D;
             result = this.towerActor2;
         }
     }
     if (this.towerActor3 != null && !this.towerActor3.IsDead)
     {
         float distance2D = actor.GetDistance2D(this.towerActor3);
         if (distance2D <= findDist && distance2D < num)
         {
             result = this.towerActor3;
         }
     }
     return result;
 }
开发者ID:floatyears,项目名称:Decrypt,代码行数:36,代码来源:MemoryGearScene.cs

示例3: FindMinDistEnemy

 public static ActorController FindMinDistEnemy(ActorController actor, float findDist)
 {
     if (actor == null)
     {
         return null;
     }
     float num = 3.40282347E+38f;
     ActorController result = null;
     List<ActorController> actors = Globals.Instance.ActorMgr.Actors;
     for (int i = 0; i < actors.Count; i++)
     {
         ActorController actorController = actors[i];
         if (actorController && !actorController.IsDead && (!actorController.IsImmunity || actorController.ActorType != ActorController.EActorType.EMonster) && actor.IsHostileTo(actorController))
         {
             float num2 = actor.GetDistance2D(actorController);
             if (num2 <= findDist)
             {
                 if (actorController.ActorType == ActorController.EActorType.EPlayer)
                 {
                     num2 *= 1.5f;
                     if (num2 < 1.5f)
                     {
                         num2 = 1.5f;
                     }
                 }
                 if (num2 < num)
                 {
                     num = num2;
                     result = actorController;
                 }
             }
         }
     }
     return result;
 }
开发者ID:floatyears,项目名称:Decrypt,代码行数:35,代码来源:AIController.cs


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