ZMWSLI0-SL2021-GR11/cw5/zadanie4.cs

46 lines
1.0 KiB
C#
Raw Normal View History

2021-05-20 21:16:43 +02:00
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();
}
}
}
}