Esempio n. 1
0
    // This function is called just one time by Unity the moment the game loads
    private void Awake()
    {
        //Set the current player's input dictionary to match what is assigned to that player.
        if (whichPlayer == 1)
        {
            inputK = Globals.inputK1;
            inputJ = Globals.inputJ1;
        }

        //Set the current player's input dictionary to match what is assigned to that player.
        if (whichPlayer == 2)
        {
            inputK = Globals.inputK2;
            inputJ = Globals.inputJ2;
        }

        // get a reference to the SpriteRenderer component on this gameObject
        spriteRenderer = GetComponent <SpriteRenderer>();
        animator       = GetComponent <Animator>();
        rigidBody      = GetComponent <Rigidbody2D>();

        //Sounds
        source = GetComponent <AudioSource>();

        //Shader
        effectShader = GetComponent <_2dxFX_Hologram3>();
    }
Esempio n. 2
0
    public override void OnInspectorGUI()
    {
        m_object.Update();
        DrawDefaultInspector();

        _2dxFX_Hologram3 _2dxScript = (_2dxFX_Hologram3)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-time") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("Speed"), new GUIContent("Time Speed", icone, "Change the time speed"));
            icone = Resources.Load("2dxfx-icon-distortion") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("Distortion"), new GUIContent("Distortion", icone, "Change the distortion"));
            icone = Resources.Load("2dxfx-icon-color") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_ColorX"), new GUIContent("Change the color", icone, "Change the color of the sprite"));

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