SoftMaskForUGUI/Demo/SoftMask_Demo.cs

52 lines
1.0 KiB
C#
Raw Normal View History

2018-11-20 07:49:27 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Coffee.UIExtensions.Demos
{
public class SoftMask_Demo : MonoBehaviour
{
[SerializeField] RawImage softMaskBufferViewer;
[SerializeField] SoftMask softMask;
// Use this for initialization
void OnEnable()
{
softMaskBufferViewer.texture = softMask.softMaskBuffer;
}
// Update is called once per frame
void Update()
{
}
public void SetWorldSpase(bool flag)
{
2018-12-18 08:08:04 +08:00
if(flag)
{
GetComponent<Canvas> ().renderMode = RenderMode.ScreenSpaceCamera;
GetComponent<Canvas> ().renderMode = RenderMode.WorldSpace;
transform.rotation = Quaternion.Euler (new Vector3 (0, 6, 0));
}
}
public void SetScreenSpase (bool flag)
{
if (flag)
{
GetComponent<Canvas> ().renderMode = RenderMode.ScreenSpaceCamera;
}
}
public void SetOverlay (bool flag)
{
if (flag)
{
GetComponent<Canvas> ().renderMode = RenderMode.ScreenSpaceOverlay;
}
2018-11-20 07:49:27 +08:00
}
}
}