public override void Awake() { Ins = (BaseSceneObject)this; base.Awake(); if (Application.isPlaying) { if (EnableOnPlay != null) { foreach (var item in EnableOnPlay) { item.SetActive(true); } } if (DisableOnPlay != null) { foreach (var item in DisableOnPlay) { item.SetActive(false); } } } Parse(); }
public void Spawn(WorldWeatherType type, Vector2 index) { if (Data.ContainsKey(index.ToString())) { return; } if (index.x >= RealCount || index.y >= RealCount) { return; } if (!ConfigData.ContainsKey(type)) { return; } Vector2 pos = PosIndex[(int)index.x, (int)index.y]; Vector3 realPos = new Vector3(pos.x, BaseSceneObject.GetAbsHeight(pos.x, pos.y), pos.y); realPos.x += RandUtil.RandFloat(-50, 50); realPos.z += RandUtil.RandFloat(-50, 50); var perform = PerfomMgr.Spawn(ConfigData[type].Rand(), realPos, Quaternion.identity); Data.Add(index.ToString(), new WorldWeatherData(RandUtil.RandInt(50, 400), perform)); }