public void Setup(int player = 1, bool isHuman = true, BoatLivery livery = new BoatLivery()) { _playerIndex = player - 1; cam.gameObject.layer = LayerMask.NameToLayer("Player" + player); // assign player layer SetupController(isHuman); // create or change controller Colorize(livery); }
/// <summary> /// This sets both the primary and secondary colour and assigns via a MPB /// </summary> private void Colorize(BoatLivery livery) { boatRenderer?.material?.SetColor(LiveryPrimary, livery.primaryColor); engineRenderer?.material?.SetColor(LiveryPrimary, livery.primaryColor); boatRenderer?.material?.SetColor(LiveryTrim, livery.trimColor); engineRenderer?.material?.SetColor(LiveryTrim, livery.trimColor); }
private void Colorize(Color primaryColor, Color trimColor, bool random = false) { var livery = new BoatLivery { primaryColor = random ? ConstantData.GetRandomPaletteColor : primaryColor, trimColor = random ? ConstantData.GetRandomPaletteColor : trimColor }; Colorize(livery); }
BoatLivery RandomLivery() { var livery = new BoatLivery { primaryColor = ConstantData.GetRandomPaletteColor, trimColor = ConstantData.GetRandomPaletteColor }; return(livery); }
private void Colorize(Color primaryColor, Color trimColor) { var livery = new BoatLivery { primaryColor = primaryColor, trimColor = trimColor }; Colorize(livery); }
private static void GenerateRandomBoats(int count, bool ai = true) { for (var i = 0; i < count; i++) { var boat = new BoatData(); Random.InitState(ConstantData.SeedNow + i); boat.boatName = ConstantData.AiNames[Random.Range(0, ConstantData.AiNames.Length)]; BoatLivery livery = new BoatLivery { primaryColor = ConstantData.GetRandomPaletteColor, trimColor = ConstantData.GetRandomPaletteColor }; boat.livery = livery; boat.boatPrefab = Instance.boats[Random.Range(0, Instance.boats.Length)]; if (ai) { boat.human = false; } RaceData.boats.Add(boat); } }