Beispiel #1
0
 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;
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 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;
 }