示例#1
0
    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);
    }
示例#2
0
 public WorldEngineFeature(EngineFeature info,
                           TypedExecutable <bool> requirement, Executable effect)
 {
     this.info        = info;
     this.requirement = requirement;
     this.effect      = effect;
 }
示例#3
0
        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);
        }
示例#4
0
        public void AddFeature(EngineFeature feature)
        {
            if (feature.IsAttached)
            {
                throw new InvalidOperationException("Cannot add an already attached feature.");
            }

            feature.Attach(this);
            _features.Add(feature);
        }