public void ReleaseGameEngine(DateTime gameDate, GameEngine gameEngine, Database.Database.DatabaseCollection <EngineFeature> engineFeatures) { float score = 0f; if (gameEngine.SupportedFeaturesIDs.Count == 0) { Debug.LogError($"Market.ReleaseGameEngine({gameEngine.Name}) : no features."); return; } foreach (string featureId in gameEngine.SupportedFeaturesIDs) { EngineFeature feature = engineFeatures.FindById(featureId); if (feature == null) { Debug.LogError($"Market.ReleaseGameEngine({gameEngine.Name}) : " + $"unknown feature \"{featureId}\""); return; } int deltaYears = feature.ExpectedYear - gameDate.Year; score += deltaYears + 1f; } score /= gameEngine.SupportedFeaturesIDs.Count; //Debug.LogWarning($"Market.ReleaseGameEngine({gameEngine.Name}) : score = {score}"); Product product = new Product(ProductType.GameEngine, gameEngine.Name, score); activeProducts.Add(product); }
public WorldEngineFeature(EngineFeature info, TypedExecutable <bool> requirement, Executable effect) { this.info = info; this.requirement = requirement; this.effect = effect; }
public void RemoveFeature(EngineFeature feature) { if (!feature.IsAttached || !_features.Contains(feature)) { throw new InvalidOperationException("Cannot detach feature that is not attached to this engine."); } feature.Detach(this); _features.Remove(feature); }
public void AddFeature(EngineFeature feature) { if (feature.IsAttached) { throw new InvalidOperationException("Cannot add an already attached feature."); } feature.Attach(this); _features.Add(feature); }