Пример #1
0
    public void GrabDisc(Player player, bool force = false)
    {
        if (hasDisc == null || force)
        {
            currentDisc.GetComponent <Collider>().enabled = true;

            Physics.IgnoreCollision(player.GetComponent <Collider>(), currentDisc.GetComponent <Collider>());
            if (lastHadDisc != null)
            {
                Physics.IgnoreCollision(lastHadDisc.GetComponent <Collider>(), currentDisc.GetComponent <Collider>(), false);
            }

            hasDisc     = player;
            lastHadDisc = player;

            player.ConfirmHasDisc(currentDisc);

            currentDisc.Catch();

            currentDisc.GetComponent <Rigidbody>().isKinematic = true;
            currentDisc.transform.position = player.transform.position + Vector3.forward * 0.4f + Vector3.right * 0.4f;

            playerTeam.OnDiscCatch(player);
            aiTeam.OnDiscCatch(player);

            if (player.MyTeam.UpfieldDir == currentDisc.CurrentEndzone)
            {
                Touchdown();
            }
        }
    }