/// <summary> /// Fires the <i>ImprovementBuilt</i> event. /// </summary> /// <param name="e"></param> protected override void OnImprovementBuilt(ImprovementBuiltEventArgs e) { base.OnImprovementBuilt(e); }
/// <summary> /// Event handler for the <i>ImprovementBuilt</i> event of a city using this strategy. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void OnImprovementBuilt(object sender, ImprovementBuiltEventArgs e) { AICity city = e.City as AICity; BuildableItem nextImprovement = null; GameRoot root = GameRoot.Instance; //what to do with what we just built? if (e.Improvement.GetType() == typeof(AIUnit)) { AIUnit unit = e.Improvement as AIUnit; switch (city.PrimaryNeed) { case AICityNeed.Commerce: break; case AICityNeed.Culture: break; case AICityNeed.Food: break; case AICityNeed.UnitDefense: unit.Fortified = true; break; } } else if (e.Improvement.GetType() == typeof(AISettler)) { } else if (e.Improvement.GetType() == typeof(AIWorker)) { AIWorker worker = e.Improvement as AIWorker; worker.ParentCity = e.City; worker.Automated = true; } //next item to build switch (city.PrimaryNeed) { case AICityNeed.Commerce: if (!city.HasWorkerInFields()) { nextImprovement = UnitFactory.CreateWorker(city); } else { nextImprovement = city.GetBuildableItemForNeed(city.PrimaryNeed, typeof(Improvement)); } break; case AICityNeed.Culture: nextImprovement = city.GetBuildableItemForNeed(city.PrimaryNeed, typeof(Improvement)); break; case AICityNeed.Food: if (!city.HasWorkerInFields()) { nextImprovement = UnitFactory.CreateWorker(city); } else { nextImprovement = city.GetBuildableItemForNeed(city.PrimaryNeed, typeof(Improvement)); } break; case AICityNeed.UnitDefense: nextImprovement = city.GetBuildableItemForNeed(city.PrimaryNeed, typeof(Unit)); break; } city.NextImprovement = nextImprovement; }
/// <summary> /// Event handler for the <c>ImprovementBuilt</c> event of the city belonging /// to the foreign colony using the strategy. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void OnImprovementBuilt(object sender, ImprovementBuiltEventArgs e) { }