Implimented the card
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class FloorButtonVisualizer : MonoBehaviour
|
||||
{
|
||||
public Sprite InactiveSprite;
|
||||
public Sprite ActiveSprite;
|
||||
public float FloorUpperCoordiantes;
|
||||
public float FloorLowerCoordiantes;
|
||||
private bool activeState = true;
|
||||
private Image buttonImage;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
buttonImage = gameObject.GetComponent<Image>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
float height = gameObject.transform.position.y;
|
||||
if (height < FloorUpperCoordiantes && height > FloorLowerCoordiantes)
|
||||
{
|
||||
if (!activeState) {
|
||||
activeState = true;
|
||||
buttonImage.sprite = ActiveSprite;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (activeState)
|
||||
{
|
||||
activeState = false;
|
||||
buttonImage.sprite = InactiveSprite;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user