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); } }
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(); } }
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); * }*/ }
//ghost to spawner information public void SetGhost(ghostController ghostscript) { _ghostScript = ghostscript; }