public override void OnLoad(ConfigNode node) { base.OnLoad(node); if (OrigSize.IsZero() || OrigScale.IsZero() || OrigPartSize.IsZero()) { var part_metric = new Metric(part); var metric = default(Metric); if (!string.IsNullOrEmpty(MetricMesh)) { var metric_mesh = part.FindModelComponent <MeshFilter>(MetricMesh); if (metric_mesh != null) { metric = new Metric(metric_mesh, part.transform); } else { this.Log("[WARNING] MeshMetric: no such MeshFilter: {}", MetricMesh); } } if (metric.Empty) { metric = part_metric; } OrigSize = metric.size; OrigScale = model.localScale; OrigPartSize = part_metric.size; } if (Size.IsZero()) { Size = OrigSize; } update_model(false); //deprecated config conversion if (node.HasValue("Deploying")) { state = DeplyomentState.IDLE; var val = node.GetValue("Deploying"); if (bool.TryParse(val, out bool _deploy) && _deploy) { state = DeplyomentState.DEPLOYING; } else { val = node.GetValue("Deployed"); if (bool.TryParse(val, out _deploy) && _deploy) { state = DeplyomentState.DEPLOYED; } } } }
IEnumerator <YieldInstruction> deploy() { foreach (var _ in prepare_deployment()) { yield return(null); } var deployT = get_deploy_transform(); TargetSize = get_deployed_size(); TargetSize = TargetSize.Local2LocalDir(deployT, model).AbsComponents(); yield return(slow_resize()); foreach (var _ in finalize_deployment()) { yield return(null); } state = DeplyomentState.DEPLOYED; }
protected void start_deployment() { Utils.SaveGame(Name + "-before_deployment"); state = DeplyomentState.DEPLOYING; StartCoroutine(deploy()); }