Skip to content

Instantly share code, notes, and snippets.

@Matthew-J-Spencer
Created May 10, 2021 06:02
Show Gist options
  • Save Matthew-J-Spencer/693c1e26fed7fcfe921faf134161d9f6 to your computer and use it in GitHub Desktop.
Save Matthew-J-Spencer/693c1e26fed7fcfe921faf134161d9f6 to your computer and use it in GitHub Desktop.
Tile.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Tile : MonoBehaviour {
[SerializeField] private Color _baseColor, _offsetColor;
[SerializeField] private SpriteRenderer _renderer;
[SerializeField] private GameObject _highlight;
public void Init(bool isOffset) {
_renderer.color = isOffset ? _offsetColor : _baseColor;
}
void OnMouseEnter() {
_highlight.SetActive(true);
}
void OnMouseExit()
{
_highlight.SetActive(false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment