Example #1
0
    private void Awake()
    {
        distortionEffect = GetComponent <_2dxFX_Distortion_Additive>();
        AdjustRadius();
        warningColor = new Color32(255, 0, 63, 255);
        particleSystemGameObjectsToScale.Add(standardStarParticlesGO);
        particleSystemGameObjectsToScale.Add(starTooBigGO);
        particleSystemGameObjectsToScale.Add(starUltraNovaGO);

        doomColor                   = Color.red;
        playerHealth                = GameObject.Find("Player").GetComponent <PlayerHealth>();
        illuminationLossLap         = 30.0f;
        holdMaxIlluminationDuration = 30.0f;
        blackHoleEffect             = GetComponent <_2dxFX_BlackHole>();
        blackHoleForce              = GetComponent <PointEffector2D>();
        area           = GetComponent <CircleCollider2D>();
        DarkStarSprite = GetComponent <SpriteRenderer>().sprite;
        //       openStarParticles = openStarGO.GetComponentsInChildren<ParticleSystem>().ToList();
        ourAnimations = GetComponent <DarkStarAnimations>();
        // maxIlluminationParticles = maxIlluminationGO.GetComponentsInChildren<ParticleSystem>().ToList();

        //here we're connecting it so that when it touches the rim of being too big, it starts a countdown
        DarkStarTooBig.DarkStarReachedTooLargeBounds += BeginOvercharge;
        DarkStarTooBig.DarkStarReceeded += this.CancelOvercharge;
        DarkStarTooBig.DarkStarReachedTooLargeBounds += StartDistortionEffect;
        DarkStarTooBig.DarkStarReceeded += this.StopDistortionEffect;
    }
    public override void OnInspectorGUI()
    {
        m_object.Update();
        DrawDefaultInspector();

        _2dxFX_Distortion_Additive _2dxScript = (_2dxFX_Distortion_Additive)target;

        Texture2D icon = Resources.Load("2dxfxinspector") as Texture2D;

        if (icon)
        {
            Rect  r;
            float ih     = icon.height;
            float iw     = icon.width;
            float result = ih / iw;
            float w      = Screen.width;
            result = result * w;
            r      = GUILayoutUtility.GetRect(ih, result);
            EditorGUI.DrawTextureTransparent(r, icon);
        }

        EditorGUILayout.PropertyField(m_object.FindProperty("ForceMaterial"), new GUIContent("Shared Material", "Use a unique material, reduce drastically the use of draw call"));

        if (_2dxScript.ForceMaterial == null)
        {
            _2dxScript.ActiveChange = true;
        }
        else
        {
            if (GUILayout.Button("Remove Shared Material"))
            {
                _2dxScript.ForceMaterial = null;
                _2dxScript.ShaderChange  = 1;
                _2dxScript.ActiveChange  = true;
                _2dxScript.CallUpdate();
            }

            EditorGUILayout.PropertyField(m_object.FindProperty("ActiveChange"), new GUIContent("Change Material Property", "Change The Material Property"));
        }

        if (_2dxScript.ActiveChange)
        {
            EditorGUILayout.BeginVertical("Box");

            Texture2D icone = Resources.Load("2dxfx-icon-clip_left") as Texture2D;

            EditorGUILayout.PropertyField(m_object.FindProperty("_OffsetX"), new GUIContent("Offset X", icone, "Change the offset of X"));
            icone = Resources.Load("2dxfx-icon-clip_right") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_OffsetY"), new GUIContent("Offset Y", icone, "Change the offset of Y"));
            icone = Resources.Load("2dxfx-icon-size_x") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_DistanceX"), new GUIContent("Distance X", icone, "Change the distance of X"));
            icone = Resources.Load("2dxfx-icon-size_y") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_DistanceY"), new GUIContent("Distance Y", icone, "Change the distance of Y"));
            icone = Resources.Load("2dxfx-icon-time") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_WaveTimeX"), new GUIContent("Wave Time X", icone, "Change the time speed of the wave X"));
            icone = Resources.Load("2dxfx-icon-time") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_WaveTimeY"), new GUIContent("Wave Time Y", icone, "Change the time speed of the wave Y"));
            icone = Resources.Load("2dxfx-icon-time") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("AutoPlayWaveX"), new GUIContent("Active AutoPlay Wave X", icone, "Active the time speed"));
            if (_2dxScript.AutoPlayWaveX)
            {
                icone = Resources.Load("2dxfx-icon-time") as Texture2D;
                EditorGUILayout.PropertyField(m_object.FindProperty("AutoPlaySpeedX"), new GUIContent("AutoPlay Speed X", icone, "Speed of the auto play X"));
            }
            icone = Resources.Load("2dxfx-icon-time") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("AutoPlayWaveY"), new GUIContent("Active AutoPlay Wave Y", icone, "Active the time speed"));
            if (_2dxScript.AutoPlayWaveY)
            {
                icone = Resources.Load("2dxfx-icon-time") as Texture2D;
                EditorGUILayout.PropertyField(m_object.FindProperty("AutoPlaySpeedY"), new GUIContent("AutoPlay Speed Y", icone, "Speed of the auto play Y"));
            }
            icone = Resources.Load("2dxfx-icon-pixel") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("AutoRandom"), new GUIContent("Auto Random", icone, "Active the random value"));
            if (_2dxScript.AutoRandom)
            {
                icone = Resources.Load("2dxfx-icon-value") as Texture2D;
                EditorGUILayout.PropertyField(m_object.FindProperty("AutoRandomRange"), new GUIContent("Auto Random Range", icone, "Change the random value"));
            }

            EditorGUILayout.BeginVertical("Box");



            icone = Resources.Load("2dxfx-icon-fade") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Alpha"), new GUIContent("Fading", icone, "Fade from nothing to showing"));

            EditorGUILayout.EndVertical();
            EditorGUILayout.EndVertical();
        }

        m_object.ApplyModifiedProperties();
    }