Outlines added to quarry

This commit is contained in:
2025-12-12 14:36:39 +01:00
parent b9cf96367a
commit 8ce4627e97
30 changed files with 2290 additions and 4376 deletions

View File

@@ -2,6 +2,7 @@ using AppleHills;
using System.Collections.Generic;
using UnityEngine;
using Core.Lifecycle;
using JetBrains.Annotations;
public class GlowOutline : ManagedBehaviour
{
@@ -15,6 +16,7 @@ public class GlowOutline : ManagedBehaviour
public SpriteRenderer itemSprite;
public float thiccness;
public GlowOutlineData.InteractionType interactionType;
public bool animatedSprite;
@@ -35,7 +37,7 @@ public class GlowOutline : ManagedBehaviour
childrenSprites = GetComponentsInChildren<SpriteRenderer>();
// childrenMaterials = GetComponentsInChildren<Material>();
// Set the color overlay of the sprites to colour our outline with the colors set in Interaction Settings
// Set the color to use in this outline from the colors set in Interaction Settings
foreach (GlowOutlineData data in outlineColors)
{
if (data.interaction == interactionType)
@@ -44,8 +46,6 @@ public class GlowOutline : ManagedBehaviour
}
}
// Find the spriterenderer in parent gameobject, but ignore our own spriterenderer
// Set the scale and sprite of each child. Skip first child because that's the outline object.
@@ -56,11 +56,41 @@ public class GlowOutline : ManagedBehaviour
foreach (SpriteRenderer childSprite in childrenSprites)
{
childSprite.sprite = itemSprite.sprite;
childSprite.sharedMaterial.color = outlineColor;
if (itemSprite.sprite != null)
{
childSprite.sprite = itemSprite.sprite;
}
if (childSprite.sharedMaterial != null)
{
childSprite.sharedMaterial.color = outlineColor;
}
if (itemSprite == null)
{
Debug.Log($"Outline {name} is missing an item sprite!");
}
}
}
public void Update()
{
if (animatedSprite)
{
foreach (SpriteRenderer childSprite in childrenSprites)
{
if (itemSprite.sprite != null)
{
childSprite.sprite = itemSprite.sprite;
}
}
}
}
#if UNITY_EDITOR
// Update outline in editor
private void OnValidate()