예제 #1
0
    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();
        }
    }
예제 #2
0
    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);
    }
예제 #3
0
 private void HandleHit()
 {
     impactParticle.Get <PooledMonoBehaviour>(transform.position + new Vector3(0, 2.5f, 0), Quaternion.identity);
 }
예제 #4
0
 private void Character_OnDie(IDie entity)
 {
     deathParticle.Get <PooledMonoBehaviour>(transform.position, Quaternion.identity);
     entity.OnDie -= Character_OnDie;
 }
예제 #5
0
 private void OnCollisionEnter(Collision collision)
 {
     particles.Get <PooledMonoBehaviour>(transform.position, Quaternion.LookRotation(collision.contacts[0].normal));
 }