46 lines
1.0 KiB
C#
46 lines
1.0 KiB
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class GrowMultipleTrees : MonoBehaviour
|
||
|
{
|
||
|
public TurtleEnvironment[] trees;
|
||
|
public int steps;
|
||
|
// Start is called before the first frame update
|
||
|
void Start()
|
||
|
{
|
||
|
trees = new TurtleEnvironment[9];
|
||
|
foreach(TurtleEnvironment tree in trees)
|
||
|
{
|
||
|
tree.loadFile();
|
||
|
}
|
||
|
var mainTree = trees[0];
|
||
|
for(var j = 0; j < 3; j++)
|
||
|
{
|
||
|
var position = new Vector3(-1, 0, -1);
|
||
|
for(var i = 0; i < 3; i++)
|
||
|
{
|
||
|
var newTree = mainTree;
|
||
|
newTree.transform.position = new Vector3(j, 0, i);
|
||
|
trees[i + j] = newTree;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
public void step()
|
||
|
{
|
||
|
for(int i = 0; i<steps;i++)
|
||
|
{
|
||
|
foreach(TurtleEnvironment tree in trees)
|
||
|
{
|
||
|
tree.evaluateAndPresent();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|