mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/MI-38.git
synced 2026-01-24 01:05:37 +03:00
46 lines
1.3 KiB
C#
46 lines
1.3 KiB
C#
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;
|
|
}
|
|
}
|