示例#1
0
    private void handleDrop()
    {
        var colliders = Physics.OverlapSphere(grabPoint.position, grabRadius);

        foreach (var collider in colliders)
        {
            if (collider.tag == parentTag)
            {
                var component        = collider.GetComponent <MiserableParent>();
                var childWasApproved = component.offerChild(heldItem.GetComponent <ToddlerInfo>().toddlerInfo, playerName);

                Debug.Log("childWasApproved");
                Debug.Log(childWasApproved);
                if (childWasApproved)
                {
                    Destroy(heldItem);
                    ChildMachine.deleteChild();
                }
                else
                {
                    this.Yeeeeet(heldItem, -1);
                }

                heldItem   = null;
                isCarrying = false;

                return;
            }
        }

        this.Yeeeeet(heldItem, 1);

        isCarrying = false;
        heldItem   = null;
    }
示例#2
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
示例#3
0
 void Update()
 {
     t -= Time.deltaTime;
     if (t < 0f)
     {
         ChildMachine.deleteChild();
         Destroy(gameObject);
     }
     Destroy(gameObject.GetComponent <Rigidbody>());
     transform.position = Vector3.Slerp(sinkStart, sinkEnd, (timeToLive - t) / timeToLive);
 }
示例#4
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == toddlerTag)
        {
            ps.Play();
            other.gameObject.AddComponent <ConsumeChild>();
            eatenChildren += 1;

            if (eatenChildren >= oksennusLimit)
            {
                ChildMachine.spawnChaos();
                eatenChildren -= oksennusLimit;
            }
        }
    }