public void ApplyTo(ModdableGameObject go) { if (original == null) { original = new ArenaModGameObject(); original.GetFrom(go); } if (modThis) { if (overrideActive) { go.gameObject.SetActive(isActive); } Transform t = go.transform; t.localPosition = position; t.localRotation = Quaternion.Euler(rotation); for (int i = 0; i < Mathf.Min(moddableRenderers.Count, go.moddableRenderers.Count); i++) { moddableRenderers[i].ApplyTo(go.moddableRenderers[i]); } for (int i = 0; i < Mathf.Min(moddableChildren.Count, go.moddableChildren.Count); i++) { moddableChildren[i].ApplyTo(go.moddableChildren[i]); } } }
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); } }