コード例 #1
0
        /// <summary>
        /// Grabs useful components, enables damage and gets the inital color
        /// </summary>
        protected override void Initialization()
        {
            _animator = GetComponent <Animator>();
            if (_animator != null)
            {
                _animator.logWarnings = false;
            }



            _character = GetComponent <Character>();
            if (gameObject.GetComponentNoAlloc <SpriteRenderer>() != null)
            {
                _renderer = GetComponent <SpriteRenderer>();
                _renderer.material.color = Color.white;
            }
            if (_character != null)
            {
                if (_character.CharacterModel != null)
                {
                    if (_character.CharacterModel.GetComponentInChildren <Renderer>() != null)
                    {
                        _renderer = _character.CharacterModel.GetComponentInChildren <Renderer>();
                    }
                }
            }
            _autoRespawn = GetComponent <AutoRespawn>();
            _controller  = GetComponent <CorgiController>();
            _healthBar   = GetComponent <MMHealthBar>();
            _collider2D  = GetComponent <Collider2D>();

            _sprite             = gameObject.GetComponent <SpriteRenderer>();
            _characterInventory = GetComponent <LucyInventory>();
            _damageSpriteEffect = GetComponent <_2dxFX_CompressionFX>();


            _initialPosition = transform.position;
            _initialized     = true;
            CurrentHealth    = InitialHealth;
            DamageEnabled();

            // _characterInventory.CheckPowerNodeInventories();
            UpdateHealthBar(false);
            UpdateHealthCounter(CurrentHealth);

            //absolute bandaid for issue where GUI says health is 10 when actully full. Only when starting a scene in area 3 and 5.
            StartCoroutine(WaitAFrameAndCheckHealth());

            InitializeSpriteColor();
        }
コード例 #2
0
ファイル: _2dxFX_CompressionFX.cs プロジェクト: poup/ankagaja
    public override void OnInspectorGUI()
    {
        m_object.Update();
        DrawDefaultInspector();

        _2dxFX_CompressionFX _2dxScript = (_2dxFX_CompressionFX)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-value") as Texture2D;
            EditorGUILayout.PropertyField(m_object.FindProperty("Parasite"), new GUIContent("Parasite Value", icone, "Change the size of the parasite FX"));



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