04.07.2022

This commit is contained in:
Plotnikov
2022-07-04 13:15:35 +03:00
parent 5fad2bcf6b
commit 696daa0b2e
7224 changed files with 3814576 additions and 0 deletions

View 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();
}
}