コード例 #1
0
 public WithGarrisonPipsDecoration(Actor self, WithGarrisonPipsDecorationInfo info)
     : base(self, info)
 {
     garrisonable = self.Trait <Garrisonable>();
     pipCount     = info.PipCount > 0 ? info.PipCount : garrisonable.Info.MaxWeight;
     pips         = new Animation(self.World, info.Image);
 }
コード例 #2
0
 public UnloadGarrison(Actor self, Target destination, WDist unloadRange, bool unloadAll = true)
 {
     this.self        = self;
     garrison         = self.Trait <Garrisonable>();
     notifiers        = self.TraitsImplementing <INotifyUnload>().ToArray();
     this.unloadAll   = unloadAll;
     aircraft         = self.TraitOrDefault <Aircraft>();
     mobile           = self.TraitOrDefault <Mobile>();
     this.destination = destination;
     this.unloadRange = unloadRange;
 }
コード例 #3
0
        protected bool TryStartEnter(Actor self, Actor targetActor)
        {
            enterActor    = targetActor;
            enterGarrison = targetActor.TraitOrDefault <Garrisonable>();
            enterAircraft = targetActor.TraitOrDefault <Aircraft>();

            // Make sure we can still enter the transport
            // (but not before, because this may stop the actor in the middle of nowhere)
            if (enterGarrison == null || enterGarrison.IsTraitDisabled || enterGarrison.IsTraitPaused || !garrisoner.Reserve(self, enterGarrison))
            {
                Cancel(self, true);
                return(false);
            }

            if (enterAircraft != null && !enterAircraft.AtLandAltitude)
            {
                return(false);
            }

            return(true);
        }