예제 #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()));
    }
예제 #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()));
    }
예제 #3
0
    /// <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);
    }