Example #1
0
 public void ReciveBeaconPacket(BeaconPacket beaconPacket)
 {
     if (IsDead)
     {
         return;
     }
     consumeEnergy(EnergyConsumtionType.Reception);
     RecivedBeaconPackets.Add(beaconPacket);
     Simulation.RecivedBeaconsCount++;
 }
Example #2
0
        public void BroadcastLocation()
        {
            BeaconPacket beaconPacket = new BeaconPacket()
            {
                Sender = this, SentTime = Simulation.SimulationTime
            };

            Simulation.BeaconPackets.Add(beaconPacket);
            consumeEnergy(EnergyConsumtionType.Transmision);
            foreach (Node n in Simulation.Nodes)
            {
                if (Distance(this, n) < Range && n.Id != this.Id)
                {
                    n.ReciveBeaconPacket(beaconPacket);
                }
            }
        }