Esempio n. 1
0
        static void Main(string[] args)
        {
            // Initialize Zara randomizer
            _random = new Random(DateTime.Now.Millisecond);
            ZaraEngine.Helpers.InitializeRandomizer((a, b) => (float)(a + ((b - a) * _random.NextDouble())));

            // Initialize our weather
            _weatherForTrepliev = new WeatherDescription();
            _weatherForTrepliev.SetTemperature(27f);
            _weatherForTrepliev.SetWindSpeed(0.1f);
            _weatherForTrepliev.SetRainIntensity(0.15f);

            _weatherForFreud = new WeatherDescription();
            _weatherForFreud.SetTemperature(57f);
            _weatherForFreud.SetWindSpeed(5.0f);
            _weatherForFreud.SetRainIntensity(0f);

            // Initialize our in-game time
            _dateTime  = DateTime.Now;
            _timeOfDay = TimesOfDay.Evening;

            // Initialize our persons. They will share the same game time and time of day
            Func <DateTime?>  gameTimeFunc  = () => _dateTime;
            Func <TimesOfDay> timeOfDayFunc = () => _timeOfDay;

            _person1 = InitialzeNewPerson("Trepliev", _weatherForTrepliev, gameTimeFunc, timeOfDayFunc);
            _person2 = InitialzeNewPerson("Freud", _weatherForFreud, gameTimeFunc, timeOfDayFunc);

            Console.WriteLine("Zara is running");

            // Start the "game loop"
            _loop = new System.Threading.Thread(LoopThread, 0);
            _loop.Start();
        }
Esempio n. 2
0
    public override void _Ready()
    {
        /* Zara Initialization code start =======>> */

        ZaraEngine.Helpers.InitializeRandomizer(_random.RandfRange);

        _dateTime  = DateTime.Now;
        _timeOfDay = TimesOfDay.Evening;
        _health    = new HealthController(this);
        _body      = new BodyStatusController(this);
        _weather   = new WeatherDescription();
        _player    = new PlayerStatus();
        _inventory = new InventoryController(this);

        _body.Initialize();
        _health.Initialize();

        /* <<======= Zara Initialization code end */

        #region Demo App Init

        // Defaults
        _weather.SetTemperature(21f);
        _weather.SetWindSpeed(10f);
        _weather.SetRainIntensity(0.12f);

        #endregion
    }
Esempio n. 3
0
        public override void OnStart()
        {
            /* Zara Initialization code start =======>> */

            // Initialize Zara randomizer
            _random = new Random(DateTime.Now.Millisecond);
            ZaraEngine.Helpers.InitializeRandomizer((a, b) => (float)(a + ((b - a) * _random.NextDouble())));

            _dateTime  = DateTime.Now;
            _timeOfDay = TimesOfDay.Evening;
            _health    = new HealthController(this);
            _body      = new BodyStatusController(this);
            _weather   = new WeatherDescription();
            _player    = new PlayerStatus();
            _inventory = new InventoryController(this);

            _body.Initialize();
            _health.Initialize();

            /* <<======= Zara Initialization code end */

            #region Demo App Init

            // Defaults
            _weather.SetTemperature(24f);
            _weather.SetWindSpeed(8f);
            _weather.SetRainIntensity(0.06f);

            #endregion
        }
Esempio n. 4
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            var weather = new WeatherDescription();

            weather.SetRainIntensity(0.08f);
            weather.SetWindSpeed(30f);
            weather.SetTemperature(25f);

            _worldTime = DateTime.Now;

            _person = new Person();
            _person.Initialize(weather, () => _worldTime, () => ZaraEngine.TimesOfDay.Evening); // will always be evening just to make things simplier here

            CreateDemoOutput();
        }
Esempio n. 5
0
    // Start is called before the first frame update
    void Start()
    {
        /* Zara Initialization code start =======>> */

        ZaraEngine.Helpers.InitializeRandomizer(UnityEngine.Random.Range);

        _dateTime  = DateTime.Now;
        _timeOfDay = TimesOfDay.Evening;
        _health    = new HealthController(this);
        _body      = new BodyStatusController(this);
        _weather   = new WeatherDescription();
        _player    = new PlayerStatus();
        _inventory = new InventoryController(this);

        _body.Initialize();
        _health.Initialize();

        /* <<======= Zara Initialization code end */

        #region Demo app init

        // Let's add some items to the inventory to play with in this demo

        var flaskWithWater = new ZaraEngine.Inventory.Flask();

        flaskWithWater.FillUp(WorldTime.Value);
        //flaskWithWater.Disinfect(WorldTime.Value);

        _jacket = new ZaraEngine.Inventory.WaterproofJacket();
        _pants  = new ZaraEngine.Inventory.WaterproofPants();
        _boots  = new ZaraEngine.Inventory.RubberBoots();
        _hat    = new ZaraEngine.Inventory.LeafHat();

        _inventory.AddItem(flaskWithWater);

        _inventory.AddItem(_jacket);
        _inventory.AddItem(_pants);
        _inventory.AddItem(_boots);
        _inventory.AddItem(_hat);

        var meat = new ZaraEngine.Inventory.Meat {
            Count = 1
        };

        // We just gathered two of spoiled Meat.
        meat.AddGatheringInfo(WorldTime.Value.AddHours(-5), 2);

        // We just gathered one item of fresh Meat. These will spoil in MinutesUntilSpoiled game minutes.
        meat.AddGatheringInfo(WorldTime.Value, 1);

        _inventory.AddItem(new ZaraEngine.Inventory.Cloth {
            Count = 20
        });
        _inventory.AddItem(meat);
        _inventory.AddItem(new ZaraEngine.Inventory.AntisepticSponge {
            Count = 5
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Bandage {
            Count = 5
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Acetaminophen {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Antibiotic {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Aspirin {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.EmptySyringe {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Loperamide {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Oseltamivir {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Sedative {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.AtropineSolution {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.EpinephrineSolution {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.AntiVenomSolution {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.DoripenemSolution {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.MorphineSolution {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.DisinfectingPellets {
            Count = 5
        });

        RefreshConsumablesUICombo();
        RefreshToolsUICombo();

        // Defaults
        _weather.SetTemperature(27f);
        _weather.SetWindSpeed(2f);
        _weather.SetRainIntensity(0f);

        #endregion
    }
Esempio n. 6
0
    // Start is called before the first frame update
    void Start()
    {
        /* Zara Initialization code start =======>> */

        ZaraEngine.Helpers.InitializeRandomizer((a, b) => UnityEngine.Random.Range(a, b));

        _dateTime  = DateTime.Now;
        _timeOfDay = TimesOfDay.Evening;
        _health    = new HealthController(this);
        _body      = new BodyStatusController(this);
        _weather   = new WeatherDescription();
        _player    = new PlayerStatus();
        _inventory = new InventoryController(this);

        ClothesGroups.Initialize(this);

        _body.Initialize();
        _health.Initialize();

        /* <<======= Zara Initialization code end */

        // Let's add some items to the inventory to play with in this demo

        var flaskWithWater = new ZaraEngine.Inventory.Flask();

        flaskWithWater.FillUp(WorldTime.Value);
        //flaskWithWater.Disinfect(WorldTime.Value);

        _jacket = new ZaraEngine.Inventory.WaterproofJacket();
        _pants  = new ZaraEngine.Inventory.WaterproofPants();
        _boots  = new ZaraEngine.Inventory.RubberBoots();
        _hat    = new ZaraEngine.Inventory.LeafHat();

        _inventory.AddItem(flaskWithWater);

        _inventory.AddItem(_jacket);
        _inventory.AddItem(_pants);
        _inventory.AddItem(_boots);
        _inventory.AddItem(_hat);

        _inventory.AddItem(new ZaraEngine.Inventory.Cloth {
            Count = 20
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Meat {
            Count = 3
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Bandage {
            Count = 5
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Acetaminophen {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Antibiotic {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Aspirin {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.EmptySyringe {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Loperamide {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Oseltamivir {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.Sedative {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.AtropineSolution {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.EpinephrineSolution {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.AntiVenomSolution {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.DoripenemSolution {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.MorphineSolution {
            Count = 10
        });
        _inventory.AddItem(new ZaraEngine.Inventory.DisinfectingPellets {
            Count = 5
        });

        RefreshConsumablesUICombo();
        RefreshToolsUICombo();

        // Defaults
        _weather.SetTemperature(27f);
        _weather.SetWindSpeed(0.1f);
        _weather.SetRainIntensity(0f);
    }
Esempio n. 7
0
    public void OnWindSpeedValueChanged(Slider e)
    {
        e.gameObject.transform.Find("Value").GetComponent <Text>().text = e.value.ToString("0.0");

        _weather.SetWindSpeed(e.value);
    }