Example #1
0
    void OnCollisionEnter(Collision other)
    {
        if (!Math.LayerMaskContainsLayer(layerMask, other.gameObject.layer))
        {
            return;
        }

        SetWobble(other.relativeVelocity);
    }
Example #2
0
    void OnTriggerEnter(Collider other)
    {
        if (!Math.LayerMaskContainsLayer(layerMask, other.gameObject.layer))
        {
            return;
        }

        SetWobble(GetVelocity(other.gameObject));
    }
Example #3
0
    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);
    }