Ejemplo n.º 1
0
        private float[,] DiamondBrick(int n)
        {
            int dim        = (1 << n) + 1;
            var landschaft = new float[dim, dim];

            // Die 4 Ecken sind initialisiert == ergo mit 0.0f!!
            Quadrat(landschaft, 0, 0, dim - 1, dim - 1);
            // normieren  0..360
            float max = landschaft.Aggregate(float.MinValue, Math.Max);
            float min = landschaft.Aggregate(float.MaxValue, Math.Min);

            landschaft.Each(g => g * 360 / (max - min));

            return(landschaft);
        }
Ejemplo n.º 2
0
        private float Sum(float[] previousLayer)
        {
            var weighted = new float[previousLayer.Length];

            for (var i = 0; i < weighted.Length; i++)
            {
                weighted[i] = previousLayer[i] * Weights[i];
            }

            return(weighted.Aggregate((l, r) => l + r));
        }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        var data = new float[256];

        audioSource.GetOutputData(data, 0);
        var level = data.Aggregate((a, c) => a + Mathf.Abs(c)) / data.Length;

        transform.localScale = Vector3.one * (level + 1) * 3;
        var txt = text.GetComponent <Text>();

        txt.text = level.ToString();
    }