public Transform GetVisualization(T key, bool translucent = false) { Transform result = null; if (VisualizationTransformCache.ContainsKey(key)) { result = VisualizationTransformCache[key]; result.gameObject.SetActive(true); } else { result = GameObject.Instantiate <Transform>(GetPrefab(key)); if (typeof(T) == typeof(Module)) { ModuleGameplay g = result.GetComponent <ModuleGameplay>(); if (g != null) { GameObject.Destroy(g); } } PrefabCacheUtils.RecurseDisableColliderSetTranslucentRenderer(result, PrefabCacheUtils.TranslucentValidPlanningMaterial); VisualizationTransformCache[key] = result; } return(result); }
private void SetValidMaterialOnVisualization(bool isValid) { PrefabCacheUtils.RecurseDisableColliderSetTranslucentRenderer(Visualization, isValid ? PrefabCacheUtils.TranslucentValidPlanningMaterial : PrefabCacheUtils.TranslucentInvalidPlanningMaterial); }