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;
    }
Example #2
0
    public override void OnInspectorGUI()
    {
        m_object.Update();
        DrawDefaultInspector();

        _2dxFX_BlackHole _2dxScript = (_2dxFX_BlackHole)target;

        Texture2D icon = Resources.Load("2dxfxinspector-anim") 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-distortion") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("Distortion"), new GUIContent("Distortion", icone, "Change the distortion size"));

            icone = Resources.Load("2dxfx-icon-size") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Hole"), new GUIContent("Hole", icone, "Change the size of the hole"));

            icone = Resources.Load("2dxfx-icon-time") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("Speed"), new GUIContent("Speed", icone, "Change the speed of the hole"));

            icone = Resources.Load("2dxfx-icon-color") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Color"), new GUIContent("Color", icone, "Change the color of the black hole"));

            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();
    }