示例#1
0
    void SetHitBox()
    {
        float rotation = aifollow.GetRotation();

        if ((rotation >= 315f && rotation <= 0f) || rotation < 45f)
        {
            this.GetComponent <CapsuleCollider>().center = new Vector3(1f, 0f, 1f);
        }
        else if (rotation >= 45f && rotation < 135f)
        {
            this.GetComponent <CapsuleCollider>().center = new Vector3(1f, 0f, 1f);
        }
        else if (rotation >= 135f && rotation < 225f)
        {
            this.GetComponent <CapsuleCollider>().center = new Vector3(-1f, 0f, 1f);
        }
        else // rotation >= 225f && rotation < 315f
        {
            this.GetComponent <CapsuleCollider>().center = new Vector3(-1f, 0f, 1f);
        }
    }