コード例 #1
0
 // Start is called before the first frame update
 void Start()
 {
     for (int x = 0; x < this.transform.childCount; x++)
     {
         this.transform.GetChild(x).SetPositionAndRotation(
             boundary.RandomPosition(),
             Quaternion.Euler(new Vector3(Random.value, Random.value, 0f)));
     }
 }
コード例 #2
0
 public void AddFood(int count)
 {
     for (int x = 0; x < count; x++)
     {
         var newFood = Instantiate(foodPrefab);
         newFood.transform.position = feedLocation.RandomPosition();
         if (foodParent != null)
         {
             newFood.transform.SetParent(foodParent.transform);
         }
     }
 }