mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/MI-38.git
synced 2026-01-24 02:45:39 +03:00
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Cover2 : MonoBehaviour
|
|
{
|
|
List<GameObject> buttonStatesList3 = new List<GameObject>();
|
|
Manager man;
|
|
int click = 0;
|
|
void Start()
|
|
{
|
|
man = GameObject.Find("Manager").GetComponent<Manager>();
|
|
Transform[] buttonStates = this.GetComponentsInChildren<Transform>();
|
|
for (int i = 0; i < buttonStates.Length; i++)
|
|
{
|
|
if ((!buttonStates[i].name.Equals(this.name)) && buttonStates[i].name.StartsWith(this.name))
|
|
{
|
|
buttonStates[i].gameObject.SetActive(false);
|
|
buttonStatesList3.Add(buttonStates[i].gameObject);
|
|
}
|
|
|
|
}
|
|
EnableSprite(0);
|
|
|
|
}
|
|
|
|
void OnMouseUp()
|
|
{
|
|
if (man.mode == "scedit" || man.mode == "play")
|
|
return;
|
|
click++;
|
|
if (click > buttonStatesList3.Count - 1) click = 0;
|
|
//Debug.Log("êîëè÷åñòâî êëèêîâ + " + click);
|
|
EnableSprite(click);
|
|
|
|
}
|
|
|
|
public void EnableSprite(int n)
|
|
{
|
|
buttonStatesList3.ForEach(_buttonStatesList3 => _buttonStatesList3.gameObject.SetActive(false));
|
|
buttonStatesList3[n].gameObject.SetActive(true);
|
|
}
|
|
|
|
}
|