示例#1
0
    public void GrabFlag(IGrabable flag)
    {
        if (flag.GetTeam() == teamType)
        {
            return;
        }

        if ((flag.GetTransform().position - transform.position).magnitude > minFlagRange)
        {
            return;
        }

        if (flag.Grabbed())
        {
            return;
        }

        flag.GetTransform().SetParent(flagHolder);
        flag.GetTransform().localPosition = Vector3.zero;
        flag.GetTransform().localRotation = Quaternion.identity;

        flag.SetGrabbed(true);
        flag.GetTransform().GetComponent <BoxCollider>().enabled = false;

        flagTransform = flag.GetTransform();
    }