public void LoadMetaData() { if (requirements == null) { return; } foreach (RequirementsMetaData metaData in requirements) { Door doorComponent = Door.getDoorByPosition(new Vector2Int(metaData.doorToOpen)); doorComponent.Setup(metaData, metaData.openAutomatically); foreach (RequirementMetaData data in metaData.requirements) { if (data.type == 0) { Key.getKeyByPosition(new Vector2Int(data.positionInGrid)).id = data.id; } else if (data.type == 1) { PressurePlate.GetPressurePlateByPosition (new Vector2Int(data.positionInGrid)).id = data.id; } } } }
public void Setup(RequirementsMetaData requirements, bool openAutomatically) { this.openAutomatic = openAutomatically; keyIds = new List <int>(); pressurePlates = new List <PressurePlate>(); foreach (RequirementMetaData requirement in requirements.requirements) { if (requirement.type == 0) // ITS A KEY { keyIds.Add(requirement.id); } else { pressurePlates.Add(PressurePlate.GetPressurePlateByPosition (new Vector2Int(requirement.positionInGrid))); } } }