mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
[spine-unity] Fix SkeletonGhostRenderer namespace.
This commit is contained in:
parent
ebd8831a17
commit
bde07221b3
@ -1,4 +1,4 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* SkeletonGhostRenderer created by Mitch Thompson
|
* SkeletonGhostRenderer created by Mitch Thompson
|
||||||
* Full irrevocable rights and permissions granted to Esoteric Software
|
* Full irrevocable rights and permissions granted to Esoteric Software
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
@ -6,6 +6,7 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
|
namespace Spine.Unity.Modules {
|
||||||
public class SkeletonGhostRenderer : MonoBehaviour {
|
public class SkeletonGhostRenderer : MonoBehaviour {
|
||||||
|
|
||||||
public float fadeSpeed = 10;
|
public float fadeSpeed = 10;
|
||||||
@ -24,21 +25,16 @@ public class SkeletonGhostRenderer : MonoBehaviour {
|
|||||||
StopAllCoroutines();
|
StopAllCoroutines();
|
||||||
|
|
||||||
gameObject.SetActive(true);
|
gameObject.SetActive(true);
|
||||||
|
|
||||||
|
|
||||||
meshRenderer.sharedMaterials = materials;
|
meshRenderer.sharedMaterials = materials;
|
||||||
meshRenderer.sortingLayerID = sortingLayerID;
|
meshRenderer.sortingLayerID = sortingLayerID;
|
||||||
meshRenderer.sortingOrder = sortingOrder;
|
meshRenderer.sortingOrder = sortingOrder;
|
||||||
|
meshFilter.sharedMesh = Instantiate(mesh);
|
||||||
meshFilter.sharedMesh = (Mesh)Instantiate(mesh);
|
|
||||||
|
|
||||||
colors = meshFilter.sharedMesh.colors32;
|
colors = meshFilter.sharedMesh.colors32;
|
||||||
|
|
||||||
if ((color.a + color.r + color.g + color.b) > 0) {
|
if ((color.a + color.r + color.g + color.b) > 0) {
|
||||||
for (int i = 0; i < colors.Length; i++) {
|
for (int i = 0; i < colors.Length; i++)
|
||||||
colors[i] = color;
|
colors[i] = color;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fadeSpeed = speed;
|
fadeSpeed = speed;
|
||||||
|
|
||||||
@ -51,7 +47,6 @@ public class SkeletonGhostRenderer : MonoBehaviour {
|
|||||||
IEnumerator Fade () {
|
IEnumerator Fade () {
|
||||||
Color32 c;
|
Color32 c;
|
||||||
for (int t = 0; t < 500; t++) {
|
for (int t = 0; t < 500; t++) {
|
||||||
|
|
||||||
bool breakout = true;
|
bool breakout = true;
|
||||||
for (int i = 0; i < colors.Length; i++) {
|
for (int i = 0; i < colors.Length; i++) {
|
||||||
c = colors[i];
|
c = colors[i];
|
||||||
@ -60,16 +55,15 @@ public class SkeletonGhostRenderer : MonoBehaviour {
|
|||||||
|
|
||||||
colors[i] = Color32.Lerp(c, black, Time.deltaTime * fadeSpeed);
|
colors[i] = Color32.Lerp(c, black, Time.deltaTime * fadeSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
meshFilter.sharedMesh.colors32 = colors;
|
meshFilter.sharedMesh.colors32 = colors;
|
||||||
|
|
||||||
if (breakout)
|
if (breakout)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Destroy(meshFilter.sharedMesh);
|
Destroy(meshFilter.sharedMesh);
|
||||||
|
|
||||||
gameObject.SetActive(false);
|
gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,3 +102,5 @@ public class SkeletonGhostRenderer : MonoBehaviour {
|
|||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user