當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。