示例#1
0
 public void SpawnFollower(GameObject prefab, float cellLen)
 {
     if (child != null)
     {
         child.SpawnFollower(prefab, cellLen);
     }
     else
     {
         GameObject c = Instantiate(prefab, transform.parent);
         Vector3    minusLastDir3D = new Vector3(-lastDir.x, 0, -lastDir.y);
         c.transform.position = transform.position + (minusLastDir3D * cellLen);
         child = c.GetComponent <ChildMove>();
         child.nextTarget(lastTarget, lastDir);
         child.speed = speed;
     }
 }
示例#2
0
 void Prosper()
 {
     AudioManager.singleton.PlayEat();
     if (child != null)
     {
         child.SpawnFollower(catPrefab, grid.getCellLength());
     }
     else
     {
         GameObject c        = Instantiate(catPrefab, transform.parent);
         Vector3    disDir3D = new Vector3(disabledDir.x, 0, disabledDir.y);
         c.transform.position = transform.position + (disDir3D * grid.getCellLength());
         child = c.GetComponent <ChildMove>();
         child.nextTarget(lastTarget, lastDir);
         child.speed = speed;
     }
 }