init
This commit is contained in:
commit
27755409e3
195 changed files with 146336 additions and 0 deletions
31
Assets/Scripts/PlacerObject.cs
Normal file
31
Assets/Scripts/PlacerObject.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue