예제 #1
0
    // Use this for initialization
    void Start()
    {
        _target = false;
        _childSpriteRenderer = this.transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>();
        _childAnimator       = this.transform.GetChild(0).gameObject.GetComponent <Animator>();
        stunnedVisualEffect  = this.transform.GetChild(0).gameObject.GetComponent <_2dxFX_Lightning>();
        _rb = this.GetComponent <Rigidbody2D>();
        xInitialBeforeFollow = transform.position.x;

        _eEpunamunState = EEpunamunState.PATROL;


        // 1 Para mirar a la derecha
        // -1 Para mirar a la izquierda
        _direction = 1;
        _childAnimator.SetTrigger("Walk");
    }
    public override void OnInspectorGUI()
    {
        m_object.Update();
        DrawDefaultInspector();

        _2dxFX_Lightning _2dxScript = (_2dxFX_Lightning)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("_Value1"), new GUIContent("Lightning Speed", icone, "Change the fire speed"));

            icone = Resources.Load("2dxfx-icon-brightness") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("_Value2"), new GUIContent("Lightning Intensity", icone, "Change the fire light intensity"));



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