private static int PrepareDefinitions(string sceneName) { int count = 0; RepairableContainerDefinition[] repairableContainerDefinition = definitions.GetDefinitions(sceneName); Log("Found " + repairableContainerDefinition.Length + " definitions for scene " + sceneName); foreach (RepairableContainerDefinition eachDefinition in repairableContainerDefinition) { GameObject target = FindGameObject(eachDefinition.Target.Path, eachDefinition.Target.Position); if (target == null) { Log("Could not find target of definition for " + eachDefinition.Target.Path + " @" + eachDefinition.Target.Position.ToString("F3")); continue; } GameObject template = FindGameObject(eachDefinition.Template.Path, eachDefinition.Template.Position); if (template == null) { Log("Could not find template of definition for " + eachDefinition.Target.Path + " @" + eachDefinition.Target.Position.ToString("F3")); continue; } Container container = template.GetComponent <Container>(); if (container == null) { Log("Could not find container of definition for " + eachDefinition.Target.Path + " @" + eachDefinition.Target.Position.ToString("F3")); continue; } if ("CabinetDoor" == eachDefinition.Type) { RepairableCabinetDoor.Prepare(target, container, eachDefinition.Reference); count++; } else if ("Drawer" == eachDefinition.Type) { RepairableDrawer.Prepare(target, container, eachDefinition.Reference); count++; } else { Log("Unsupported type '" + eachDefinition.Type + "'"); } } return(count); }
private static int PrepareDrawers(Scene scene) { int count = 0; foreach (GameObject eachRepairableDrawer in GetSceneObjects(scene, RepairableDrawer.FilterInstance)) { Container template = FindContainerTemplate(eachRepairableDrawer); if (template != null) { RepairableDrawer.Prepare(eachRepairableDrawer, template); count++; } } return(count); }