This commit is contained in:
Gerard Gascón 2025-04-24 17:33:35 +02:00
commit 27755409e3
195 changed files with 146336 additions and 0 deletions

View file

@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlacerObject : MonoBehaviour{
bool canPlace = true;
public bool CanPlace { get { return canPlace; } }
[SerializeField] Color canPlaceColor, cannotPlaceColor;
Material material;
void Start(){
material = GetComponent<MeshRenderer>().material;
}
void OnTriggerStay(Collider other){
if (other.CompareTag("Piece") || other.CompareTag("Button") || other.CompareTag("Obstacle")){
canPlace = false;
material.color = cannotPlaceColor;
}
}
void OnTriggerExit(Collider other){
if (other.CompareTag("Piece") || other.CompareTag("Button") || other.CompareTag("Obstacle")){
canPlace = true;
material.color = canPlaceColor;
}
}
}