hoop drop animations, multiemission
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Station46.Scripts
|
||||
/// </summary>
|
||||
public class Emission : MonoBehaviour
|
||||
{
|
||||
private static readonly int EmissionColorNameID = Shader.PropertyToID("_EmissionColor");
|
||||
protected static readonly int EmissionColorNameID = Shader.PropertyToID("_EmissionColor");
|
||||
|
||||
[Tooltip("The colour of the emission.")]
|
||||
[ColorUsage(false, true)]
|
||||
@@ -25,7 +25,7 @@ namespace Station46.Scripts
|
||||
private Color _previousColor;
|
||||
private Material _material;
|
||||
|
||||
private void Awake()
|
||||
protected virtual void Awake()
|
||||
{
|
||||
_material = emissionRenderer.material;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ namespace Station46.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangedToggle()
|
||||
protected virtual void ChangedToggle()
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ namespace Station46.Scripts
|
||||
}
|
||||
}
|
||||
|
||||
private void ChangedColor()
|
||||
protected virtual void ChangedColor()
|
||||
{
|
||||
_material.SetColor(EmissionColorNameID, color);
|
||||
}
|
||||
|
||||
51
Assets/Station46/Scripts/MultiEmission.cs
Normal file
51
Assets/Station46/Scripts/MultiEmission.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Station46.Scripts
|
||||
{
|
||||
public class MultiEmission : Emission
|
||||
{
|
||||
[BoxGroup("Internal")] [Required]
|
||||
public MeshRenderer[] additionalEmissionRenderers;
|
||||
|
||||
private Material[] _additionalMaterials;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
_additionalMaterials = new Material[additionalEmissionRenderers.Length];
|
||||
for (var i = 0; i < additionalEmissionRenderers.Length; i++)
|
||||
{
|
||||
_additionalMaterials[i] = additionalEmissionRenderers[i].material;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ChangedToggle()
|
||||
{
|
||||
base.ChangedToggle();
|
||||
|
||||
foreach (var material in _additionalMaterials)
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
material.EnableKeyword("_EMISSION");
|
||||
}
|
||||
else
|
||||
{
|
||||
material.DisableKeyword("_EMISSION");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ChangedColor()
|
||||
{
|
||||
base.ChangedColor();
|
||||
|
||||
foreach (var material in _additionalMaterials)
|
||||
{
|
||||
material.SetColor(EmissionColorNameID, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Station46/Scripts/MultiEmission.cs.meta
Normal file
3
Assets/Station46/Scripts/MultiEmission.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5125296c087d4666ab772574843e6896
|
||||
timeCreated: 1683723522
|
||||
Reference in New Issue
Block a user