Exemple #1
0
        public SimulationController()
        {
            model.PlanetCondition.PlanetConditionState state = new model.PlanetCondition.PlanetConditionState
            {
                freeWater = 0,
                organic   = 0,
                co        = 23830000000000000,
                n         = 675000000000000,
                oxigen    = 32500000000000,
                //TODO temperature
                temperature = -40
            };

            model.ColonyStats stats = new model.ColonyStats
            {
                num  = 10,
                mass = 10
            };

            model.ColonyParams par = ParamsController.colonyParams;

            model.PlanetCondition contitions = new model.PlanetCondition(state, ParamsController.growthSpeed);
            model.Colony          colony     = new model.Colony(stats, par);

            _currentColony = colony;
            _conditions    = contitions;
            defaultTemp    = _conditions.getTemperature();
        }
Exemple #2
0
        public override float getTemperatureDeathRate(PlanetCondition conditions, Colony colony)
        {
            double a = 0.999;
            double b = timeTick(conditions.getTime());

            if (colony.getOptimalTemperature() > conditions.getTemperature())
            {
                int delta = colony.getOptimalTemperature() - conditions.getTemperature();
                a = Math.Max(1 - delta * 0.1f / 100f, 0);
            }
            float res = (float)Math.Pow(a, b);

            if (res < 0.001)
            {
                float res2 = (float)Math.Pow(a, b);
                res = res2;
            }
            return(res);
        }