示例#1
0
    /**
     * Spawn some clouds in the air
     */
    private void SpawnClouds()
    {
        FunctionPeriodic.Create(
            () =>
        {
            if (EnvironmentManager.ComponentCount <Cloud>() < _CLOUD_MAX_SPAWNS)
            {
                Vector3 cloudWorldPosition = new Vector3(
                    _SPAWN_CLOUD_X,
                    0f,
                    Random.Range(-_MAX_RADIUS, _MAX_RADIUS)
                    );

                Cloud cloud = Instantiate(
                    AssetManager.Get_Prefab_Cloud(),
                    cloudWorldPosition,
                    Quaternion.identity
                    );

                EnvironmentManager.AddComponent(cloud);
            }
        },
            "SpawnClouds",
            0f,
            0f
            );
    }
示例#2
0
    /**
     * Spawn some birds in the air
     */
    private void SpawnBirds()
    {
        FunctionPeriodic.Create(
            () =>
        {
            if (EnvironmentManager.ComponentCount <Bird>() < _BIRD_MAX_SPAWNS)
            {
                Vector3 birdWorldPosition = new Vector3(
                    _SPAWN_BIRD_X,
                    0f,
                    Random.Range(-_MAX_RADIUS, _MAX_RADIUS)
                    );

                Bird bird = Instantiate(
                    AssetManager.Get_Prefab_Bird(),
                    birdWorldPosition,
                    Quaternion.identity
                    );


                EnvironmentManager.AddComponent(bird);
            }
        },
            "SpawnBirds",
            0f,
            0f
            );
    }