// Update is called once per frame void Update() { if (!playing && parts.partCount(playerID, part.hood) < 1) { Debug.Log("playing"); smoke.Play(); playing = true; } else if (playing && parts.partCount(playerID, part.hood) > 0) { smoke.Stop(); playing = false; } }
private void Update() { if (parts.partCount(playerid, part.engine) < 1) { GameObject expl = GameObject.Instantiate(explosionEffect); expl.transform.position = gameObject.transform.position; SoundManager.instance.PlayOnce(dieClip, 1); playerDied.Invoke(GetComponentInParent <playerID>().p); diedThisFrame = true; Destroy(gameObject); carModel.transform.parent = null; foreach (MeshRenderer meshRenderer in carModel.GetComponentsInChildren <MeshRenderer>()) { var rb = meshRenderer.gameObject.AddComponent <Rigidbody>(); rb.AddExplosionForce(1500, transform.position, 20); } foreach (TrailRenderer trail in carModel.GetComponentsInChildren <TrailRenderer>()) { StartCoroutine(fadeTrail(trail)); } } }