Initial commit
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public enum PlaneAxis
|
||||
{
|
||||
XZ = 0,
|
||||
XY = 1,
|
||||
YZ = 2
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class PlaneSelection
|
||||
{
|
||||
public PlaneAxis planeAxis;
|
||||
public GameObject WorldGrid;
|
||||
}
|
||||
|
||||
public class PlaneSelector : MonoBehaviour
|
||||
{
|
||||
public TMP_Dropdown planeAxisDropDown;
|
||||
|
||||
public PlaneSelection[] PlaneAxis;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
planeAxisDropDown.onValueChanged.AddListener(OnPlaneAxisChanged);
|
||||
UpdatePlaneVisibility();
|
||||
}
|
||||
|
||||
private void OnPlaneAxisChanged(int index)
|
||||
{
|
||||
UpdatePlaneVisibility();
|
||||
}
|
||||
|
||||
private void UpdatePlaneVisibility()
|
||||
{
|
||||
foreach (var plane in PlaneAxis)
|
||||
{
|
||||
if (plane.planeAxis == (PlaneAxis)planeAxisDropDown.value)
|
||||
{
|
||||
plane.WorldGrid.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
plane.WorldGrid.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user