void OnCollisionEnter(Collision other) { if (!Math.LayerMaskContainsLayer(layerMask, other.gameObject.layer)) { return; } SetWobble(other.relativeVelocity); }
void OnTriggerEnter(Collider other) { if (!Math.LayerMaskContainsLayer(layerMask, other.gameObject.layer)) { return; } SetWobble(GetVelocity(other.gameObject)); }
void SpawnOne() { float radius = Random.Range(0, MaxRadius()); float diceRoll = Random.value; if (diceRoll > spawnArea.Evaluate(radius)) { return; } Vector3 pos = Random.onUnitSphere * radius; Vector3 flatPos = new Vector3(pos.x, 0, pos.z); var newInstance = Instantiate(Math.RandomElementOfList(prefabs), flatPos + transform.position, quaternion.identity, transform); _instances.Add(newInstance); }