public ObstacleLine(float linePosition, int count, ObstacleObjectData.ObjectType type) { this.linePosition = linePosition; obstacle = new ObstacleObjectData[count]; SelectSubSet set = new SelectSubSet(8); int[] obsX = set.CreateSubSet(count); for (int i = 0; i < count; i++) { obstacle[i] = new ObstacleObjectData(new Vector3(obsX[i] - 3.5f, linePosition, 0), type); } }
public ObstacleLine(float linePosition, int count) { this.linePosition = linePosition; obstacle = new ObstacleObjectData[count]; SelectSubSet set = new SelectSubSet(8); int[] obsX = set.CreateSubSet(count); int evilPos = Random.Range(0, (2 * count) / 5); int chance = Random.Range(1, 101); for (int i = 0; i < (2 * count) / 5; i++) { ObstacleObjectData.ObjectType t = (i == evilPos && chance <= 40) ? ObstacleObjectData.ObjectType.Evil : ObstacleObjectData.ObjectType.Spike; obstacle[i] = new ObstacleObjectData(new Vector3(obsX[i] - 3.5f, linePosition, 0), t); } for (int i = (2 * count) / 5; i < count; i++) { obstacle[i] = new ObstacleObjectData(new Vector3(obsX[i] - 3.5f, linePosition, 0), ObstacleObjectData.ObjectType.Block); } }