コード例 #1
0
ファイル: SimplePlayerHealth.cs プロジェクト: seyoungChu/fc02
    public override void TakeDamage(Vector3 location, Vector3 direction, float damage, Collider bodyPart, GameObject origin)
    {
        health -= damage;

        if (hurtPrefab && canvas)
        {
            hurtUI.DrawHurtUI(origin.transform, origin.GetHashCode());
        }
    }
コード例 #2
0
    public override void TakeDamage(Vector3 location, Vector3 direction, float damage, Collider bodyPart = null, GameObject origin = null)
    {
        health -= damage;
        UpdateHealthBar();

        if (hurtPrefab && healthHUD)
        {
            hurtHUD.DrawHurtUI(origin.transform, origin.GetHashCode());
        }

        if (health <= 0)
        {
            Kill();
        }
        else if (health <= criticalHealth && !critical)
        {
            critical = true;
            criticalHUD.StartBlink();
        }

        SoundManager.Instance.PlayOneShotEffect((int)hitSound, location, 1f);
    }
コード例 #3
0
ファイル: PlayerHealth.cs プロジェクト: Hengle/Project-SS
    public override void TakeDamage(Vector3 location, Vector3 direction, float damage, Collider bodyPart = null, GameObject origin = null)
    {
        health -= damage;

        UpdateHealthBar();

        if (hurtPrefab && healthHUD)
        {
            hurtHUD.DrawHurtUI(origin.transform, origin.GetHashCode());
        }

        if (health <= 0)
        {
            Kill();
        }
        else if (health <= criticalHealth && !critical)
        {
            critical = true;
            criticalHud.StartBlink();
        }

        AudioSource.PlayClipAtPoint(hitClips[Random.Range(0, hitClips.Length)], location, 0.1f);
    }