Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (BGScript.getIsFalling())
        {
            col.enabled = true;
        }
        else
        {
            col.enabled = false;
        }


        if (BGScript.getisAlive() == false)
        {
            col.enabled = false;
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (BGScript.getIsFalling() || BGScript.getisAlive() == false)
        {
            //	col.enabled = false;
            col.isTrigger = true;
        }
        else
        {
            //col.enabled = true;
            col.isTrigger = false;
        }

        if (BGScript.getisAlive() == false)
        {
            GameObject[] enemies = GameObject.FindGameObjectsWithTag("BreakableGravity");

            foreach (GameObject en in enemies)
            {
                if (en.GetComponent <CharacterController> () != gameObject.transform.parent.gameObject.GetComponent <CharacterController> ())
                {
                    Physics.IgnoreCollision(gameObject.transform.parent.gameObject.GetComponent <CharacterController> (), en.GetComponent <CharacterController> ());
                }
            }
        }
        else
        {
            /*
             * GameObject[] enemies = GameObject.FindGameObjectsWithTag ("BreakableGravity");
             *
             * foreach (GameObject en in enemies) {
             *      if (en.GetComponent<CharacterController> () != gameObject.transform.parent.gameObject.GetComponent<CharacterController> ()) {
             *              Physics.IgnoreCollision (gameObject.transform.parent.gameObject.GetComponent<CharacterController> (), en.GetComponent<CharacterController> (), false);
             *      }
             * }
             */
        }

        /*
         * if (BGScript.getisAlive() == false){
         *      col.enabled = false;
         * }
         */
//		Debug.Log (BGScript.getisAlive ());
    }