private BlockSelector CopyThisComponent(GameObject p_target) { BlockSelector v_newComponent = null; if (p_target != null) { v_newComponent = KiltUtils.CopyComponent <BlockSelector>(p_target, this); } return(v_newComponent); }
public void CloneModelForceBallonComponents() { if (Application.isPlaying) { BallonObjectToCloneByMass v_structToCheck = null; //Find Correct Struct foreach (BallonObjectToCloneByMass v_struct in SpriteChangerModel) { if (v_struct != null && v_struct.ObjectContainer != null && (_sumOfOtherObjectsMass * BallonForceScale) + ExtraThrust >= v_struct.MassToAcceptClone) { if (v_structToCheck == null) { v_structToCheck = v_struct; } else { if (v_struct.MassToAcceptClone > v_structToCheck.MassToAcceptClone) { v_structToCheck = v_struct; } } } } //Copy Components if (v_structToCheck != null && v_structToCheck.ObjectContainer != null) { MonoBehaviour[] v_componentsArray = v_structToCheck.ObjectContainer.GetComponents <MonoBehaviour>(); foreach (MonoBehaviour v_component in v_componentsArray) { if (v_component != null) { KiltUtils.CopyComponent <MonoBehaviour>(this.gameObject, v_component); } } //Copy Sprite Renderer SpriteRenderer v_otherSpriteRenderer = v_structToCheck.ObjectContainer.GetComponent <SpriteRenderer>(); SpriteRenderer v_myRenderer = this.gameObject.GetComponent <SpriteRenderer>(); if (v_myRenderer != null && v_otherSpriteRenderer != null) { v_myRenderer.sprite = v_otherSpriteRenderer.sprite; //v_myRenderer.material = v_otherSpriteRenderer.material; } } } }