public void RpcAttack(GameObject go) { /*if (isLocalPlayer) * {*/ BasicController playerController = go.GetComponent <BasicController>(); playerController.DecreaseLives(); playerController.Respawn(Vector3.zero); /* }*/ }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.layer == 9) { BasicController playerController = collision.gameObject.GetComponent <BasicController>(); playerController.DecreaseLives(); playerController.Respawn(Vector3.zero); } else { collision.gameObject.SetActive(false); } }
void OnCollisionEnter(Collision col) { if (col.gameObject.layer == 9) { BasicController playerController = col.gameObject.GetComponent <BasicController>(); playerController.Respawn(MoleficentGameManager.instance.LastCheckPoint()); //Debug.Log("sono nell'if del respawner.cs"); } else { // Debug.Log("sono nell'else del respawner.cs"); col.gameObject.SetActive(false); } }
private void FrontAttack() { transform.GetChild(1).GetComponent <ParticleSystem>().Play(); //fa perdere una vita al giocatore in range B davanti a sè e lo fa respawnare RaycastHit hit; if (Physics.SphereCast(transform.position + new Vector3(0, 1, 0), .5f, transform.forward, out hit, distanceB)) { if (playerTags.Contains(hit.transform.tag)) { BasicController playerController = hit.transform.gameObject.GetComponent <BasicController>(); playerController.DecreaseLives(); playerController.Respawn(Vector3.zero); } } }
private void RoundAttack() { transform.GetChild(0).GetComponent <ParticleSystem>().Play(); //fa perdere una vita ai giocatori in range B e li fa respawnare foreach (GameObject go in FindObjectsOfType <GameObject>()) { if (playerTags.Contains(go.tag)) { if ((transform.position - go.transform.position).magnitude <= distanceB) { BasicController playerController = go.GetComponent <BasicController>(); playerController.DecreaseLives(); playerController.Respawn(Vector3.zero); } } } }