Exemplo n.º 1
0
    private void OnHit(GameObject other)
    {
        IShootable shootable = other.GetComponent <IShootable>();

        if (shootable != null)
        {
            // Hit an enemy
            shootable.GetShot(damage);
            animator.SetBool("bleed", true);

            if (followObj != null)
            {
                Vector3 offset = transform.position - other.transform.position;
                followObj.SetOffset(offset);
                followObj.SetTarget(other.transform);
                followObj.Enable();
            }
        }
        else
        {
            // Hit something other than an enemy
            // Walls, doors, etc.
            // In this case the animation is stationary
            animator.SetBool("spark", true);
        }
    }
Exemplo n.º 2
0
    public void OnHit(GameObject other, bool isBlood)
    {
        if (isBlood)
        {
            animator.SetBool("impact_blood", true);
        }
        else
        {
            animator.SetBool("impact_spark", true);
        }

        // arrow animation follows actor it hit
        if (followObj != null)
        {
            Vector3 offset = transform.position - other.transform.position;
            followObj.SetOffset(offset);
            followObj.SetTarget(other.transform);
            followObj.Enable();
        }
    }