コード例 #1
0
    //最終影響マップ生成
    private void Mapping()
    {
        MapMatrix enemyMap = new MapMatrix {
            map = EnemyMapping(), coefficient = enemyCoefficient
        };
        MapMatrix itemMap = new MapMatrix {
            map = ItemMapping(), coefficient = itemCoefficient
        };

        switch (fusionSwitch)
        {
        case 0:
            map = influenceMap.WeightedAverage(new List <MapMatrix> {
                enemyMap, itemMap
            });
            break;

        case 1:
            map = influenceMap.Ceiling(new List <MapMatrix> {
                enemyMap, itemMap
            });
            break;

        case 2:
            map = influenceMap.Floor(new List <MapMatrix> {
                enemyMap, itemMap
            });
            break;

        default:
            map = new float[mapRange.x, mapRange.y];
            break;
        }
        influenceMap.MatrixOperate((xcount, ycount) =>
        {
            if (terrains[xcount, ycount].GetComponent <Renderer>().material.color != Color.gray)
            {
                terrains[xcount, ycount].GetComponent <Renderer>().material.color = new Color(map[xcount, ycount], 0, 0);
                terrains[xcount, ycount].transform.GetChild(0).GetChild(0).GetComponent <Text>().text = map[xcount, ycount].ToString("f3");
            }
        });
    }