Exemplo n.º 1
0
        public cTile(Vector2i position, cTileProperties tileProperties, cWorld world)
        {
            _positionInTiles = position;
            _tileProperties  = tileProperties;
            _world           = world;

            _localTime = 0.0f;

            _refreshTimerMax     = (float)RandomGenerator.GetRandomDouble(0.5, 1.5);
            _refreshTimer        = _refreshTimerMax;
            _tileShape           = new RectangleShape(new Vector2f(TileSizeInPixels, TileSizeInPixels));
            _tileShape.FillColor = cTileSetter.GetColorFromTileProperties(_tileProperties);

            _dayNightShape           = new RectangleShape(new Vector2f(TileSizeInPixels, TileSizeInPixels));
            _dayNightShape.FillColor = new Color(0, 0, 0, 255);

            _heightShape           = new RectangleShape(new Vector2f(TileSizeInPixels, TileSizeInPixels));
            _heightShape.FillColor = new Color(0, 0, 0, 255);

            float centerY     = (float)world.GetWorldProperties().WorldSizeInTiles.Y / 2.0f;
            float yCoordinate = (float)position.Y;
            //float yFactor = (yCoordinate <= centerY) ? 0.9f + 0.2f/centerY * yCoordinate : 1.3f - 0.2f / centerY * yCoordinate;
            float yFactor = 0.85f + (float)(0.3 * Math.Sin((float)position.Y / (float)world.GetWorldProperties().WorldSizeInTiles.Y *Math.PI));

            //float yFactor = 1.0f;


            _tileProperties.DayNightCyclePhase = (float)(position.X) / (float)(_world.GetWorldProperties().WorldSizeInTiles.X) * (float)(2.0 * Math.PI) * yFactor;

            _temperatureControlList = new List <TemperatureControlStrategies.cAbstractTemperatureControlStragegy>();
            _temperatureControlList.Add(new TemperatureControlStrategies.cBasicDayNightCycleStrategy(this));
            //_temperatureControlList.Add(new TemperatureControlStrategies.cTemperatureExchangeStrategy(this));

            NeighbourTiles = new List <ITile>();

            _lastTemperaturesList = new Queue <float>(100);
            for (int i = 0; i != 100; i++)
            {
                _lastTemperaturesList.Enqueue(_world.GetWorldProperties().DesiredTemperature);
            }
            _temperatureIntegrationTimerMax = _world.GetWorldProperties().TileTemperatureIntegrationTimer;
            _temperatureIntegrationTimer    = _temperatureIntegrationTimerMax;
        }
Exemplo n.º 2
0
        public cCloud(cWorld world, Vector2i position)
        {
            _world            = world;
            _absolutePosition = new Vector2f(position.X * cTile.GetTileSizeInPixelStatic(), position.Y * cTile.GetTileSizeInPixelStatic());

            _totalTime = 0.0f;

            _rainFrequency = (float)RandomGenerator.GetRandomDouble(0.5, 1.50);
            _rainOffset    = (float)RandomGenerator.GetRandomDouble(0.0, 2.0 * Math.PI);;

            _cloudSize = 4;

            _shape        = new CircleShape(cTile.TileSizeInPixels * _cloudSize);
            _shape.Origin = new Vector2f(cTile.TileSizeInPixels * _cloudSize, cTile.TileSizeInPixels * _cloudSize);

            WaterAmount    = _world.GetWorldProperties().RainWaterAmount * 800;
            WaterAmountMax = WaterAmount;
            ReduceWaterAmount(0.0f);

            _moveTimerMax = 2.0f;
            _moveTimer    = _moveTimerMax;
            _moveVector   = RandomGenerator.GetRandomVector2fOnCircle(1.0f);
            _moveSpeed    = 1.0f;
        }