Guest User

Untitled

a guest
Sep 3rd, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using OpenRA.Traits;
  3.  
  4. namespace OpenRA.Mods.Common.Traits
  5. {
  6.     class GivesBloodBountyInfo : ITraitInfo
  7.     {
  8.         public object Create(ActorInitializer init) { return new GivesBloodBounty(init.Self, this); }
  9.     }
  10.  
  11.     class GivesBloodBounty : INotifyKilled
  12.     {
  13.         // readonly GivesBloodBountyInfo info;
  14.  
  15.         public GivesBloodBounty(Actor self, GivesBloodBountyInfo info)
  16.         {
  17.             // this.info = info;
  18.         }
  19.  
  20.         void INotifyKilled.Killed(Actor self, AttackInfo e)
  21.         {
  22.             Log.Write("debug", "GivesBloodBounty: I was killed");
  23.        
  24.             var map = self.World.Map;
  25.             var targetCells = map.FindTilesInCircle(self.Location, 7);
  26.             foreach (var cell in targetCells)
  27.             {
  28.                 foreach (var otherActor in self.World.ActorMap.GetActorsAt(cell))
  29.                 {
  30.                     var bloodDrinker = otherActor.TraitOrDefault<BloodCashTrickler>();
  31.                     if (bloodDrinker != null)
  32.                     {
  33.                         bloodDrinker.GiveBloodCash(self.GetSellValue());
  34.                         return;
  35.                     }
  36.                        
  37.                 }
  38.             }
  39.              
  40.         }
  41.     }
  42. }
Add Comment
Please, Sign In to add comment