// Use this for initialization
        private void Start()
        {
            LaunchScriptRef = gameObject.GetComponent <MissileLaunchScript>();
            screenHeight    = Screen.height;
            screenWidth     = Screen.width;

            guiControlsLeftRect = new Rect(10, 10, 250, screenHeight);
            guiControlsTopRect  = new Rect(screenWidth / 4, 5, 500, 60);

            // Set up some demo scene defaults
            swarmMissilesOutward      = true;
            useLauncherNodes          = true;
            stagedMissileLaunch       = true;
            MissileRandomnessOnLaunch = true;
        }
        private static GameObject CreateAndConfigureMissileLauncherNode(string name, SerializedProperty launcherNodeSpriteProp, MissileLaunchScript launchScript, MissileLauncherNode.MissileNodeDirection direction, float offsetDistance,
                                                                        float launcherNodeOffsetRandomXAmount, float launcherNodeOffsetRandomYAmount, bool applyRandomness)
        {
            var launcherNodeGo = new GameObject(name);

            launcherNodeGo.transform.parent = launchScript.transform;

            var missileLauncherNodeRef = launcherNodeGo.AddComponent <MissileLauncherNode>();

            if (missileLauncherNodeRef != null)
            {
                missileLauncherNodeRef.MissileNodeDirectionSetting          = direction;
                missileLauncherNodeRef.nodeMissileSwarmTargetOffsetDistance = offsetDistance;
                missileLauncherNodeRef.applyLauncherNodeRandomness          = applyRandomness;
                missileLauncherNodeRef.launcherNodeOffsetRandomXAmount      = launcherNodeOffsetRandomXAmount;
                missileLauncherNodeRef.launcherNodeOffsetRandomYAmount      = launcherNodeOffsetRandomYAmount;
            }

            // Add sprite to the launcher node GameObject and set layer order.
            var spriteRef  = launcherNodeGo.AddComponent <SpriteRenderer>();
            var nodeSprite = (Sprite)launcherNodeSpriteProp.objectReferenceValue;

            if (nodeSprite != null)
            {
                spriteRef.sprite = (Sprite)launcherNodeSpriteProp.objectReferenceValue;
                var parentSpriteRenderer = launchScript.GetComponent <SpriteRenderer>();
                if (parentSpriteRenderer != null)
                {
                    spriteRef.sortingLayerName = parentSpriteRenderer.sortingLayerName;
                    spriteRef.sortingOrder     = parentSpriteRenderer.sortingOrder + 1;
                }
            }

            launcherNodeGo.transform.localPosition = Vector2.zero;

            return(launcherNodeGo);
        }