public void Init(OldSection section, GameObject mainCharacter) { this.section = section; this.items = section.Items; this.mainCharacter = mainCharacter; vm = GetComponent <VisibilityManager>(); }
private void LoadSections() { Transform terrain = terrainManager.gameObject.transform; for (int i = 0; i < terrain.childCount; i++) { TextAsset sectionJSON = Resources.Load("Json/Sections/" + terrain.GetChild(i).name) as TextAsset; string jsonString = sectionJSON == null ? null : sectionJSON.text; OldSection section = new OldSection(); GameState.oldSections.Add(section); section.IdSection = terrain.GetChild(i).gameObject; section.Items = new ItemsSector(); section.Items = JsonUtility.FromJson <ItemsSector>(jsonString); section.IdSection.AddComponent <VisibilityManager>().Init(50); section.IdSection.AddComponent <ItemsManager>().Init(GameState.oldSections[i], mainCharacter); } }