mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/MI-38.git
synced 2026-01-24 02:15:38 +03:00
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Cover : MonoBehaviour
|
|
{
|
|
List<string> coverStatesListNames = new List<string>();
|
|
//Dictionary<string, GameObject> switcheStatesList = new Dictionary<string, GameObject>();
|
|
public Dictionary<string, CoverState> coverStatesList = new Dictionary<string, CoverState>();
|
|
|
|
// int posCount;
|
|
// int currentPos;
|
|
void Start()
|
|
{
|
|
// Debug.Log(go.name);
|
|
Transform[] coverStates = this.GetComponentsInChildren<Transform>();
|
|
// Debug.Log(btnList.Length);
|
|
for (int i = 0; i < coverStates.Length; i++)
|
|
{
|
|
if (i == 0) continue;
|
|
// Debug.Log(btnList[i].gameObject.name);
|
|
coverStates[i].gameObject.AddComponent<CoverState>();
|
|
coverStatesListNames.Add(coverStates[i].gameObject.name);
|
|
coverStatesList.Add(coverStates[i].gameObject.name, coverStates[i].gameObject.GetComponent<CoverState>());
|
|
}
|
|
//coverStatesListNames.Sort();
|
|
//setState(0);
|
|
setState(0);
|
|
}
|
|
|
|
public void setState(int state)
|
|
{
|
|
coverStatesList[coverStatesListNames[state]].switchOn();
|
|
}
|
|
public void setState(string swName)
|
|
{
|
|
coverStatesList[swName].switchOn();
|
|
}
|
|
} |