예제 #1
0
    IEnumerator KillThisThing(timedObjectDestroyer script, float delay)
    {
        killing = true;
        script.KillMe();
        yield return(new WaitForSeconds(delay));

        killing = false;
    }
예제 #2
0
    private void Update()
    {
        if (obj != gameObject.GetComponent <Hand>().currentAttachedObject)
        {
            obj = gameObject.GetComponent <Hand>().currentAttachedObject;

            if (obj != null)
            {
                timedDestroy = obj.GetComponent <timedObjectDestroyer>();

                if (timedDestroy != null)
                {
                    if (timedDestroy.isDying())
                    {
                        timedDestroy.SaveMe();
                    }
                }
            }
        }
    }
예제 #3
0
    void OnCollisionEnter(Collision col)
    {
        var allList = GameManager.gm.goodItems.Concat(GameManager.gm.badItems);

        if (allList.Contains(col.gameObject.tag))
        {
            if (col.gameObject.CompareTag("jug"))
            {
                if (!destroying)
                {
                    StartCoroutine(DestroyJug(col.gameObject, 0.1f));
                }
            }
            else
            {
                if (!killing)
                {
                    timedObjectDestroyer timedDestory = col.gameObject.GetComponent <timedObjectDestroyer>();
                    StartCoroutine(KillThisThing(timedDestory, 0.25f));
                }
            }
        }
    }