コード例 #1
0
ファイル: ItemSpawner.cs プロジェクト: Chikanz/Jumpy-Run
 protected override void PlatformPlacementLogic(Transform platform)
 {
     if (Random.value < chanceToPlaceItems && !PlatformsPlacedOnThisFrame.Contains(platform))
     {
         var item = Items[Random.Range(0, Items.Length)];
         PlacePlatformObject(item, platform);
     }
 }
コード例 #2
0
ファイル: ObstacleSpawner.cs プロジェクト: Chikanz/Jumpy-Run
    protected override void PlatformPlacementLogic(Transform platform)
    {
        var index    = Random.Range(0, Obstacles.Length);
        var obstacle = Obstacles[index];

        //Chance to place
        if (Random.value <= obstacle.SpawnChance && !PlatformsPlacedOnThisFrame.Contains(platform))
        {
            //Only place on right platforms
            if (obstacle.PlacementMask == string.Empty || platform.name == obstacle.PlacementMask)
            {
                PlacePlatformObject(obstacle, platform);
            }
        }
    }