Exemple #1
0
    public float GetIndustryNeededToSpawn()
    {
        object[]           rpn = Interpreter.InfixTransform(Amplitude.Unity.Runtime.Runtime.Registry.GetValue <string>(this.KaijuEmpire.SpawnFormulaPath));
        InterpreterContext interpreterContext = new InterpreterContext(null);

        interpreterContext.SimulationObject = base.Empire.SimulationObject;
        interpreterContext.Register("NumberOfPlayers", KaijuCouncil.majorEmpires.Length);
        float num = (float)Interpreter.Execute(rpn, interpreterContext);

        if (Amplitude.Unity.Framework.Application.Preferences.EnableModdingTools)
        {
            Diagnostics.Log("[Kaiju] Kaiju Empire [{0}] formula = n * (NumberOfPlayers = {1}) * (GameSpeedMultiplier = {2}) * (GameDifficultyKaijuSpawnMultiplier = {3})", new object[]
            {
                this.KaijuEmpire.KaijuFaction.LocalizedName,
                KaijuCouncil.majorEmpires.Length,
                this.KaijuEmpire.GetPropertyValue(SimulationProperties.GameSpeedMultiplier),
                this.KaijuEmpire.GetPropertyValue("GameDifficultyKaijuSpawnMultiplier")
            });
            Diagnostics.Log("[Kaiju] Kaiju Empire [{0}] Industry needed to Spawn: [{1}]", new object[]
            {
                this.KaijuEmpire.KaijuFaction.LocalizedName,
                num
            });
        }
        return(num);
    }
 bool IWorldEntityMappingOverride.TryResolve(out InterpreterContext context)
 {
     context = new InterpreterContext(base.SimulationObject);
     if (!StaticString.IsNullOrEmpty(this.AffinityMapping))
     {
         context.Register("AffinityMapping", this.AffinityMapping);
     }
     foreach (KeyValuePair <StaticString, string> keyValuePair in this.PointOfInterestDefinition.GetPropertiesAsEnumerator())
     {
         context.Register(keyValuePair.Key, keyValuePair.Value);
     }
     if (this.PointOfInterestImprovement != null && this.PointOfInterestImprovement.XmlMappingProperties != null)
     {
         for (int i = 0; i < this.PointOfInterestImprovement.XmlMappingProperties.Length; i++)
         {
             context.Register(this.PointOfInterestImprovement.XmlMappingProperties[i].Key, this.PointOfInterestImprovement.XmlMappingProperties[i].Value);
         }
     }
     return(true);
 }
Exemple #3
0
    bool IWorldEntityMappingOverride.TryResolve(out InterpreterContext context)
    {
        SimulationObject simulationObject = null;
        IGameService     service          = Services.GetService <IGameService>();

        if (service != null)
        {
            IGameEntityRepositoryService service2 = service.Game.Services.GetService <IGameEntityRepositoryService>();
            IGameEntity gameEntity;
            if (service2 != null && service2.TryGetValue(this.BoundTargetGUID, out gameEntity))
            {
                SimulationObjectWrapper simulationObjectWrapper = gameEntity as SimulationObjectWrapper;
                if (simulationObjectWrapper != null)
                {
                    simulationObject = simulationObjectWrapper.SimulationObject;
                }
            }
        }
        context = new InterpreterContext(simulationObject);
        context.Register("WorldMarkerType", this.MarkerTypeName);
        return(true);
    }