Beispiel #1
0
    void OnTriggerEnter(Collider other)
    {
        GameObject otherGameObject = other.gameObject;

        if (!other.CompareTag("WellPuppy") || other.isTrigger || accepting == otherGameObject || rejecting.Contains(otherGameObject))
        {
            return;
        }

        WellPuppy wellPuppy = other.GetComponentInParent <WellPuppy>();

        if (playerController.IsCarryingObject(wellPuppy))
        {
            wellPuppyInTrigger = wellPuppy;
            return;
        }

        other.gameObject.layer = layerSelfOnly;
        wellPuppy.SetInteractionEnabled(false);

        string otherName = otherGameObject.transform.parent.name;

        if (IsCurrentMaterial(colorDeactivated) ||
            (accepting == null && ((IsCurrentMaterial(colorOneMaterial) && otherName.StartsWith(colorOnePrefix)) ||
                                   (IsCurrentMaterial(colorTwoMaterial) && otherName.StartsWith(colorTwoPrefix)))))
        {
            StartCoroutine(Accept(otherGameObject));
        }
        else
        {
            StartCoroutine(Reject(other));
        }
    }
Beispiel #2
0
    private void teleportPuppy(WellPuppy puppy)
    {
        Rigidbody puppyBody = puppy.GetComponent <Rigidbody>();

        puppyBody.MovePosition(location.position);
        puppyBody.velocity = Vector3.zero;
    }
Beispiel #3
0
 void Update()
 {
     if (carriedPuppyInNet != null && !playerController.IsCarryingObject(carriedPuppyInNet))
     {
         teleportPuppy(carriedPuppyInNet);
         carriedPuppyInNet = null;
     }
 }
Beispiel #4
0
    void OnTriggerExit(Collider other)
    {
        if (wellPuppyInTrigger == null)
        {
            return;
        }

        WellPuppy wellPuppy = other.GetComponentInParent <WellPuppy>();

        if (wellPuppy == wellPuppyInTrigger)
        {
            wellPuppyInTrigger = null;
        }
    }
Beispiel #5
0
    void OnTriggerExit(Collider other)
    {
        if (!other.CompareTag("WellPuppy"))
        {
            return;
        }

        WellPuppy puppy = other.GetComponentInParent <WellPuppy>();

        if (puppy == carriedPuppyInNet)
        {
            carriedPuppyInNet = null;
        }
    }
Beispiel #6
0
    void OnTriggerEnter(Collider other)
    {
        if (!other.CompareTag("WellPuppy"))
        {
            return;
        }
        WellPuppy puppy = other.GetComponentInParent <WellPuppy>();

        if (puppy != null)
        {
            if (playerController.IsCarryingObject(puppy))
            {
                carriedPuppyInNet = puppy;
            }
            else
            {
                teleportPuppy(puppy);
            }
        }
    }