public void ClearRuntime()
 {
     foreach (var encampment in EncampmentFactory.AllEncampments.ToArray())
     {
         EncampmentFactory.DestroyEncampment(encampment);
     }
 }
Exemple #2
0
        protected override void EditCell(IHexCell cell)
        {
            if (AddingOrRemoving)
            {
                if (EncampmentFactory.CanCreateEncampment(cell))
                {
                    EncampmentFactory.CreateEncampment(cell);
                }
            }
            else
            {
                var encampmentOn = EncampmentLocationCanon.GetPossessionsOfOwner(cell).FirstOrDefault();

                if (encampmentOn != null)
                {
                    EncampmentFactory.DestroyEncampment(encampmentOn);
                }
            }
        }
        private void OnUnitEnteredLocation(Tuple <IUnit, IHexCell> data)
        {
            var unit        = data.Item1;
            var newLocation = data.Item2;

            var encampmentAtLocation = EncampmentLocationCanon.GetPossessionsOfOwner(newLocation).FirstOrDefault();

            if (encampmentAtLocation != null)
            {
                var unitOwner = UnitPossessionCanon.GetOwnerOfPossession(unit);

                if (!unitOwner.Template.IsBarbaric)
                {
                    float modifier = CivModifiers.GoldBountyFromEncampments.GetValueForCiv(unitOwner);

                    unitOwner.GoldStockpile += Mathf.RoundToInt(BarbarianConfig.EncampmentBounty * modifier);

                    EncampmentFactory.DestroyEncampment(encampmentAtLocation);
                }
            }
        }