Example #1
0
    /*void OnCollisionEnter(Collision other)
     * {
     *
     *
     *  if (other.gameObject.CompareTag("black"))
     *  {
     *
     *      destroyFn();
     *  }
     *
     * }*/
    public void destroyFn()
    {
        //Debug.Log(planedestroyed);
        if (planedestroyed == false)
        {
            orignalPos = transform.position;
            soundManager sm = GameObject.FindObjectOfType(typeof(soundManager)) as soundManager;
            sm.destroyFn();
            planedestroyed     = true;
            myCollider.enabled = false;
            GameObject go = Instantiate(BlastEffect, transform.position, transform.rotation);
            Destroy(go, 2f);
            GameObject go2 = Instantiate(blastEff2, transform.position, transform.rotation);
            Destroy(go2, 2f);
            cameraFollow.followPlayer = false;
            manager.gameStart         = false;
            // gameObject.SetActive(false);
            for (int i = 0; i < myParts.Length; i++)
            {
                myParts[i].SetActive(false);
            }

            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                //no internet
                manager mn = GameObject.FindObjectOfType(typeof(manager)) as manager;
                mn.RestartScreenFn();
            }
            else
            {
                if (onlyOnce == false)
                {
                    onlyOnce = true; Invoke("callForContinueScreen", 1f);
                }
                else
                {
                    manager mn = GameObject.FindObjectOfType(typeof(manager)) as manager;
                    mn.RestartScreenFn();
                }
            }
        }
    }