mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/MI-38.git
synced 2026-01-24 05:55:37 +03:00
04.07.2022
This commit is contained in:
39
Heli_with_panels/Assets/Scripts/Panel2D/Cover.cs
Normal file
39
Heli_with_panels/Assets/Scripts/Panel2D/Cover.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user