// Update is called once per frame void Update() { timePassed += Time.deltaTime; if (collided) { //Makes the bullet go away transform.localScale = new Vector3(Mathf.Lerp(1, 0, timePassed * 4), Mathf.Lerp(1, 0, timePassed * 4), 1); if (timePassed >= .25f) { _actor.Remove(); } } }
private void FixedUpdate() { if (collided) { particleEffect.transform.SetParent(null, true); Object.Destroy(particleEffect, 5f); _actor.Remove(); } else if (beenShot) { //Moves bullet _actor.SetVelocity(vel); platform.SetVelocity(vel); if (_actor._ControllerState.HasCollisions && !collided) { //we hit something. if (timePassed > .07f) { smoke.transform.parent = null; smoke.GetComponent <ParticleSystem>().Stop(); GameObject.Destroy(smoke, 5f); _actor.Active = false; platform.Active = false; collided = true; particleEffect.GetComponent <ParticleSystem>().Play(); ActorManager.instance.PlaySound("BombExplosionFinal", 1); foreach (var item in _actor._ControllerState.hasCollisionsWith) { if (item.GetComponent <SuperPlayer>()) { item.GetComponent <SuperPlayer>().Die(); } } platform.Remove(); } } } }
public void removeStar() { _actor.Remove(); GameObject.Destroy(transform.parent.gameObject); }