private void OnCollisionEnter(Collision col) { BaseSpawnable spawnable = col.transform.GetComponent <BaseSpawnable>(); if (spawnable != null) { onHit(spawnable); } }
public void onSpawnReady(int spawnAmount) { for (int spawnCounter = 0; spawnCounter <= spawnAmount; spawnCounter++) { Vector3 spawnablePosition = modelCamera.ViewportToWorldPoint(new Vector3(Random.value, Random.value, Random.Range(100, maxSpawnDistance))); Vector3 movementDirection = (playerController.transform.position - spawnablePosition).normalized; BaseSpawnable spawnable = Transform.Instantiate(this, spawnablePosition, Quaternion.identity, spawnerParent.transform); spawnable.onSpawn(Random.value * maxMovementSpeed, movementDirection); } }
public void onHit(BaseSpawnable spawnable) { statData.triggerStatChange(spawnable.Stat, spawnable.Impact); }