void OnTriggerEnter(Collider other) { if (other.CompareTag("Player1") || other.CompareTag("Player2")) { if (playerOneDying && other.CompareTag("Player1")) { return; } if (playerTwoDying && other.CompareTag("Player2")) { return; } WildCatController deadPlayer = other.transform.parent.gameObject.GetComponent <WildCatController>(); if (deadPlayer) { Debug.Log("OnTriggerEnter"); if (other.CompareTag("Player1")) { playerOneDying = true; } if (other.CompareTag("Player2")) { playerTwoDying = true; } StartCoroutine(this.PlayerDeathCoroutine(deadPlayer, other.gameObject.transform.position)); } } }
// Use this for initialization void Start() { rigidBodies = gameObject.GetComponentsInChildren <Rigidbody>(); wildCat = GetComponent <WildCatController>(); inputMngr = GetComponent <InputManager>(); colorStart = RightShieldObject.renderer.material.color; colorEnd = new Color(colorStart.r, colorStart.g, colorStart.b, 0.0f); FadeOut(dashingDirection); }
IEnumerator PlayerDeathCoroutine(WildCatController deadPlayer, Vector3 pos) { yield return new WaitForSeconds(1.0f); GameObject explosionGO = GameObject.Instantiate(this.ExplosionPrefab, pos, Quaternion.identity) as GameObject; yield return new WaitForSeconds(1.0f); GameObject.Destroy(explosionGO); deadPlayer.Die(); if (deadPlayer.CompareTag("Player1")) playerOneDying = false; if (deadPlayer.CompareTag("Player2")) playerTwoDying = false; }
IEnumerator PlayerDeathCoroutine(WildCatController deadPlayer, Vector3 pos) { yield return(new WaitForSeconds(1.0f)); GameObject explosionGO = GameObject.Instantiate(this.ExplosionPrefab, pos, Quaternion.identity) as GameObject; yield return(new WaitForSeconds(1.0f)); GameObject.Destroy(explosionGO); deadPlayer.Die(); if (deadPlayer.CompareTag("Player1")) { playerOneDying = false; } if (deadPlayer.CompareTag("Player2")) { playerTwoDying = false; } }
// Use this for initialization void Start() { rigidBodies = gameObject.GetComponentsInChildren<Rigidbody>(); wildCat = GetComponent<WildCatController>(); inputMngr = GetComponent<InputManager>(); colorStart = RightShieldObject.renderer.material.color; colorEnd = new Color(colorStart.r, colorStart.g, colorStart.b, 0.0f); FadeOut (dashingDirection); }
// Use this for initialization void Start() { ParticleComp = this.gameObject.GetComponent <ParticleSystem>(); ParticleComp.emissionRate = 0; wildCat = transform.root.gameObject.GetComponent <WildCatController>(); }
// Use this for initialization void Start() { ParticleComp = this.gameObject.GetComponent<ParticleSystem>(); ParticleComp.emissionRate = 0; wildCat = transform.root.gameObject.GetComponent<WildCatController>(); }