Added shader outline to quarry
This commit is contained in:
@@ -6,12 +6,13 @@ using Core.Lifecycle;
|
||||
public class GlowOutline : ManagedBehaviour
|
||||
{
|
||||
|
||||
private SpriteRenderer parentSprite;
|
||||
|
||||
private Color outlineColor;
|
||||
private Transform[] childrenTransforms;
|
||||
private SpriteRenderer[] childrenSprites;
|
||||
private List<GlowOutlineData> outlineColors;
|
||||
|
||||
public SpriteRenderer itemSprite;
|
||||
public float thiccness;
|
||||
public GlowOutlineData.InteractionType interactionType;
|
||||
|
||||
@@ -40,19 +41,12 @@ public class GlowOutline : ManagedBehaviour
|
||||
if (data.interaction == interactionType)
|
||||
{
|
||||
outlineColor = data.outlineColour;
|
||||
Debug.Log(outlineColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Find the spriterenderer in parent gameobject, but ignore our own spriterenderer
|
||||
foreach (SpriteRenderer sprite in GetComponentsInParent<SpriteRenderer>())
|
||||
{
|
||||
if (sprite != this.GetComponent<SpriteRenderer>())
|
||||
{
|
||||
parentSprite = sprite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set the scale and sprite of each child. Skip first child because that's the outline object.
|
||||
childrenTransforms[1].localPosition = new Vector3(1, 0, 0) * thiccness;
|
||||
@@ -62,8 +56,8 @@ public class GlowOutline : ManagedBehaviour
|
||||
|
||||
foreach (SpriteRenderer childSprite in childrenSprites)
|
||||
{
|
||||
childSprite.sprite = parentSprite.sprite;
|
||||
childSprite.material.color = outlineColor;
|
||||
childSprite.sprite = itemSprite.sprite;
|
||||
childSprite.sharedMaterial.color = outlineColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user