Esempio n. 1
0
    public void ParseJsonCorrectly()
    {
        KernelConfigModel model = new KernelConfigModel();
        string            json  = JsonUtility.ToJson(model);

        KernelConfig.i.Set(json);

        Assert.IsTrue(model.Equals(KernelConfig.i.Get()));
    }
Esempio n. 2
0
    public void ParseJsonCorrectly()
    {
        KernelConfigModel model = new KernelConfigModel();

        var worldRange = new WorldRange(-150, -150, 150, 150);

        model.validWorldRanges.Add(worldRange);

        string json = JsonUtility.ToJson(model);

        KernelConfig.i.Set(json);

        Assert.IsTrue(model.Equals(KernelConfig.i.Get()));
    }
    /// <summary>
    /// Set a new Kernel Configuration
    /// </summary>
    /// <param name="newValue">New Configuration</param>
    public void Set(KernelConfigModel newValue)
    {
        if (newValue == null)
        {
            return;
        }

        if (!initialized)
        {
            Initialize(newValue);
        }

        if (newValue.Equals(value))
        {
            return;
        }

        var previous = value;

        value = newValue;
        OnChange?.Invoke(value, previous);
    }