示例#1
0
    public void TakeDamage(DamageInfo damageInfo)
    {
        animator.SetTrigger("GetHit" + damageInfo.GetOrthagonalDirectionName(transform));
        hitPoint -= damageInfo.damageAmount;


        int    damageDirection = damageInfo.GetOrthagonalDirection(transform);
        string effectsName     = "PointWeaponHit";

        if (damageInfo.type == DamageType.Slash)
        {
            effectsName = "SlashWeaponHit";
        }

        Vector3    damagePos = transform.position + new Vector3(0.0f, 1.5f, 0.0f);
        Quaternion damageRot = Quaternion.AngleAxis(damageDirection * 90, Vector3.up);

        Instantiate(gameManager.GetPrefab(effectsName), damagePos, damageRot);


        if (hitPoint < 0)
        {
            Die();
        }
    }