示例#1
0
    public void Dead()
    {
        isDead = true;
        if (isPlayer)
        {
            LayerMask    mask = LayerMask.GetMask("enemy");
            RaycastHit2D hit  = Physics2D.Raycast(new Vector2(transform.position.x, transform.position.y), new Vector2(isFacingRight ? 1 : -1, 0), 1f, mask);
            AnimatorRunner.Run(animator, Constants.AnimationTuples.deadAnimation);
        }
        else
        {
            LayerMask    mask = LayerMask.GetMask("weapon");
            RaycastHit2D hit  = Physics2D.Raycast(new Vector2(transform.position.x, transform.position.y), new Vector2(isFacingRight ? 1 : -1, 0), 0.1f, mask);

            GameObject arrow = hit.collider.gameObject.transform.root.gameObject;
            Debug.Log("arrow" + arrow);
            arrow.transform.parent = this.spineNode;
            ArrowScript arrowScript = arrow.GetComponent <ArrowScript> ();
            arrowScript.StopMoving();
            AnimatorRunner.Run(animator, Constants.AnimationTuples.deadAnimation);
        }
    }