Пример #1
0
 void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
 {
     if (info.UseFuelReserve)
     {
         fueltank = newOwner.PlayerActor.Trait <Fueltank>();
     }
 }
Пример #2
0
        public NeedsFuel(Actor self, NeedsFuelInfo info)
        {
            this.self = self;
            Info      = info;
            Fueltank  = self.Trait <Fueltank>();

            wasEmpty = Fueltank.IsEmpty;
        }
Пример #3
0
        public RefuelsUnits(Actor self, RefuelsUnitsInfo info)
        {
            Info = info;

            var source = info.UseFuelReserve ? self.Owner.PlayerActor : self;

            Fueltank = source.Trait <Fueltank>();
        }
Пример #4
0
 public RefuelsUnitsNear(Actor self, RefuelsUnitsNearInfo info)
 {
     Info      = info;
     this.self = self;
     fueltank  = self.Trait <Fueltank>();
     move      = self.TraitOrDefault <IMove>();
     ticks     = info.TransferInterval;
 }
Пример #5
0
        public Refuelable(Actor self, RefuelableInfo info)
        {
            this.self   = self;
            Info        = info;
            excludeSelf = new[] { self };

            Fueltank = self.Trait <Fueltank>();
            Move     = self.Trait <IMove>();
        }
Пример #6
0
        void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
        {
            if (Info.UseFuelReserve)
            {
                fueltank = newOwner.PlayerActor.Trait <Fueltank>();
            }

            resources = newOwner.PlayerActor.TraitOrDefault <PlayerResources>();
        }
Пример #7
0
        public FuelGenerator(Actor self, FuelGeneratorInfo info)
        {
            Info = info;

            var source = info.UseFuelReserve ? self.Owner.PlayerActor : self;

            fueltank  = source.Trait <Fueltank>();
            resources = self.Owner.PlayerActor.TraitOrDefault <PlayerResources>();
            ticks     = info.Interval;
        }
Пример #8
0
        public void RefuelUnit(Actor self, Actor unit)
        {
            if (CurrentUnit != null)
            {
                return;
            }

            var refuelable = unit.TraitOrDefault <Refuelable>();

            if (refuelable == null || !refuelable.CanRefuelAt(self, this))
            {
                return;
            }

            otherFueltank = refuelable.Fueltank;

            CurrentUnit    = unit;
            cachedPosition = CurrentUnit.CenterPosition;
            ticks          = Info.TransferInterval;
        }
Пример #9
0
        void INotifyCreated.Created(Actor self)
        {
            var source = info.UseFuelReserve ? self.Owner.PlayerActor : self;

            fueltank = source.Trait <Fueltank>();
        }
Пример #10
0
 void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
 {
     fuelReserve.RemoveCapacity(info.Capacity);
     fuelReserve = newOwner.PlayerActor.Trait <Fueltank>();
     fuelReserve.AddCapacity(info.Capacity);
 }
Пример #11
0
 public FuelStorage(Actor self, FuelStorageInfo info)
 {
     this.info   = info;
     fuelReserve = self.Owner.PlayerActor.Trait <Fueltank>();
 }