コード例 #1
0
 public ActorNode(ISoaActor actor)
 {
     this.actor  = actor;
     neighbors   = new List <ActorNode>();
     actorPos_km = actor.getPositionInKilometers();
     totalNoise  = float.MaxValue;
     clique      = new List <ISoaActor>(0);
 }
コード例 #2
0
ファイル: PositionKM.cs プロジェクト: mhaque3/soa_unity
        public float distance(PositionKM other)
        {
            float dX = x - other.x;
            float dY = altitude - other.altitude;
            float dZ = z - other.z;

            return((float)Math.Sqrt(dX * dX + dY * dY + dZ * dZ));
        }
コード例 #3
0
 private void computeJammerNoise(ActorNode actor)
 {
     actor.totalNoise = 0;
     foreach (ISoaJammer jammerActor in world.getJammers())
     {
         PositionKM jammerPos_km         = jammerActor.getActor().getPositionInKilometers();
         float      jammerToActorDist_km = actor.actorPos_km.distance(jammerPos_km);
         float      effRangeSq           = jammerActor.getEffectiveRangeKm() * jammerActor.getEffectiveRangeKm();
         float      distSq = jammerToActorDist_km * jammerToActorDist_km;
         actor.totalNoise += effRangeSq / distSq;
     }
 }