Exemple #1
0
    public void Generate()
    {
        GameObject[] generatedEntities =
            new GameObject[(int)groupCount.value * (int)groupSize.value];

        for (int i = 0; i < groupCount.value; ++i)
        {
            Vector3 groupPosition = Random.onUnitSphere;
            for (int j = 0; j < (int)groupSize.value; ++j)
            {
                generatedEntities[i * (int)groupSize.value + j] =
                    EntityFactory.AddEntityInWorld(this,
                                                   groupPosition + Random.insideUnitSphere / 10);
            }
        }

        foreach (GameObject entity in generatedEntities)
        {
            Vector3 normalizedPosition = entity.transform.position.normalized;
            entity.transform.position =
                simulation.GetGroundPositionWithElevation(normalizedPosition,
                                                          .5f);
        }
    }
 public bool AddEntityInWorld(string entityTypeName, float x, float y,
                              float z)
 {
     return(EntityFactory.AddEntityInWorld(entityTypeName, x, y, z));
 }
 public bool AddEntityInWorld(string entityTypeName, Vector3 position)
 {
     return(EntityFactory.AddEntityInWorld(entityTypeName, position));
 }