Ejemplo n.º 1
0
    public IEnumerator DefaultMissingValuesPropertyOnUpdate()
    {
        // 1. Create component with non-default configs
        BasicMaterial basicMaterialComponent =
            TestHelpers.SharedComponentCreate <BasicMaterial, BasicMaterial.Model>(scene, CLASS_ID.BASIC_MATERIAL,
                                                                                   new BasicMaterial.Model
        {
            alphaTest = 1f
        });

        yield return(basicMaterialComponent.routine);

        // 2. Check configured values
        Assert.AreEqual(1f, basicMaterialComponent.GetModel().alphaTest);

        // 3. Update component with missing values

        scene.SharedComponentUpdate(basicMaterialComponent.id, JsonUtility.ToJson(new BasicMaterial.Model {
        }));

        yield return(basicMaterialComponent.routine);

        // 4. Check defaulted values
        Assert.AreEqual(0.5f, basicMaterialComponent.GetModel().alphaTest);
    }
Ejemplo n.º 2
0
    public IEnumerator ProcessCastShadowProperty_False()
    {
        BasicMaterial basicMaterialComponent = TestHelpers.CreateEntityWithBasicMaterial(scene, new BasicMaterial.Model
        {
            alphaTest   = 1f,
            castShadows = false
        }, out DecentralandEntity entity);

        yield return(basicMaterialComponent.routine);

        Assert.AreEqual(false, basicMaterialComponent.GetModel().castShadows);
        Assert.AreEqual(ShadowCastingMode.Off, entity.meshRootGameObject.GetComponent <MeshRenderer>().shadowCastingMode);
    }