1
Fork 0
mirror of https://github.com/Steffo99/keep-everything-alive.git synced 2024-11-22 17:34:18 +00:00
keep-everything-alive/Assets/Scripts/BleachBeach/RecolorOnCollision.cs

22 lines
473 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(SpriteRenderer))]
public class RecolorOnCollision : MonoBehaviour
{
public Color color;
private SpriteRenderer spriteRenderer;
void Awake()
{
spriteRenderer = GetComponent<SpriteRenderer>();
}
void OnTriggerEnter2D(Collider2D other) {
if(other.tag == "Enemy") {
spriteRenderer.color = color;
}
}
}