コード例 #1
0
ファイル: GameController.cs プロジェクト: vagrod/zara
    // 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
    }
コード例 #2
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);
    }