Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Chart : MonoBehaviour {
  6.     public Transform barPrefab;
  7.     public int width;
  8.     public int height;
  9.     public List<List<float>> table;
  10.  
  11.     // Use this for initialization
  12.     void Start () {
  13.         int counter = 1;
  14.         for(int row = 0; row < height; row++)
  15.         {
  16.             List<float> r = new List<float>();
  17.             for (int col = 0; col < width; col++)
  18.             {
  19.                 if (col == 0)
  20.                 {
  21.                     r.Add(row + 1);
  22.                 }
  23.                 else
  24.                 {
  25.                     r.Add(Random.Range(0.0f, 10.0f));
  26.                 }
  27.             }
  28.             table.Add(r);
  29.         }
  30.     }
  31.    
  32.     // Update is called once per frame
  33.     void Update () {
  34.        
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement