Advertisement
Tarodev

Game Grid - Tile.cs

Jun 14th, 2021
13,473
1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 1 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Tile : MonoBehaviour {
  6.     [SerializeField] private Color _baseColor, _offsetColor;
  7.     [SerializeField] private SpriteRenderer _renderer;
  8.     [SerializeField] private GameObject _highlight;
  9.  
  10.     public void Init(bool isOffset) {
  11.         _renderer.color = isOffset ? _offsetColor : _baseColor;
  12.     }
  13.  
  14.     void OnMouseEnter() {
  15.         _highlight.SetActive(true);
  16.     }
  17.  
  18.     void OnMouseExit()
  19.     {
  20.         _highlight.SetActive(false);
  21.     }
  22. }
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement