WeatherControl.cpp
上传用户:henghua
上传日期:2007-11-14
资源大小:7655k
文件大小:2k
- #include "WeatherControl.h"
- CWeatherControl::CWeatherControl(LPDIRECT3DDEVICE9 device, CConfiguration *config)
- {
- this->device = device;
- this->process = 0;
- this->status = FINE;
- this->config = config;
- this->level = BASE_STRENGTH;
- this->currentlevel = BASE_STRENGTH;
- }
- bool CWeatherControl::Init()
- {
- return true;
- }
- bool CWeatherControl::Update()
- {
- if(status == CLOUDY)
- {
- if(! config->get_bool(p_bisCloudy) )
- config->set_bool(p_bisCloudy, true);
- }
- else if(status == FINE)
- {
- if(config->get_bool(p_bisSnowing))
- {
- config->set_bool(p_bisSnowing, false);
- if(config->get_bool(p_bisCloudy))
- config->set_bool(p_bisCloudy, false);
- }
- else if( config->get_bool(p_bisCloudy))
- {
- config->set_bool(p_bisCloudy, false);
- }
- }
- else if(status == SNOWING)
- {
- if(!config->get_bool(p_bisSnowing))
- {
- if(config->get_bool(p_bisCloudy))
- {
- if(config->get_float(p_bCloudiness) > 0.99)
- {
- config->set_bool(p_bisSnowing, true);
- }
- }
- else
- {
- config->set_bool(p_bisCloudy, true);
- }
- }
- }
- else if(status == DAY)
- {
- if(config->get_bool(p_bisNight))
- {
- if(config->get_float(p_bNight_Day) > 0.99)
- config->set_bool(p_bisNight, false);
- else
- config->set_float(p_bNight_Day, config->get_float(p_bNight_Day) + 0.003);
- }
- }
- else if(status == NIGHT)
- {
- if(!config->get_bool(p_bisNight))
- {
- if(config->get_float(p_bNight_Day) < 0.01)
- config->set_bool(p_bisNight, true);
- else
- config->set_float(p_bNight_Day, config->get_float(p_bNight_Day) - 0.003);
- }
- }
- return true;
- }
- void CWeatherControl::set(int i)
- {
- this->status = i;
- }