Пример #1
0
    private Vector3 MakeOscillation(OscillationData o)
    {
        var x = o.Amplitude.x * Mathf.Sin(o.Frequency.x * Time.time) + o.Offset.x;
        var y = o.Amplitude.y * Mathf.Sin(o.Frequency.y * Time.time) + o.Offset.y;
        var z = o.Amplitude.z * Mathf.Sin(o.Frequency.z * Time.time) + o.Offset.z;

        return(new Vector3(x, y, z));
    }
        protected override void OnShapeSpawned(Shape spawned)
        {
            Vector3 oscillationOffset;

            if (direction == OffsetDirection.Outward)
            {
                oscillationOffset = (spawned.transform.position - transform.position).normalized;
            }
            else
            {
                oscillationOffset = Random.onUnitSphere;
            }

            var data = new OscillationData(oscillationOffset * offset.Random, frequency.Random);

            if (data.Offset != Vector3.zero)
            {
                system.AddData(spawned.transform, data);
            }
        }