mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/MI-38.git
synced 2026-01-24 02:45:39 +03:00
04.07.2022
This commit is contained in:
45
Heli_with_panels/Assets/Scripts/UI/ButtonCubik.cs
Normal file
45
Heli_with_panels/Assets/Scripts/UI/ButtonCubik.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
public class ButtonCubik : MonoBehaviour
|
||||
{
|
||||
public GameObject[] view;
|
||||
public bool curView = true; // v1
|
||||
Manager man;
|
||||
|
||||
void Start()
|
||||
{
|
||||
//Debug.Log("Cube start");
|
||||
curView = true;
|
||||
view[0].SetActive(curView);
|
||||
view[1].SetActive(!curView);
|
||||
man = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
}
|
||||
|
||||
public void Clicked()
|
||||
{
|
||||
if (man.mode == "scedit") return;
|
||||
ChangeView();
|
||||
}
|
||||
public void ChangeView()
|
||||
{
|
||||
curView = !curView;
|
||||
view[0].SetActive(curView);
|
||||
view[1].SetActive(!curView);
|
||||
if(man == null) man = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
man.objects.Find(this.gameObject.name).curState = curView ? 0 : 1;
|
||||
}
|
||||
public void SetView(int newView=-1)
|
||||
{
|
||||
//Debug.Log("SetView " + newView);
|
||||
if (newView == 0) curView = true;
|
||||
if (newView == 1) curView = false;
|
||||
view[0].SetActive(curView);
|
||||
view[1].SetActive(!curView);
|
||||
if (man == null) man = GameObject.Find("Manager").GetComponent<Manager>();
|
||||
man.objects.Find(this.gameObject.name).curState = newView;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user