Ejemplo n.º 1
0
    void IDamageable.TakeDamage(Damager damager)
    {
        if (myStats.health > 0 && !isIndestructable)
        {
            DoHitReaction(damager);
            myStats.TakeDamage(damager.damage);
            damagePack.Set(damager, damaged);
            SFXManager.Instance.Play(hitSFX, transform.position);
            GoreManager.Instance.EmitDirectionalBlood(damagePack);

            // Blood effect
            GameObject blood = ObjectPool.Instance.GetObject(PoolObjectType.VFXBloodSpurt);
            if (blood)
            {
                blood.transform.position = transform.position;
            }

            if (myStats.health <= 0 || myStats.health <= myStats.skinnableHealth)
            {
                alreadyStunned = true;
            }
        }

        if (alreadyStunned)
        {
            if (!isStunFlashing)
            {
                hitFlasher.SetStunnedState();
                isStunFlashing = true;
            }
        }
        else
        {
            if (!isStunFlashing)
            {
                hitFlasher.HitFlash();
            }
        }
    }
Ejemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        HitFlasher hitFlasher = target as HitFlasher;

        if (Application.isPlaying)
        {
            EditorGUILayout.Space();

            if (GUILayout.Button("Flash"))
            {
                hitFlasher.HitFlash();
            }

            if (GUILayout.Button("Test Stun Flashing"))
            {
                hitFlasher.SetStunnedState();
            }
        }
    }