예제 #1
0
파일: Example.cs 프로젝트: dejk10/Timer
 // Update is called once per frame
 void Update()
 {
     if(Time.fixedTime > nextTime && counter > 0)
     {
         nextTime = Time.fixedTime + timer;
         for (int j = 10; j > 0; j--)
         {
             int randNum = Random.Range(minHeight, maxHeight);
             for (int i = 0; i < randNum; i++)
             {
                 CustomBox cBox = new CustomBox();
                 cBox.box.transform.position = new Vector3(counter * horizontalSpacing, i * verticalSpacing, j * horizontalSpacing);
                 cBox.PickRandomColor();
             }
         }
         counter--;
     }
 }
예제 #2
0
 void Update()
 {
     if (Counter > 0 && Time.fixedTime > NextTime)
     {
         NextTime = Time.fixedTime + Timer;
         for (int j = 10; j > 0; j--)
         {
             int randomNumber = Random.Range(MinHeight, MaxHeight);
             for (int i = 0; i < randomNumber; i++)
             {
                 CustomBox cBox = new CustomBox();
                 cBox.box.transform.position =
                     new Vector3(Counter * HorizontalSpacing,
                                 i * VerticalSpacing,
                                 j * HorizontalSpacing);
                 cBox.PickRandomColor();
             }
         }
         Counter--;
     }
 }
예제 #3
0
 void Update()
 {
     if (Counter > 0 && Time.fixedTime > NextTime)
     {
         NextTime = Time.fixedTime + Timer;
         for (int j = 10; j > 0; j--)
         {
             int randomNumber = Random.Range(MinHeight, MaxHeight);
             for (int i = 0; i < randomNumber; i++)
             {
                 CustomBox cBox = new CustomBox();
                 cBox.box.transform.position =
                     new Vector3(Counter * HorizontalSpacing,
                                 i * VerticalSpacing,
                                 j * HorizontalSpacing);
                 cBox.PickRandomColor();
             }
         }
         Counter--;
     }
 }
예제 #4
0
 void Update()
 {
     //print (Time.fixedTime);
     if (Counter > 0 && Time.fixedTime > NextTime)
     {
         // since we only want one thing to happen when our if statement is executed, we should add in some way to increment
         // the number we're comparing to Time.fixedTime.
         NextTime = Time.fixedTime + Timer;
         for (int j = 10; j > 0; j--)
         {
             int randomNumber = Random.Range(MinHeight, MaxHeight);
             for (int i = 0; i < randomNumber; i++)
             {
                 CustomBox cBox = new CustomBox();
                 cBox.box.transform.position = new Vector3(Counter * HorizontalSpacing, i * VerticalSpacing, j * HorizontalSpacing);
                 cBox.PickRandomColor();
             }
         }
         Counter--;
     }
 }