Пример #1
0
    private void OnCollisionEnter(Collision collision)
    {
        GameObject collidedObject = collision.gameObject;
        Branch     branch         = collidedObject.GetComponent <Branch>();

        if (branch != null)
        {
            shader.animate = true;
            // tell the house manager how much to decrement branchCount by
            houseManager.DestroyHouse(branch.antiValue);
            // remove the branch prefab
            Destroy(collidedObject);

            // play trash can sound
            audioSource.PlayOneShot(trashcanSound, 10f);
        }

        if (collidedObject.GetComponent <PlayerController>())
        {
            collidingObjects.Add(collidedObject);
        }
    }
Пример #2
0
 public void DestroyHouse(int numToDecrBy)
 {
     houseManager.DestroyHouse(numToDecrBy);
 }