示例#1
0
    Walker CreateWalker()
    {
        Walker walker = gameObject.AddComponent <Walker>();

        walker.Draw(dotPrefab, walkerContainer);
        walker.SetRandomPosition();
        return(walker);
    }
示例#2
0
    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);
    }
示例#3
0
 // Update is called once per frame
 void Update()
 {
     walkerComp.Step();
     walkerComp.Draw();
 }