private void Update() { timer += Time.deltaTime; if (timer >= LifeTime) { PoolObject.Despawn(); } }
private void OnTriggerExit(Collider other) { PoolObject poolObject = other.GetComponent <PoolObject>(); if (poolObject != null) { poolObject.Despawn(); } else { Destroy(other.gameObject); } }
private void Update() { timer += Time.deltaTime; if (timer >= LifeTime) { PoolObject.Despawn(PoolObject); if (ParticleSystem != null) { ParticleSystem.Stop(true, ParticleSystemStopBehavior.StopEmitting); } return; } }
private void Update() { Timer += Time.deltaTime; float p = Timer / FadeTime; float x = FadeCurve.Evaluate(p); Decal.fadeFactor = x; if (p >= 1f) { PoolObject.Despawn(this); } }
private void Update() { foreach (var mat in Renderer.materials) { var c = mat.color; c.a = timer / Life; mat.color = c; } timer -= Time.deltaTime; if (timer <= 0f) { PoolObject.Despawn(this.gameObject); } }
private void Update() { timer += Time.deltaTime; if (timer >= Duration) { PoolObject.Despawn(this); } float alpha = 1f - Mathf.Clamp01(timer / Duration); var c = Sprite.color; c.a = alpha; Sprite.color = c; Light.intensity = BaseLightIntensity * alpha; }
private void MoveAndCollide(Vector3 oldPos, Vector3 newPos) { bool didHit = Physics.Linecast(oldPos, newPos, out RaycastHit hit, CollisionMask, QueryTriggerInteraction.Ignore); if (didHit) { PoolObject.Despawn(this); Pawn p = hit.transform.GetComponentInParent <Pawn>(); Health h = hit.transform.GetComponentInParent <Health>(); if (p != null) { p.AddKnockback(Direction * KnockbackMultiplier); } UponCollision(hit, p, h); } else { transform.position = newPos; } }
public void Despawn() { PoolObject.Despawn(this); }
private void UponDespawn() { // This may seem odd, but there is a reason for it. Trust me. PoolObject.Despawn(this.PoolObject); }