private void OnCollisionEnter(Collision collision) { var hit = collision.collider.GetComponent <ITakeHit>(); if (hit != null) { Impact(hit); } else { impactParticlePrefab.Get <PooledMonoBehaviour>(transform.position, Quaternion.identity); ReturnToPool(); } }
private void SpawnNextFromPool() { SetSpawnTime(); spawnTimer = 0; var randY = Random.value >= 0.5 ? 90f : -90f; var randRot = hasRandomRotation ? Quaternion.Euler(Random.Range(0, 359), randY, Random.Range(0, 359)) : Quaternion.identity; fallingObjectPrefab.Get <FallingObject>(pool, transform.position, randRot); }
private void HandleHit() { impactParticle.Get <PooledMonoBehaviour>(transform.position + new Vector3(0, 2.5f, 0), Quaternion.identity); }
private void Character_OnDie(IDie entity) { deathParticle.Get <PooledMonoBehaviour>(transform.position, Quaternion.identity); entity.OnDie -= Character_OnDie; }
private void OnCollisionEnter(Collision collision) { particles.Get <PooledMonoBehaviour>(transform.position, Quaternion.LookRotation(collision.contacts[0].normal)); }