예제 #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>();
 }