예제 #1
0
    private void OnTriggerEnter(Collider col)
    {
        if (col.tag == "Player")
        {
            _playerScript = col.GetComponent <PlayerBehaviour>();
            PlayerPickUp(col);
        }

        if (col.tag == "Ghost")
        {
            _ghostScript = col.GetComponent <ghostController>();
            GhostPickUp(col);
        }
    }
예제 #2
0
    private void OnTriggerEnter(Collider col)
    {
        if (col.tag == "Player")
        {
            _playerScript = col.GetComponent <PlayerBehaviour>();
            _ifGhost      = false;
            StatsIncreaseDecrease();
        }

        if (col.tag == "Ghost")
        {
            _ghostScript = col.GetComponent <ghostController>();
            _ifGhost     = true;
            StatsIncreaseDecrease();
        }
    }
예제 #3
0
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.CompareTag("ghost"))
        {
            if (ghostbuster == true)
            {
                count += 100;
                ghostController ghost = collision.gameObject.GetComponent <ghostController>();
                ghost.reSpawn();
                SetScore();
            }
            else
            {
                count -= 100;
                collision.gameObject.SetActive(false);
                SetScore();
            }
        }
        //rotate the cube world
        if (collision.collider.CompareTag("up"))
        {
            Physics.gravity = new Vector3(0, -10, 0);
        }
        if (collision.collider.CompareTag("down"))
        {
            Physics.gravity = new Vector3(0, 10, 0);
        }

        /*if (collision.collider.CompareTag("left"))
         * {
         *  Physics.gravity = new Vector3(10, 0, 0);
         * }
         * if (collision.collider.CompareTag("right"))
         * {
         *  Physics.gravity = new Vector3(-10, 0, 0);
         * }
         * if (collision.collider.CompareTag("back"))
         * {
         *  Physics.gravity = new Vector3(0, 0, -10);
         * }
         * if (collision.collider.CompareTag("front"))
         * {
         *  Physics.gravity = new Vector3(0, 0, 10);
         * }*/
    }
예제 #4
0
 //ghost to spawner information
 public void SetGhost(ghostController ghostscript)
 {
     _ghostScript = ghostscript;
 }