public void GetFrom(ModdableGameObject go) { name = go.name; modThis = true; isActive = go.gameObject.activeSelf; Transform t = go.transform; position = t.localPosition; rotation = t.localRotation.eulerAngles; moddableRenderers.Clear(); foreach (Renderer renderer in go.moddableRenderers) { ArenaModRenderer rendererMod = new ArenaModRenderer(); rendererMod.GetFrom(renderer); moddableRenderers.Add(rendererMod); } moddableChildren.Clear(); foreach (ModdableGameObject child in go.moddableChildren) { ArenaModGameObject goMod = new ArenaModGameObject(); goMod.GetFrom(child); moddableChildren.Add(goMod); } }
public void ApplyTo(Renderer renderer) { if (original == null) { original = new ArenaModRenderer(); original.GetFrom(renderer); } renderer.enabled = enabled; if (mesh != null) { renderer.GetComponent <MeshFilter>().mesh = mesh; } else if (!string.IsNullOrEmpty(modelOverride)) { Debug.LogError($"Not loading '{modelOverride}' because loading models is not implemented, yet!"); } }