using UnityEngine; public class SpawnStaticRemnant : MonoBehaviour { public GameObject remnantSource; private AttackLevel level; private Color remnantColor; private void Start() { remnantColor = PlayerSkinBank.GetPlayerSkinColors(base.transform.GetComponentInParent().playerID).winText; level = GetComponent(); } public void Go() { GameObject gameObject = Object.Instantiate(remnantSource, base.transform.position, base.transform.rotation); SpriteRenderer[] componentsInChildren = base.transform.root.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i].transform.lossyScale.x != 0f && componentsInChildren[i].transform.lossyScale.y != 0f && componentsInChildren[i].transform.lossyScale.z != 0f && (!(componentsInChildren[i].transform.parent.name != "Art") || !(componentsInChildren[i].transform.parent.parent.name != "Face"))) { Vector3 lossyScale = componentsInChildren[i].transform.lossyScale; GameObject gameObject2 = Object.Instantiate(componentsInChildren[i].gameObject, componentsInChildren[i].transform.position, componentsInChildren[i].transform.rotation, gameObject.transform.GetChild(0)); gameObject2.transform.localScale = lossyScale; Strip(gameObject2); SpriteRenderer component = gameObject2.GetComponent(); component.enabled = true; component.color = remnantColor; SpriteMask component2 = gameObject2.GetComponent(); if ((bool)component2) { Object.Destroy(component2); } } } gameObject.GetComponentInChildren().startColor = PlayerSkinBank.GetPlayerSkinColors(base.transform.GetComponentInParent().playerID).particleEffect; gameObject.AddComponent().spawner = base.transform.root.GetComponent(); gameObject.transform.localScale *= 1f + (float)(level.attackLevel - 1) * 0.3f; } private void Strip(GameObject go) { MonoBehaviour[] componentsInChildren = go.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy(componentsInChildren[i]); } } }