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); } }
public void GetFrom(List <ModdableGameObject> gos, List <Light> lights) { skybox.GetFrom(); moddableGameObjects.Clear(); foreach (ModdableGameObject go in gos) { ArenaModGameObject goMod = new ArenaModGameObject(); moddableGameObjects.Add(goMod); goMod.GetFrom(go); } moddableLights.Clear(); foreach (Light light in lights) { ArenaModLight lightMod = new ArenaModLight(); moddableLights.Add(lightMod); lightMod.GetFrom(light); } }