Walker CreateWalker() { Walker walker = gameObject.AddComponent <Walker>(); walker.Draw(dotPrefab, walkerContainer); walker.SetRandomPosition(); return(walker); }
void Start() { walkerContainer = GameObject.Find("Walkers"); for (var i = 0; i < numWalkers; i++) { walkers.Add(CreateWalker()); } treeContainer = GameObject.Find("Tree"); Walker trunk = gameObject.AddComponent <Walker>(); trunk.Draw(dotPrefab, treeContainer); tree.Add(trunk); }
// Update is called once per frame void Update() { walkerComp.Step(); walkerComp.Draw(); }