Exemplo n.º 1
0
        protected override void DoOnPossessionEstablished(IUnit unit, ICivilization newOwner)
        {
            foreach (var resource in unit.RequiredResources)
            {
                ResourceLockingCanon.LockCopyOfResourceForCiv(resource, newOwner);
            }

            CivSignals.CivGainedUnit.OnNext(new Tuple <ICivilization, IUnit>(newOwner, unit));
            UnitSignals.GainedNewOwner.OnNext(new Tuple <IUnit, ICivilization>(unit, newOwner));
        }
        protected override void DoOnPossessionEstablished(IBuilding building, ICity newOwner)
        {
            if (newOwner == null)
            {
                return;
            }

            var cityOwner = CityPossessionCanon.GetOwnerOfPossession(newOwner);

            foreach (var resource in building.Template.ResourcesConsumed)
            {
                ResourceLockingCanon.LockCopyOfResourceForCiv(resource, cityOwner);
            }

            if (building.Template.ProvidesFreeTech)
            {
                TechCanon.AddFreeTechToCiv(cityOwner);
            }

            CitySignals.GainedBuilding.OnNext(new Tuple <ICity, IBuilding>(newOwner, building));
        }