public void Load() { for (int i = 0; i < this.m_AllGhosts.Count; i++) { UnityEngine.Object.Destroy(this.m_AllGhosts[i].gameObject); } this.m_AllGhosts.Clear(); int num = SaveGame.LoadIVal("GhostCount"); for (int j = 0; j < num; j++) { string text = SaveGame.LoadSVal("Ghost" + j); GameObject prefab = GreenHellGame.Instance.GetPrefab(text); if (!prefab) { DebugUtils.Assert("[ConstructionGhostManager:Load] ERROR - Can't load prefab - " + text, true, DebugUtils.AssertType.Info); } else { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(prefab); gameObject.name = prefab.name; ConstructionGhost component = gameObject.GetComponent <ConstructionGhost>(); component.Load(j); } } }
public void SetupAfterLoad() { bool flag = false; int num = SaveGame.LoadIVal("GhostCount"); for (int i = 0; i < num; i++) { string text = SaveGame.LoadSVal("Ghost" + i); GameObject prefab = GreenHellGame.Instance.GetPrefab(text); if (!prefab) { DebugUtils.Assert("[ConstructionGhostManager:Load] ERROR - Can't load prefab - " + text, true, DebugUtils.AssertType.Info); } else { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(prefab); gameObject.name = prefab.name; ConstructionGhost component = gameObject.GetComponent <ConstructionGhost>(); component.Load(i); if (component.m_ResultItemID == ItemID.Bamboo_Bridge) { flag = true; } } } if (!flag && GreenHellGame.Instance.m_GameMode == GameMode.Survival) { GameObject gameObject2 = null; bool flag2 = false; foreach (Item item in Item.s_AllItems) { if (item.GetInfoID() == ItemID.Bamboo_Bridge) { flag2 = true; gameObject2 = item.gameObject; break; } } Vector3 zero = Vector3.zero; zero.Set(842.39f, 138.569f, 1617.97f); Quaternion identity = Quaternion.identity; identity.Set(-0.5448493f, -0.450922f, -0.451856f, 0.543723f); if (!flag2) { gameObject2 = UnityEngine.Object.Instantiate <GameObject>(GreenHellGame.Instance.GetPrefab("Bamboo_Bridge")); gameObject2.transform.position = zero; gameObject2.transform.rotation = identity; return; } gameObject2.transform.position = zero; gameObject2.transform.rotation = identity; } }