示例#1
0
    void Update()
    {
        ProcessAllTriggers();

        //Start Event
        if (!_actionTriggered && SupportedTriggers[0].Success && cursor.mode == cursor_handle.MODE.DEFAULT)
        {
            _actionTriggered = true;
            cursor.mode      = cursor_handle.MODE.ZOOM;
            ((ScaleTrigger)SupportedTriggers[1]).Restart = true;
            return;
        }

        //Stop Event
        if (_actionTriggered && SupportedTriggers[2].Success)
        {
            cursor.mode      = cursor_handle.MODE.DEFAULT;
            _actionTriggered = false;
        }

        if (!_actionTriggered)
        {
            return;
        }

        ScaleTrigger trgr = (ScaleTrigger)SupportedTriggers[1];

        if (trgr.Success)
        {
            _scale = trgr.Scale / ScaleDumpingFactor;

            //Keep it relative - for each axis, if rotation angle is 0 or if this is the first "frame" after a rotation angle is detected, save the data for next frame
            if (!ContinuousScale)
            {
                if (_scale == 0 || _lastScale == 0)
                {
                    _lastScale = _scale;
                }
                else
                {
                    _scale = _scale - _lastScale;
                }
            }

            if (ContinuousScale && ContinuousScaleSpeed != 0)
            {
                _scale = Mathf.Sign(_scale) * ContinuousScaleSpeed;
            }

            Vector3 scaleVector = this.gameObject.transform.localScale;

            float _scaleX = _scale;
            float _scaleY = _scale;
            float _scaleZ = _scale;

            //Make sure we didn't pass the max / min Scale
            if (Constraints.XScale.Max != 0)
            {
                if ((_scale + scaleVector.x) > Constraints.XScale.Max)
                {
                    _scaleX = Constraints.XScale.Max - scaleVector.x;
                }
            }
            if (Constraints.YScale.Max != 0)
            {
                if ((_scale + scaleVector.y) > Constraints.YScale.Max)
                {
                    _scaleY = Constraints.YScale.Max - scaleVector.y;
                }
            }
            if (Constraints.ZScale.Max != 0)
            {
                if ((_scale + scaleVector.z) > Constraints.ZScale.Max)
                {
                    _scaleZ = Constraints.ZScale.Max - scaleVector.z;
                }
            }

            if (Constraints.XScale.Min != 0)
            {
                if ((_scale + scaleVector.x) < Constraints.XScale.Min)
                {
                    _scaleX = Constraints.XScale.Min - scaleVector.x;
                }
            }
            if (Constraints.YScale.Min != 0)
            {
                if ((_scale + scaleVector.y) < Constraints.YScale.Min)
                {
                    _scaleY = Constraints.YScale.Min - scaleVector.y;
                }
            }
            if (Constraints.ZScale.Min != 0)
            {
                if ((_scale + scaleVector.z) < Constraints.ZScale.Min)
                {
                    _scaleZ = Constraints.ZScale.Min - scaleVector.z;
                }
            }

            //Enable / Disable Axis
            _scaleX = !Constraints.Freeze.X ? scaleVector.x + _scaleX : scaleVector.x;
            _scaleY = !Constraints.Freeze.Y ? scaleVector.y + _scaleY : scaleVector.y;
            _scaleZ = !Constraints.Freeze.Z ? scaleVector.z + _scaleZ : scaleVector.z;

            //Debug.Log (_scale);

            //Scale
            //this.gameObject.transform.localScale = new Vector3(_scaleX, _scaleY, _scaleZ);

            // our code
            //this.gameObject = new Vector3(_scaleX, 1, 1);

            /* TODO:
             * Closer the camera, more the pan speed.
             */
            if ((Camera.main.transform.position.y < 5.0f && _scaleX >= 0) || (Camera.main.transform.position.y > zoomOut && _scaleX <= 0))
            {
                return;
            }

            // Get mouse displacement vector from original to current position
            // Vector3 pos = Camera.main.ScreenToViewportPoint(Input.mousePosition - mouseOrigin);
            // Vector3 move = pos.y * zoomSpeed * transform.forward;
            Vector3 move = _scaleX * transform.forward;
            Debug.Log(_scaleX);
            // Set Drag
            rigidbody.drag = zoomDrag;

            // Zoom
            rigidbody.AddForce(move, ForceMode.Acceleration);


            if (ScaleDumpingFactor == 0)
            {
                Debug.LogError("ScaleDumpingFactor must not be zero. Changing it to 1");
                ScaleDumpingFactor = 1;
            }

            //Update last scaling
            _lastScale = trgr.Scale / ScaleDumpingFactor;
        }
    }
示例#2
0
    void Awake()
    {
        string path   = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/Geometry Dash RetroFunk/Created Levels/" + gameObject.GetComponent <ResourcesManager>().levelName + "/" + gameObject.GetComponent <ResourcesManager>().levelName + ".json";
        level  lvlObj = JsonUtility.FromJson <level>(File.ReadAllText(path));

        rM = GameObject.Find("ResourcesManager").GetComponent <ResourcesManager>();

        if (lvlObj.song.nameMp3 != null && lvlObj.song.nameWav != null)
        {
            GetSong songScript = GameObject.Find("GetSong").GetComponent <GetSong>();
            songScript.nameMp3 = lvlObj.song.nameMp3;
            songScript.nameWav = lvlObj.song.nameWav;
            songScript.StartDownload();
        }

        GameObject complete = GameObject.Find("LevelCompletedTrigger");

        if (lvlObj.levelComplete.position == new Vector3(0, 0, 0))
        {
            complete.transform.position = new Vector3(40, 15, 0);
        }
        else
        {
            complete.transform.position = lvlObj.levelComplete.position;
        }

        foreach (LevelObjects.Object m in lvlObj.objects)
        {
            GameObject p = Instantiate(objects[m.numberOfObject - 1]) as GameObject;
            p.name = "Object" + m.numberOfObject;
            p.transform.position   = m.position;
            p.transform.localScale = m.scale;
            p.transform.rotation   = m.rotation;
            p.GetComponent <ObjectPriorities>().group      = m.group;
            p.GetComponent <SpriteRenderer>().sortingOrder = m.layer;
            p.GetComponent <ObjectPriorities>().isOnCenter = m.IsOnCenter;
            p.GetComponent <SpriteRenderer>().color        = m.color;
        }
        foreach (LevelObjects.CustomObject1 m in lvlObj.customObject1)
        {
            GameObject p = Instantiate(CustomObject1) as GameObject;
            p.name = "CustomObject1";
            p.transform.position   = m.position;
            p.transform.localScale = m.scale;
            p.transform.rotation   = m.rotation;
            p.GetComponent <ObjectPriorities>().group      = m.group;
            p.GetComponent <SpriteRenderer>().sortingOrder = m.layer;
            p.transform.GetChild(0).GetComponent <SpriteRenderer>().sortingOrder = m.layer;
            p.GetComponent <ObjectPriorities>().isOnCenter      = m.IsOnCenter;
            p.GetComponent <SpriteRenderer>().color             = m.color;
            p.GetComponentInChildren <CustomObject>().nameImage = m.image;
            StartCoroutine(p.GetComponentInChildren <CustomObject>().DownloadImage(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/Geometry Dash RetroFunk/Created Levels/" + rM.levelName + "/Sprites/" + m.image));
        }
        foreach (LevelObjects.Spike1 m in lvlObj.spike1)
        {
            GameObject p = Instantiate(Spike1) as GameObject;
            p.name = "Spike1";
            p.transform.position   = m.position;
            p.transform.localScale = m.scale;
            p.transform.rotation   = m.rotation;
            p.GetComponent <ObjectPriorities>().group      = m.group;
            p.GetComponent <SpriteRenderer>().sortingOrder = m.layer;
            p.GetComponent <ObjectPriorities>().isOnCenter = m.IsOnCenter;
            p.GetComponent <SpriteRenderer>().color        = m.color;
        }
        foreach (LevelObjects.Cameras m in lvlObj.cameras)
        {
            GameObject c = GameObject.FindGameObjectWithTag("GameCamera");
            c.transform.position = m.position;
            c.transform.rotation = m.rotation;
            c.GetComponent <ObjectPriorities>().group      = m.group;
            c.GetComponent <ObjectPriorities>().isOnCenter = m.IsOnCenter;
        }
        foreach (LevelObjects.ColorTriggerJSON m in lvlObj.colorTrigger)
        {
            GameObject p = Instantiate(ColorTrigger) as GameObject;
            p.name = "ColorTrigger";
            ColorTrigger script = p.GetComponent <ColorTrigger>();
            p.transform.position = m.position;
            p.GetComponent <ObjectPriorities>().group = m.group;
            script.group   = m.group;
            script.seconds = m.seconds;
            script.r       = m.color.x;
            script.b       = m.color.z;
            script.g       = m.color.y;
            script.a       = m.color.w;
        }
        foreach (LevelObjects.MoveTriggerJSON m in lvlObj.moveTrigger)
        {
            GameObject p = Instantiate(MoveTrigger) as GameObject;
            p.name = "MoveTrigger";
            MoveTrigger script = p.GetComponent <MoveTrigger>();
            p.transform.position = m.position;
            p.GetComponent <ObjectPriorities>().group = m.group;
            script.group   = m.group;
            script.seconds = m.seconds;
            script.x       = m.x;
            script.y       = m.y;
            script.z       = m.z;
        }
        foreach (LevelObjects.RotateTriggerJSON m in lvlObj.rotateTrigger)
        {
            GameObject p = Instantiate(RotateTrigger) as GameObject;
            p.name = "RotateTrigger";
            RotateTrigger script = p.GetComponent <RotateTrigger>();
            p.transform.position = m.position;
            p.GetComponent <ObjectPriorities>().group = m.group;
            script.group          = m.group;
            script.groupObject    = m.groupObject;
            script.seconds        = m.seconds;
            script.x              = m.x;
            script.y              = m.y;
            script.z              = m.z;
            script.rotateInObject = m.rotateInObject;
        }
        foreach (LevelObjects.ScaleTriggerJSON m in lvlObj.scaleTrigger)
        {
            GameObject p = Instantiate(ScaleTrigger) as GameObject;
            p.name = "ScaleTrigger";
            ScaleTrigger script = p.GetComponent <ScaleTrigger>();
            p.transform.position = m.position;
            p.GetComponent <ObjectPriorities>().group = m.group;
            script.group   = m.group;
            script.seconds = m.seconds;
            script.x       = m.x;
            script.y       = m.y;
            script.z       = m.z;
        }
        foreach (LevelObjects.BloomTriggerJSON m in lvlObj.bloomTrigger)
        {
            GameObject p = Instantiate(BloomTrigger) as GameObject;
            p.name = "BloomTrigger";
            BloomTrigger script = p.GetComponent <BloomTrigger>();
            p.transform.position = m.position;
            script.seconds       = m.seconds;
            script.intensityGoal = m.intensity;
            script.thresholdGoal = m.threshold;
        }
        foreach (LevelObjects.TVTriggerJSON m in lvlObj.tvTrigger)
        {
            GameObject p = Instantiate(TVTrigger) as GameObject;
            p.name = "TVTrigger";
            TVTrigger script = p.GetComponent <TVTrigger>();
            p.transform.position  = m.position;
            script.seconds        = m.seconds;
            script.colorDriftGoal = m.colorDrift;
            script.scanLinesGoal  = m.scanLines;
        }
        foreach (LevelObjects.DisableEnableTriggerJSON m in lvlObj.disableEnableTrigger)
        {
            GameObject p = Instantiate(DisableEnableTrigger) as GameObject;
            p.name = "DisableEnableTrigger";
            DisableEnableTrigger script = p.GetComponent <DisableEnableTrigger>();
            p.transform.position = m.position;
            p.GetComponent <ObjectPriorities>().group = m.group;
            script.group           = m.group;
            script.disableOrEnable = m.disableOrEnable;
        }
        foreach (LevelObjects.FollowTriggerJSON m in lvlObj.followTrigger)
        {
            GameObject p = Instantiate(FollowTrigger) as GameObject;
            p.name = "FollowTrigger";
            FollowTrigger script = p.GetComponent <FollowTrigger>();
            p.transform.position = m.position;
            p.GetComponent <ObjectPriorities>().group = m.group;
            script.group         = m.group;
            script.groupToFollow = m.groupToFollow;
            script.follow        = m.follow;
        }
        foreach (LevelObjects.StartColorTriggerJSON m in lvlObj.startColorTrigger)
        {
            GameObject p = Instantiate(StartColorTrigger) as GameObject;
            p.name = "StartColorTrigger";
            StartColor script = p.GetComponent <StartColor>();
            p.transform.position = m.position;
            p.GetComponent <ObjectPriorities>().group = m.group;
            script.group      = m.group;
            script.groupColor = m.groupColor;
        }
        foreach (LevelObjects.KillZone m in lvlObj.killZone)
        {
            GameObject p = Instantiate(KillZone) as GameObject;
            p.name = "KillZone";
            p.transform.position   = m.position;
            p.transform.localScale = m.scale;
            p.transform.rotation   = m.rotation;
            p.GetComponent <ObjectPriorities>().group      = m.group;
            p.GetComponent <ObjectPriorities>().isOnCenter = m.IsOnCenter;
        }
    }
示例#3
0
    /// <summary>
    /// Update is called once per frame.
    /// </summary>
    void Update()
    {
        ProcessAllTriggers();

        //Start Event
        if (!_actionTriggered && SupportedTriggers[0].Success)
        {
            _actionTriggered = true;

            ((ScaleTrigger)SupportedTriggers[1]).Restart = true;
            return;
        }

        //Stop Event
        if (_actionTriggered && SupportedTriggers[2].Success)
        {
            _actionTriggered = false;
        }

        if (!_actionTriggered)
        {
            return;
        }

        ScaleTrigger trgr = (ScaleTrigger)SupportedTriggers[1];

        if (trgr.Success)
        {
            _scale = trgr.Scale / ScaleDumpingFactor;

            //Keep it relative - for each axis, if rotation angle is 0 or if this is the first "frame" after a rotation angle is detected, save the data for next frame
            if (!ContinuousScale)
            {
                if (_scale == 0 || _lastScale == 0)
                {
                    _lastScale = _scale;
                }
                else
                {
                    _scale = _scale - _lastScale;
                }
            }

            if (ContinuousScale && ContinuousScaleSpeed != 0)
            {
                _scale = Mathf.Sign(_scale) * ContinuousScaleSpeed;
            }

            Vector3 scaleVector = this.gameObject.transform.localScale;

            float _scaleX = _scale;
            float _scaleY = _scale;
            float _scaleZ = _scale;

            //Make sure we didn't pass the max / min Scale
            if (Constraints.XScale.Max != 0)
            {
                if ((_scale + scaleVector.x) > Constraints.XScale.Max)
                {
                    _scaleX = Constraints.XScale.Max - scaleVector.x;
                }
            }
            if (Constraints.YScale.Max != 0)
            {
                if ((_scale + scaleVector.y) > Constraints.YScale.Max)
                {
                    _scaleY = Constraints.YScale.Max - scaleVector.y;
                }
            }
            if (Constraints.ZScale.Max != 0)
            {
                if ((_scale + scaleVector.z) > Constraints.ZScale.Max)
                {
                    _scaleZ = Constraints.ZScale.Max - scaleVector.z;
                }
            }

            if (Constraints.XScale.Min != 0)
            {
                if ((_scale + scaleVector.x) < Constraints.XScale.Min)
                {
                    _scaleX = Constraints.XScale.Min - scaleVector.x;
                }
            }
            if (Constraints.YScale.Min != 0)
            {
                if ((_scale + scaleVector.y) < Constraints.YScale.Min)
                {
                    _scaleY = Constraints.YScale.Min - scaleVector.y;
                }
            }
            if (Constraints.ZScale.Min != 0)
            {
                if ((_scale + scaleVector.z) < Constraints.ZScale.Min)
                {
                    _scaleZ = Constraints.ZScale.Min - scaleVector.z;
                }
            }

            //Enable / Disable Axis
            _scaleX = !Constraints.Freeze.X ? scaleVector.x + _scaleX : scaleVector.x;
            _scaleY = !Constraints.Freeze.Y ? scaleVector.y + _scaleY : scaleVector.y;
            _scaleZ = !Constraints.Freeze.Z ? scaleVector.z + _scaleZ : scaleVector.z;

            //Scale

            this.gameObject.transform.localScale = new Vector3(_scaleX, _scaleY, _scaleZ);


            if (ScaleDumpingFactor == 0)
            {
                Debug.LogError("ScaleDumpingFactor must not be zero. Changing it to 1");
                ScaleDumpingFactor = 1;
            }

            //Update last scaling
            _lastScale = trgr.Scale / ScaleDumpingFactor;
        }
    }
示例#4
0
    public void saveFunction()
    {
        saveObjects = new Save();

        GetSong songScript = GameObject.Find("GetSong").GetComponent <GetSong>();

        LevelObjects.Song song = new LevelObjects.Song();
        song.nameMp3     = songScript.nameMp3;
        song.nameWav     = songScript.nameWav;
        saveObjects.song = song.getJSON();


        GameObject levelComplete = GameObject.Find("LevelCompletedTrigger");

        LevelObjects.LevelComplete complete = new LevelObjects.LevelComplete();
        complete.position         = levelComplete.transform.position;
        saveObjects.levelComplete = complete.getJSON();

        allObjects  = GameObject.FindGameObjectsWithTag("Objects");
        allCameras  = GameObject.FindGameObjectsWithTag("GameCamera");
        allTriggers = GameObject.FindGameObjectsWithTag("Trigger");

        foreach (GameObject m in allObjects)
        {
            if (m.name.Split(LevelObjects.numberChars, StringSplitOptions.None)[0] == "Object")
            {
                Debug.Log(m.name);
                ReturnPositionAfterPlay properties = m.GetComponent <ReturnPositionAfterPlay>();
                ObjectPriorities        priorities = m.GetComponent <ObjectPriorities>();
                Color color             = m.GetComponent <SpriteRenderer>().color;
                int   layer             = m.transform.GetComponent <SpriteRenderer>().sortingOrder;
                LevelObjects.Object obj = new LevelObjects.Object();
                obj.position       = properties.position;
                obj.scale          = properties.scale;
                obj.rotation       = properties.rotation;
                obj.group          = priorities.group;
                obj.layer          = layer;
                obj.IsOnCenter     = priorities.isOnCenter;
                obj.color          = color;
                obj.numberOfObject = int.Parse(m.name.Split(new string[] { "Object" }, StringSplitOptions.None)[1]);
                if (saveObjects.objects == null)
                {
                    saveObjects.objects += obj.getJSON();
                }
                else
                {
                    saveObjects.objects += "," + obj.getJSON();
                }
            }
            else if (m.name == "CustomObject1")
            {
                ReturnPositionAfterPlay properties = m.GetComponent <ReturnPositionAfterPlay>();
                ObjectPriorities        priorities = m.GetComponent <ObjectPriorities>();
                Color  color = m.GetComponent <SpriteRenderer>().color;
                int    layer = m.transform.GetComponent <SpriteRenderer>().sortingOrder;
                string image = m.GetComponentInChildren <CustomObject>().nameImage;
                LevelObjects.CustomObject1 obj = new LevelObjects.CustomObject1();
                obj.position   = properties.position;
                obj.scale      = properties.scale;
                obj.rotation   = properties.rotation;
                obj.group      = priorities.group;
                obj.layer      = layer;
                obj.IsOnCenter = priorities.isOnCenter;
                obj.color      = color;
                obj.image      = image;
                if (saveObjects.customObject1 == null)
                {
                    saveObjects.customObject1 += obj.getJSON();
                }
                else
                {
                    saveObjects.customObject1 += "," + obj.getJSON();
                }
            }
            else if (m.name == "Spike1")
            {
                ReturnPositionAfterPlay properties = m.GetComponent <ReturnPositionAfterPlay>();
                ObjectPriorities        priorities = m.GetComponent <ObjectPriorities>();
                Color color             = m.GetComponent <SpriteRenderer>().color;
                int   layer             = m.transform.GetComponent <SpriteRenderer>().sortingOrder;
                LevelObjects.Spike1 obj = new LevelObjects.Spike1();
                obj.position   = properties.position;
                obj.scale      = properties.scale;
                obj.rotation   = properties.rotation;
                obj.group      = priorities.group;
                obj.layer      = layer;
                obj.IsOnCenter = priorities.isOnCenter;
                obj.color      = color;
                if (saveObjects.spike1 == null)
                {
                    saveObjects.spike1 += obj.getJSON();
                }
                else
                {
                    saveObjects.spike1 += "," + obj.getJSON();
                }
            }
        }
        foreach (GameObject m in allCameras)
        {
            ReturnPositionAfterPlay properties = m.GetComponent <ReturnPositionAfterPlay>();
            ObjectPriorities        priorities = m.GetComponent <ObjectPriorities>();
            LevelObjects.Cameras    obj        = new LevelObjects.Cameras();
            obj.position   = properties.position;
            obj.rotation   = properties.rotation;
            obj.group      = priorities.group;
            obj.IsOnCenter = priorities.isOnCenter;
            if (saveObjects.cameras == null)
            {
                saveObjects.cameras += obj.getJSON();
            }
            else
            {
                saveObjects.cameras += "," + obj.getJSON();
            }
        }
        foreach (GameObject m in allTriggers)
        {
            Vector3 position = m.GetComponent <ReturnPositionAfterPlay>().position;
            if (m.name == "ColorTrigger")
            {
                ColorTrigger script = m.GetComponent <ColorTrigger>();
                LevelObjects.ColorTriggerJSON obj = new LevelObjects.ColorTriggerJSON();
                obj.position = position;
                obj.group    = script.group;
                obj.seconds  = script.seconds;
                obj.color    = script.colorFinish * 255;
                if (saveObjects.colorTrigger == null)
                {
                    saveObjects.colorTrigger += obj.getJSON();
                }
                else
                {
                    saveObjects.colorTrigger += "," + obj.getJSON();
                }
            }
            else if (m.name == "MoveTrigger")
            {
                MoveTrigger script = m.GetComponent <MoveTrigger>();
                LevelObjects.MoveTriggerJSON obj = new LevelObjects.MoveTriggerJSON();
                obj.position = position;
                obj.group    = script.group;
                obj.seconds  = script.seconds;
                obj.x        = script.x;
                obj.y        = script.y;
                obj.z        = script.z;
                if (saveObjects.moveTrigger == null)
                {
                    saveObjects.moveTrigger += obj.getJSON();
                }
                else
                {
                    saveObjects.moveTrigger += "," + obj.getJSON();
                }
            }
            else if (m.name == "RotateTrigger")
            {
                RotateTrigger script = m.GetComponent <RotateTrigger>();
                LevelObjects.RotateTriggerJSON obj = new LevelObjects.RotateTriggerJSON();
                obj.position       = position;
                obj.group          = script.group;
                obj.groupObject    = script.groupObject;
                obj.seconds        = script.seconds;
                obj.x              = script.x;
                obj.y              = script.y;
                obj.z              = script.z;
                obj.rotateInObject = script.rotateInObject;
                if (saveObjects.rotateTrigger == null)
                {
                    saveObjects.rotateTrigger += obj.getJSON();
                }
                else
                {
                    saveObjects.rotateTrigger += "," + obj.getJSON();
                }
            }
            else if (m.name == "ScaleTrigger")
            {
                ScaleTrigger script = m.GetComponent <ScaleTrigger>();
                LevelObjects.ScaleTriggerJSON obj = new LevelObjects.ScaleTriggerJSON();
                obj.position = position;
                obj.group    = script.group;
                obj.seconds  = script.seconds;
                obj.x        = script.x;
                obj.y        = script.y;
                obj.z        = script.z;
                if (saveObjects.scaleTrigger == null)
                {
                    saveObjects.scaleTrigger += obj.getJSON();
                }
                else
                {
                    saveObjects.scaleTrigger += "," + obj.getJSON();
                }
            }
            else if (m.name == "BloomTrigger")
            {
                BloomTrigger script = m.GetComponent <BloomTrigger>();
                LevelObjects.BloomTriggerJSON obj = new LevelObjects.BloomTriggerJSON();
                obj.position  = position;
                obj.intensity = script.intensityGoal;
                obj.threshold = script.thresholdGoal;
                obj.seconds   = script.seconds;
                if (saveObjects.bloomTrigger == null)
                {
                    saveObjects.bloomTrigger += obj.getJSON();
                }
                else
                {
                    saveObjects.bloomTrigger += "," + obj.getJSON();
                }
            }
            else if (m.name == "TVTrigger")
            {
                TVTrigger script = m.GetComponent <TVTrigger>();
                LevelObjects.TVTriggerJSON obj = new LevelObjects.TVTriggerJSON();
                obj.position   = position;
                obj.scanLines  = script.scanLinesGoal;
                obj.colorDrift = script.colorDriftGoal;
                obj.seconds    = script.seconds;
                if (saveObjects.tvTrigger == null)
                {
                    saveObjects.tvTrigger += obj.getJSON();
                }
                else
                {
                    saveObjects.tvTrigger += "," + obj.getJSON();
                }
            }
            else if (m.name == "DisableEnableTrigger")
            {
                DisableEnableTrigger script = m.GetComponent <DisableEnableTrigger>();
                LevelObjects.DisableEnableTriggerJSON obj = new LevelObjects.DisableEnableTriggerJSON();
                obj.position        = position;
                obj.group           = script.group;
                obj.disableOrEnable = script.disableOrEnable;
                if (saveObjects.disableEnableTrigger == null)
                {
                    saveObjects.disableEnableTrigger += obj.getJSON();
                }
                else
                {
                    saveObjects.disableEnableTrigger += "," + obj.getJSON();
                }
            }
            else if (m.name == "FollowTrigger")
            {
                FollowTrigger script = m.GetComponent <FollowTrigger>();
                LevelObjects.FollowTriggerJSON obj = new LevelObjects.FollowTriggerJSON();
                obj.position      = position;
                obj.group         = script.group;
                obj.groupToFollow = script.groupToFollow;
                obj.follow        = script.follow;
                if (saveObjects.followTrigger == null)
                {
                    saveObjects.followTrigger += obj.getJSON();
                }
                else
                {
                    saveObjects.followTrigger += "," + obj.getJSON();
                }
            }
            else if (m.name == "StartColorTrigger")
            {
                StartColor script = m.GetComponent <StartColor>();
                LevelObjects.StartColorTriggerJSON obj = new LevelObjects.StartColorTriggerJSON();
                obj.position   = position;
                obj.group      = script.group;
                obj.groupColor = script.groupColor;
                if (saveObjects.startColorTrigger == null)
                {
                    saveObjects.startColorTrigger += obj.getJSON();
                }
                else
                {
                    saveObjects.startColorTrigger += "," + obj.getJSON();
                }
            }
            else if (m.name == "KillZone")
            {
                ReturnPositionAfterPlay properties = m.GetComponent <ReturnPositionAfterPlay>();
                ObjectPriorities        priorities = m.GetComponent <ObjectPriorities>();
                LevelObjects.KillZone   obj        = new LevelObjects.KillZone();
                obj.position   = properties.position;
                obj.scale      = properties.scale;
                obj.rotation   = properties.rotation;
                obj.group      = priorities.group;
                obj.IsOnCenter = priorities.isOnCenter;
                if (saveObjects.killZone == null)
                {
                    saveObjects.killZone += obj.getJSON();
                }
                else
                {
                    saveObjects.killZone += "," + obj.getJSON();
                }
            }
        }
        ResourcesManager path = gameObject.GetComponent <ResourcesManager>();
        string           json = "{" +
                                saveObjects.getAllObjects()
                                + "}";
        string jsonPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/Geometry Dash RetroFunk/Created Levels/" + path.levelName + "/" + path.levelName + ".json";

        File.WriteAllText(jsonPath, json);
    }