示例#1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        SwapMaterial swapMaterial = (SwapMaterial)target;

        if (GUILayout.Button("Swap for : " + swapMaterial.matSelected.ToString()))
        {
            swapMaterial.SetMatToMesh(swapMaterial.matList[(int)swapMaterial.matSelected]);
        }
    }
示例#2
0
    private void SetupPlatformEvents(int currentType)
    {
        switch (currentType)
        {
        case 0:
            RemoveAllListeners();
            if (hasSwapMaterial)
            {
                swapMaterial.meshSelected = SwapMaterial.meshToAffect.dissolve;
                swapMaterial.matSelected  = SwapMaterial.matToSwap.mat00;
                swapMaterial.SetMatToMesh(swapMaterial.matList[(int)swapMaterial.matSelected]);
                swapMaterial.meshSelected = SwapMaterial.meshToAffect.bottom;
                swapMaterial.matSelected  = SwapMaterial.matToSwap.mat03;
                swapMaterial.SetMatToMesh(swapMaterial.matList[(int)swapMaterial.matSelected]);
            }
            if (hasPSyst)
            {
                if (pSystems[0] != null)
                {
                    pSysRend          = pSystems[0].GetComponent <ParticleSystemRenderer>();
                    pSysRend.material = pSysNeutralMat;
                }
                if (pSystems[1] != null)
                {
                    pSysRend          = pSystems[1].GetComponent <ParticleSystemRenderer>();
                    pSysRend.material = pSysNeutralMat;
                }
            }
            // Set initial state of default platform to 'everything visible'
            if (undefinedStartVisible)
            {
                PermanentlyActivate();
            }
            else
            {
                PermanentlyDeactivate();
            }

            break;

        case 1:
            // Remove old listeners & add new listeners
            GameManager.instance.callSubstractiveStart.RemoveListener(SubstractiveActivate);
            GameManager.instance.callSubstractiveEnd.RemoveListener(SubstractiveDeactivate);
            GameManager.instance.callAdditiveStart.AddListener(AdditiveActivate);
            GameManager.instance.callAdditiveEnd.AddListener(AdditiveDeactivate);
            // Set platform materials
            if (hasSwapMaterial)
            {
                swapMaterial.meshSelected = SwapMaterial.meshToAffect.dissolve;
                swapMaterial.matSelected  = SwapMaterial.matToSwap.mat01;
                swapMaterial.SetMatToMesh(swapMaterial.matList[(int)swapMaterial.matSelected]);
                swapMaterial.meshSelected = SwapMaterial.meshToAffect.bottom;
                swapMaterial.matSelected  = SwapMaterial.matToSwap.mat04;
                swapMaterial.SetMatToMesh(swapMaterial.matList[(int)swapMaterial.matSelected]);
            }
            if (hasPSyst)
            {
                if (pSystems[0] != null)
                {
                    pSysRend          = pSystems[0].GetComponent <ParticleSystemRenderer>();
                    pSysRend.material = pSysAddMat;
                }

                if (pSystems[1] != null)
                {
                    pSysRend          = pSystems[1].GetComponent <ParticleSystemRenderer>();
                    pSysRend.material = pSysAddMat;
                }
            }
            AddDeactivate();
            break;

        case 2:
            // Remove old listeners & add new listeners
            GameManager.instance.callAdditiveStart.RemoveListener(AdditiveActivate);
            GameManager.instance.callAdditiveEnd.RemoveListener(AdditiveDeactivate);
            GameManager.instance.callSubstractiveStart.AddListener(SubstractiveActivate);
            GameManager.instance.callSubstractiveEnd.AddListener(SubstractiveDeactivate);
            // Set platform materials
            if (hasSwapMaterial)
            {
                swapMaterial.meshSelected = SwapMaterial.meshToAffect.dissolve;
                swapMaterial.matSelected  = SwapMaterial.matToSwap.mat02;
                swapMaterial.SetMatToMesh(swapMaterial.matList[(int)swapMaterial.matSelected]);
                swapMaterial.meshSelected = SwapMaterial.meshToAffect.bottom;
                swapMaterial.matSelected  = SwapMaterial.matToSwap.mat05;
                swapMaterial.SetMatToMesh(swapMaterial.matList[(int)swapMaterial.matSelected]);
            }
            if (hasPSyst)
            {
                if (pSystems[0] != null)
                {
                    pSysRend          = pSystems[0].GetComponent <ParticleSystemRenderer>();
                    pSysRend.material = pSysSubMat;
                }
                if (pSystems[1] != null)
                {
                    pSysRend          = pSystems[1].GetComponent <ParticleSystemRenderer>();
                    pSysRend.material = pSysSubMat;
                }
            }
            SubDeactivate();
            break;
        }
    }