HKMBFZ/Assets/Scripts/Szz_Scripts/Shoot122Manager.cs

97 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Shoot122Manager : MonoBehaviour
{
public static Shoot122Manager Instance { get; private set; }
public Animation animation_122;
public GameObject rawImage_122;
public GameObject penguan;
public List<string> chooseShoot=new List<string>();
public Dictionary<string,int> choosedValue=new Dictionary<string,int>();
public Control3DModelBt ;
public bool isShootReady;
public Control3DModelBt autoBtn1;
public Control3DModelBt autoBtn2;
public Control3DModelBt usedOpen;
private void Awake()
{
Instance = this;
isShoot = false;
isShootReady = false;
}
public bool isShoot;
// Start is called before the first frame update
private void Update()
{
if (autoBtn1.Get3DBtnState() && autoBtn2.Get3DBtnState() && usedOpen.Get3DBtnState())
{
isShootReady = true;
}
else {
isShootReady = false;
}
}
public void AddOrUpdate(string key, int value)
{
if (choosedValue.ContainsKey(key))
{
// 键已存在,更新值
choosedValue[key] = value;
}
else
{
// 键不存在,添加新元素
choosedValue.Add(key, value);
}
if (GameObject.FindObjectOfType<PaoZhangMainPage>() != null)
{
FindObjectOfType<PaoZhangMainPage>().SetOneState(int.Parse(key), value);
}
}
public bool RemoveByKey(string key)
{
if (choosedValue.ContainsKey(key))
{
choosedValue.Remove(key);
return true; // 删除成功
}
return false; // key不存在删除失败
}
public void Jifa()
{
if (isShoot|| !.isInit)
return;
rawImage_122.SetActive(true);
isShoot =true;
animation_122.Play();
penguan.SetActive(true);
for (int i = 0; i < chooseShoot.Count; i++)
{
AddOrUpdate(chooseShoot[i].ToString(), 3);
}
}
public void DiaoPaoOver()
{
if (Manager122Base.instance != null)
Manager122Base.instance.Show122DwonMsg("高低到位,方位到位");
}
}