[Assets] UI 애셋 및 TextMesh Pro 임포트
- Fantasy Warrior HUD 애셋 (Synty Studios) - Interface Core 라이브러리 - TextMesh Pro 패키지 - UI_HealthBar 프리팹
This commit is contained in:
8
Assets/External/InterfaceCore/Scripts/UnityUIExtensions.meta
vendored
Normal file
8
Assets/External/InterfaceCore/Scripts/UnityUIExtensions.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 21043433c5c182445a3c9595e4d24e9f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/LICENSE.md
vendored
Normal file
22
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/LICENSE.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# Unity UI Extensions License (BSD3)
|
||||
|
||||
Copyright (c) 2019
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
7
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/LICENSE.md.meta
vendored
Normal file
7
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/LICENSE.md.meta
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b2b4fb1292336b459e697eb0bd419c2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
28
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/ShaderLibrary.cs
vendored
Normal file
28
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/ShaderLibrary.cs
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/// Credit SimonDarksideJ
|
||||
/// Updated by Synty: Renamed Unity.UI.Extensions to Synty.Interface.Extensions to avoid conflicts with Unity Ui Extensions and to pass Unity asset store submission.
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Synty.Interface.Extensions
|
||||
{
|
||||
public static class ShaderLibrary
|
||||
{
|
||||
public static Dictionary<string, Shader> shaderInstances = new Dictionary<string, Shader>();
|
||||
public static Shader[] preLoadedShaders;
|
||||
|
||||
public static Shader GetShaderInstance(string shaderName)
|
||||
{
|
||||
if (shaderInstances.ContainsKey(shaderName))
|
||||
{
|
||||
return shaderInstances[shaderName];
|
||||
}
|
||||
|
||||
var newInstance = Shader.Find(shaderName);
|
||||
if (newInstance != null)
|
||||
{
|
||||
shaderInstances.Add(shaderName, newInstance);
|
||||
}
|
||||
return newInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/ShaderLibrary.cs.meta
vendored
Normal file
11
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/ShaderLibrary.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fbe5c1147facd6408e1daa964acc061
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
120
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/SoftMaskScript.cs
vendored
Normal file
120
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/SoftMaskScript.cs
vendored
Normal file
@@ -0,0 +1,120 @@
|
||||
/// Credit NemoKrad (aka Charles Humphrey) / valtain
|
||||
/// Sourced from - http://www.randomchaos.co.uk/SoftAlphaUIMask.aspx
|
||||
/// Updated by valtain - https://bitbucket.org/SimonDarksideJ/unity-ui-extensions/pull-requests/33
|
||||
/// Updated by Synty: Renamed Unity.UI.Extensions to Synty.Interface.Extensions to avoid conflicts with Unity Ui Extensions and to pass Unity asset store submission.
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Synty.Interface.Extensions
|
||||
{
|
||||
[ExecuteInEditMode]
|
||||
[AddComponentMenu("UI/Effects/Extensions/SoftMaskScript")]
|
||||
public class SoftMaskScript : MonoBehaviour
|
||||
{
|
||||
Material mat;
|
||||
|
||||
Canvas cachedCanvas = null;
|
||||
Transform cachedCanvasTransform = null;
|
||||
readonly Vector3[] m_WorldCorners = new Vector3[4];
|
||||
readonly Vector3[] m_CanvasCorners = new Vector3[4];
|
||||
|
||||
[Tooltip("The area that is to be used as the container.")]
|
||||
public RectTransform MaskArea;
|
||||
|
||||
[Tooltip("Texture to be used to do the soft alpha")]
|
||||
public Texture AlphaMask;
|
||||
|
||||
[Tooltip("At what point to apply the alpha min range 0-1")]
|
||||
[Range(0, 1)]
|
||||
public float CutOff = 0;
|
||||
|
||||
[Tooltip("Implement a hard blend based on the Cutoff")]
|
||||
public bool HardBlend = false;
|
||||
|
||||
[Tooltip("Flip the masks alpha value")]
|
||||
public bool FlipAlphaMask = false;
|
||||
|
||||
[Tooltip("If a different Mask Scaling Rect is given, and this value is true, the area around the mask will not be clipped")]
|
||||
public bool DontClipMaskScalingRect = false;
|
||||
|
||||
Vector2 maskOffset = Vector2.zero;
|
||||
Vector2 maskScale = Vector2.one;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
if (MaskArea == null)
|
||||
{
|
||||
MaskArea = GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
var text = GetComponent<TMPro.TMP_Text>();
|
||||
#else
|
||||
var text = GetComponent<Text>();
|
||||
#endif
|
||||
if (text != null)
|
||||
{
|
||||
mat = new Material(ShaderLibrary.GetShaderInstance("UI Extensions/SoftMaskShader"));
|
||||
text.material = mat;
|
||||
cachedCanvas = text.canvas;
|
||||
cachedCanvasTransform = cachedCanvas.transform;
|
||||
// For some reason, having the mask control on the parent and disabled stops the mouse interacting
|
||||
// with the texture layer that is not visible.. Not needed for the Image.
|
||||
if (transform.parent.GetComponent<Mask>() == null)
|
||||
transform.parent.gameObject.AddComponent<Mask>();
|
||||
|
||||
transform.parent.GetComponent<Mask>().enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var graphic = GetComponent<Graphic>();
|
||||
if (graphic != null)
|
||||
{
|
||||
mat = new Material(ShaderLibrary.GetShaderInstance("UI Extensions/SoftMaskShader"));
|
||||
graphic.material = mat;
|
||||
cachedCanvas = graphic.canvas;
|
||||
cachedCanvasTransform = cachedCanvas.transform;
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (cachedCanvas != null)
|
||||
{
|
||||
SetMask();
|
||||
}
|
||||
}
|
||||
|
||||
void SetMask()
|
||||
{
|
||||
var worldRect = GetCanvasRect();
|
||||
var size = worldRect.size;
|
||||
maskScale.Set(1.0f / size.x, 1.0f / size.y);
|
||||
maskOffset = -worldRect.min;
|
||||
maskOffset.Scale(maskScale);
|
||||
|
||||
mat.SetTextureOffset("_AlphaMask", maskOffset);
|
||||
mat.SetTextureScale("_AlphaMask", maskScale);
|
||||
mat.SetTexture("_AlphaMask", AlphaMask);
|
||||
|
||||
mat.SetFloat("_HardBlend", HardBlend ? 1 : 0);
|
||||
mat.SetInt("_FlipAlphaMask", FlipAlphaMask ? 1 : 0);
|
||||
mat.SetInt("_NoOuterClip", DontClipMaskScalingRect ? 1 : 0);
|
||||
mat.SetFloat("_CutOff", CutOff);
|
||||
}
|
||||
|
||||
public Rect GetCanvasRect()
|
||||
{
|
||||
if (cachedCanvas == null)
|
||||
return new Rect();
|
||||
|
||||
MaskArea.GetWorldCorners(m_WorldCorners);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
m_CanvasCorners[i] = cachedCanvasTransform.InverseTransformPoint(m_WorldCorners[i]);
|
||||
|
||||
return new Rect(m_CanvasCorners[0].x, m_CanvasCorners[0].y, m_CanvasCorners[2].x - m_CanvasCorners[0].x, m_CanvasCorners[2].y - m_CanvasCorners[0].y);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/SoftMaskScript.cs.meta
vendored
Normal file
12
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/SoftMaskScript.cs.meta
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ccd4529d43c341443b320b0eea171992
|
||||
timeCreated: 1448034177
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
425
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/UIParticleSystem.cs
vendored
Normal file
425
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/UIParticleSystem.cs
vendored
Normal file
@@ -0,0 +1,425 @@
|
||||
/// Credit glennpow, Zarlang
|
||||
/// Sourced from - http://forum.unity3d.com/threads/free-script-particle-systems-in-ui-screen-space-overlay.406862/
|
||||
/// Updated by Zarlang with a more robust implementation, including TextureSheet animation support
|
||||
/// Updated by Synty: Renamed Unity.UI.Extensions to Synty.Interface.Extensions to avoid conflicts with Unity Ui Extensions and to pass Unity asset store submission.
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Synty.Interface.Extensions
|
||||
{
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(CanvasRenderer), typeof(ParticleSystem))]
|
||||
[AddComponentMenu("UI/Effects/Extensions/UIParticleSystem")]
|
||||
public class UIParticleSystem : MaskableGraphic
|
||||
{
|
||||
[Tooltip("Having this enabled run the system in LateUpdate rather than in Update making it faster but less precise (more clunky)")]
|
||||
public bool fixedTime = true;
|
||||
|
||||
[Tooltip("Enables 3d rotation for the particles")]
|
||||
public bool use3dRotation = false;
|
||||
|
||||
private Transform _transform;
|
||||
private ParticleSystem pSystem;
|
||||
private ParticleSystem.Particle[] particles;
|
||||
private UIVertex[] _quad = new UIVertex[4];
|
||||
private Vector4 imageUV = Vector4.zero;
|
||||
private ParticleSystem.TextureSheetAnimationModule textureSheetAnimation;
|
||||
private int textureSheetAnimationFrames;
|
||||
private Vector2 textureSheetAnimationFrameSize;
|
||||
private ParticleSystemRenderer pRenderer;
|
||||
private bool isInitialised = false;
|
||||
|
||||
private Material currentMaterial;
|
||||
|
||||
private Texture currentTexture;
|
||||
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
private ParticleSystem.MainModule mainModule;
|
||||
#endif
|
||||
|
||||
public override Texture mainTexture
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentTexture;
|
||||
}
|
||||
}
|
||||
|
||||
public ParticleSystem.Particle[] Particles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (particles == null)
|
||||
{
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
particles = new ParticleSystem.Particle[pSystem.main.maxParticles];
|
||||
#else
|
||||
particles = new ParticleSystem.Particle[pSystem.maxParticles];
|
||||
#endif
|
||||
}
|
||||
return particles;
|
||||
}
|
||||
}
|
||||
|
||||
protected bool Initialize()
|
||||
{
|
||||
// initialize members
|
||||
if (_transform == null)
|
||||
{
|
||||
_transform = transform;
|
||||
}
|
||||
if (pSystem == null)
|
||||
{
|
||||
pSystem = GetComponent<ParticleSystem>();
|
||||
|
||||
if (pSystem == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
mainModule = pSystem.main;
|
||||
if (pSystem.main.maxParticles > 14000)
|
||||
{
|
||||
mainModule.maxParticles = 14000;
|
||||
}
|
||||
#else
|
||||
if (pSystem.maxParticles > 14000)
|
||||
{
|
||||
pSystem.maxParticles = 14000;
|
||||
}
|
||||
#endif
|
||||
|
||||
pRenderer = pSystem.GetComponent<ParticleSystemRenderer>();
|
||||
if (pRenderer != null)
|
||||
pRenderer.enabled = false;
|
||||
|
||||
if (material == null)
|
||||
{
|
||||
var foundShader = ShaderLibrary.GetShaderInstance("UI Extensions/Particles/Additive");
|
||||
if (foundShader)
|
||||
{
|
||||
material = new Material(foundShader);
|
||||
}
|
||||
}
|
||||
|
||||
currentMaterial = material;
|
||||
if (currentMaterial && currentMaterial.HasProperty("_MainTex"))
|
||||
{
|
||||
currentTexture = currentMaterial.mainTexture;
|
||||
if (currentTexture == null)
|
||||
currentTexture = Texture2D.whiteTexture;
|
||||
}
|
||||
material = currentMaterial;
|
||||
// automatically set scaling
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
mainModule.scalingMode = ParticleSystemScalingMode.Hierarchy;
|
||||
#else
|
||||
pSystem.scalingMode = ParticleSystemScalingMode.Hierarchy;
|
||||
#endif
|
||||
}
|
||||
|
||||
imageUV = new Vector4(0, 0, 1, 1);
|
||||
|
||||
// prepare texture sheet animation
|
||||
textureSheetAnimation = pSystem.textureSheetAnimation;
|
||||
textureSheetAnimationFrames = 0;
|
||||
textureSheetAnimationFrameSize = Vector2.zero;
|
||||
if (textureSheetAnimation.enabled)
|
||||
{
|
||||
textureSheetAnimationFrames = textureSheetAnimation.numTilesX * textureSheetAnimation.numTilesY;
|
||||
textureSheetAnimationFrameSize = new Vector2(1f / textureSheetAnimation.numTilesX, 1f / textureSheetAnimation.numTilesY);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
if (!Initialize())
|
||||
{
|
||||
enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void OnPopulateMesh(VertexHelper vh)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
if (!Initialize())
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// prepare vertices
|
||||
vh.Clear();
|
||||
|
||||
if (!gameObject.activeInHierarchy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isInitialised && !pSystem.main.playOnAwake)
|
||||
{
|
||||
pSystem.Stop(false, ParticleSystemStopBehavior.StopEmittingAndClear);
|
||||
isInitialised = true;
|
||||
}
|
||||
|
||||
Vector2 temp = Vector2.zero;
|
||||
Vector2 corner1 = Vector2.zero;
|
||||
Vector2 corner2 = Vector2.zero;
|
||||
// iterate through current particles
|
||||
int count = pSystem.GetParticles(Particles);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
ParticleSystem.Particle particle = Particles[i];
|
||||
|
||||
// get particle properties
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
Vector2 position = (mainModule.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
|
||||
#else
|
||||
Vector2 position = (pSystem.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
|
||||
#endif
|
||||
float rotation = -particle.rotation * Mathf.Deg2Rad;
|
||||
float rotation90 = rotation + Mathf.PI / 2;
|
||||
Color32 color = particle.GetCurrentColor(pSystem);
|
||||
float size = particle.GetCurrentSize(pSystem) * 0.5f;
|
||||
|
||||
// apply scale
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
if (mainModule.scalingMode == ParticleSystemScalingMode.Shape)
|
||||
position /= canvas.scaleFactor;
|
||||
#else
|
||||
if (pSystem.scalingMode == ParticleSystemScalingMode.Shape)
|
||||
position /= canvas.scaleFactor;
|
||||
#endif
|
||||
|
||||
// apply texture sheet animation
|
||||
Vector4 particleUV = imageUV;
|
||||
if (textureSheetAnimation.enabled)
|
||||
{
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
float frameProgress = 1 - (particle.remainingLifetime / particle.startLifetime);
|
||||
|
||||
if (textureSheetAnimation.frameOverTime.curveMin != null)
|
||||
{
|
||||
frameProgress = textureSheetAnimation.frameOverTime.curveMin.Evaluate(1 - (particle.remainingLifetime / particle.startLifetime));
|
||||
}
|
||||
else if (textureSheetAnimation.frameOverTime.curve != null)
|
||||
{
|
||||
frameProgress = textureSheetAnimation.frameOverTime.curve.Evaluate(1 - (particle.remainingLifetime / particle.startLifetime));
|
||||
}
|
||||
else if (textureSheetAnimation.frameOverTime.constant > 0)
|
||||
{
|
||||
frameProgress = textureSheetAnimation.frameOverTime.constant - (particle.remainingLifetime / particle.startLifetime);
|
||||
}
|
||||
#else
|
||||
float frameProgress = 1 - (particle.lifetime / particle.startLifetime);
|
||||
#endif
|
||||
|
||||
frameProgress = Mathf.Repeat(frameProgress * textureSheetAnimation.cycleCount, 1);
|
||||
int frame = 0;
|
||||
|
||||
switch (textureSheetAnimation.animation)
|
||||
{
|
||||
|
||||
case ParticleSystemAnimationType.WholeSheet:
|
||||
frame = Mathf.FloorToInt(frameProgress * textureSheetAnimationFrames);
|
||||
break;
|
||||
|
||||
case ParticleSystemAnimationType.SingleRow:
|
||||
frame = Mathf.FloorToInt(frameProgress * textureSheetAnimation.numTilesX);
|
||||
|
||||
int row = textureSheetAnimation.rowIndex;
|
||||
#if UNITY_2019_1_OR_NEWER
|
||||
if (textureSheetAnimation.rowMode == ParticleSystemAnimationRowMode.Random)
|
||||
#else
|
||||
if (textureSheetAnimation.useRandomRow)
|
||||
#endif
|
||||
{ // FIXME - is this handled internally by rowIndex?
|
||||
row = Mathf.Abs((int)particle.randomSeed % textureSheetAnimation.numTilesY);
|
||||
}
|
||||
frame += row * textureSheetAnimation.numTilesX;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
frame %= textureSheetAnimationFrames;
|
||||
|
||||
particleUV.x = (frame % textureSheetAnimation.numTilesX) * textureSheetAnimationFrameSize.x;
|
||||
particleUV.y = 1.0f - ((frame / textureSheetAnimation.numTilesX) + 1) * textureSheetAnimationFrameSize.y;
|
||||
particleUV.z = particleUV.x + textureSheetAnimationFrameSize.x;
|
||||
particleUV.w = particleUV.y + textureSheetAnimationFrameSize.y;
|
||||
}
|
||||
|
||||
temp.x = particleUV.x;
|
||||
temp.y = particleUV.y;
|
||||
|
||||
_quad[0] = UIVertex.simpleVert;
|
||||
_quad[0].color = color;
|
||||
_quad[0].uv0 = temp;
|
||||
|
||||
temp.x = particleUV.x;
|
||||
temp.y = particleUV.w;
|
||||
_quad[1] = UIVertex.simpleVert;
|
||||
_quad[1].color = color;
|
||||
_quad[1].uv0 = temp;
|
||||
|
||||
temp.x = particleUV.z;
|
||||
temp.y = particleUV.w;
|
||||
_quad[2] = UIVertex.simpleVert;
|
||||
_quad[2].color = color;
|
||||
_quad[2].uv0 = temp;
|
||||
|
||||
temp.x = particleUV.z;
|
||||
temp.y = particleUV.y;
|
||||
_quad[3] = UIVertex.simpleVert;
|
||||
_quad[3].color = color;
|
||||
_quad[3].uv0 = temp;
|
||||
|
||||
if (rotation == 0)
|
||||
{
|
||||
// no rotation
|
||||
corner1.x = position.x - size;
|
||||
corner1.y = position.y - size;
|
||||
corner2.x = position.x + size;
|
||||
corner2.y = position.y + size;
|
||||
|
||||
temp.x = corner1.x;
|
||||
temp.y = corner1.y;
|
||||
_quad[0].position = temp;
|
||||
temp.x = corner1.x;
|
||||
temp.y = corner2.y;
|
||||
_quad[1].position = temp;
|
||||
temp.x = corner2.x;
|
||||
temp.y = corner2.y;
|
||||
_quad[2].position = temp;
|
||||
temp.x = corner2.x;
|
||||
temp.y = corner1.y;
|
||||
_quad[3].position = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (use3dRotation)
|
||||
{
|
||||
// get particle properties
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
Vector3 pos3d = (mainModule.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
|
||||
#else
|
||||
Vector3 pos3d = (pSystem.simulationSpace == ParticleSystemSimulationSpace.Local ? particle.position : _transform.InverseTransformPoint(particle.position));
|
||||
#endif
|
||||
|
||||
// apply scale
|
||||
#if UNITY_5_5_OR_NEWER
|
||||
if (mainModule.scalingMode == ParticleSystemScalingMode.Shape)
|
||||
position /= canvas.scaleFactor;
|
||||
#else
|
||||
if (pSystem.scalingMode == ParticleSystemScalingMode.Shape)
|
||||
position /= canvas.scaleFactor;
|
||||
#endif
|
||||
|
||||
Vector3[] verts = new Vector3[4]
|
||||
{
|
||||
new Vector3(-size, -size, 0),
|
||||
new Vector3(-size, size, 0),
|
||||
new Vector3(size, size, 0),
|
||||
new Vector3(size, -size, 0)
|
||||
};
|
||||
|
||||
Quaternion particleRotation = Quaternion.Euler(particle.rotation3D);
|
||||
|
||||
_quad[0].position = pos3d + particleRotation * verts[0];
|
||||
_quad[1].position = pos3d + particleRotation * verts[1];
|
||||
_quad[2].position = pos3d + particleRotation * verts[2];
|
||||
_quad[3].position = pos3d + particleRotation * verts[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
// apply rotation
|
||||
Vector2 right = new Vector2(Mathf.Cos(rotation), Mathf.Sin(rotation)) * size;
|
||||
Vector2 up = new Vector2(Mathf.Cos(rotation90), Mathf.Sin(rotation90)) * size;
|
||||
|
||||
_quad[0].position = position - right - up;
|
||||
_quad[1].position = position - right + up;
|
||||
_quad[2].position = position + right + up;
|
||||
_quad[3].position = position + right - up;
|
||||
}
|
||||
}
|
||||
|
||||
vh.AddUIVertexQuad(_quad);
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!fixedTime && Application.isPlaying)
|
||||
{
|
||||
pSystem.Simulate(Time.unscaledDeltaTime, false, false, true);
|
||||
SetAllDirty();
|
||||
|
||||
if ((currentMaterial != null && currentTexture != currentMaterial.mainTexture) ||
|
||||
(material != null && currentMaterial != null && material.shader != currentMaterial.shader))
|
||||
{
|
||||
pSystem = null;
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (!Application.isPlaying)
|
||||
{
|
||||
SetAllDirty();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fixedTime)
|
||||
{
|
||||
pSystem.Simulate(Time.unscaledDeltaTime, false, false, true);
|
||||
SetAllDirty();
|
||||
if ((currentMaterial != null && currentTexture != currentMaterial.mainTexture) ||
|
||||
(material != null && currentMaterial != null && material.shader != currentMaterial.shader))
|
||||
{
|
||||
pSystem = null;
|
||||
Initialize();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (material == currentMaterial) { return; }
|
||||
pSystem = null;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
protected override void OnDestroy()
|
||||
{
|
||||
currentMaterial = null;
|
||||
currentTexture = null;
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
public void StartParticleEmission()
|
||||
{
|
||||
pSystem.time = 0;
|
||||
pSystem.Play();
|
||||
}
|
||||
|
||||
public void StopParticleEmission()
|
||||
{
|
||||
pSystem.Stop(false, ParticleSystemStopBehavior.StopEmittingAndClear);
|
||||
}
|
||||
|
||||
public void PauseParticleEmission()
|
||||
{
|
||||
pSystem.Stop(false, ParticleSystemStopBehavior.StopEmitting);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
12
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/UIParticleSystem.cs.meta
vendored
Normal file
12
Assets/External/InterfaceCore/Scripts/UnityUIExtensions/UIParticleSystem.cs.meta
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 444df69c6ea9d6346b9bf74b5c5b8451
|
||||
timeCreated: 1464383716
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user