public override void SpawnMovableObject() { ObstacleMask wallMask = RandomLaneMaskGenerator.GenerateObstacleMask(1); Transform spawnpoint = wallSpawnPosition[Random.Range(0, wallSpawnPosition.Length)]; ((CollectibleObjectPooler)pooler).SpawnCollectible(wallMask, spawnpoint.position, Quaternion.identity); }
/// <summary> /// Builds a wall from given mask in given slot. /// Lanes always go from Left to Right /// </summary> /// <param name="wallSlot"></param> /// <param name="wallMask"></param> public string[] BuildObstacle(int gateCount = 1) { ObstacleMask wallMask = RandomLaneMaskGenerator.GenerateObstacleMask(gateCount); //Idea: Given an obstacle mask, builds a string array with the tags of the obstacle entities (walls and gate) var obstacleMask = wallMask.ToArray(); string[] obstacleTags = new string[3]; for (int i = 0; i < obstacleMask.Length; i++) { if (i == 0) { if (obstacleMask[i] == 0) //Wall { obstacleTags[i] = /*Taglist.WallPrefix +*/ Taglist.WallLeftTag; } else //Gate { obstacleTags[i] = Taglist.GatePrefix + GetRandomGate() + Taglist.LeftSufix; } } else if (i == 1) { if (obstacleMask[i] == 0) //Wall { obstacleTags[i] = Taglist.WallCenterTag; } else //Gate { obstacleTags[i] = Taglist.GatePrefix + GetRandomGate() + Taglist.CenterSufix; } } else { if (obstacleMask[i] == 0) //Wall { obstacleTags[i] = Taglist.WallRightTag; } else //Gate { obstacleTags[i] = Taglist.GatePrefix + GetRandomGate() + Taglist.RightSufix; } } } return(obstacleTags); }