IEnumerator DoGenerateAIs(CSVImporter_script.ImportedValues[] values) { if (!AssetLoader.AILoadingDone) //wait for all AI images to load { yield return(new WaitForSeconds(1f)); yield return(null); } foreach (CSVImporter_script.ImportedValues value in values) { if (value.Values[0] == "") //skip empty entries { continue; } AIStatesClass newAI = new AIStatesClass(); newAI.Difficulty = value.Values[0]; newAI.AIName = value.Values[1]; string[] deckValues = value.Values[2].Split(','); newAI.DeckValues = new List <string>(); foreach (string card in deckValues) { //int cardValue = int.Parse(card); //newAI.DeckValues.Add(cardValue); newAI.DeckValues.Add(card); } newAI.EndOffset = int.Parse(value.Values[3]); newAI.RiskValue = float.Parse(value.Values[4]); newAI.SpriteRef = value.Values[5]; newAI.AISprite = AssetLoader.GetAISprite(newAI.SpriteRef); newAI.Odds = float.Parse(value.Values[6]); if (newAI.Difficulty == "Easy") { EasyAI.Add(newAI); } else if (newAI.Difficulty == "Medium") { MediumAI.Add(newAI); } else if (newAI.Difficulty == "Hard") { HardAI.Add(newAI); } //AllAIs.Add(newAI); } //SelectDifficulty(_gameController.Difficulty); }
public List <AIStatesClass> GetAIs() { List <AIStatesClass> aiList = new List <AIStatesClass>(); EasyAI.Shuffle(); MediumAI.Shuffle(); HardAI.Shuffle(); aiList.Add(EasyAI[0]); aiList.Add(MediumAI[0]); aiList.Add(HardAI[0]); return(aiList); }
// Start is called before the first frame update void Start() { bottomLeft = Camera.main.ScreenToWorldPoint(new Vector2(0, 0)); topRight = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height)); AudioManager.AudioSource = AudioSource; gameBall = Instantiate(ball) as Ball; gameBall.GameManager = this; leftPaddle = Instantiate(paddle) as Paddle; leftPaddle.Init(false, new PlayerControl("PaddleLeft")); rightPaddle = Instantiate(paddle) as Paddle; IPaddleControls controls = null; switch (GameManager.GameType) { case GameType.MULTIPLAYER: controls = new PlayerControl("PaddleRight"); break; case GameType.EASY: controls = new EasyAI(gameBall, rightPaddle); rightPaddle.speed = 4; break; case GameType.MEDIUM: controls = new MediumAI(gameBall, rightPaddle); rightPaddle.speed = 5; break; case GameType.HARD: controls = new HardAI(gameBall, rightPaddle); rightPaddle.speed = 7; break; } rightPaddle.Init(true, controls); leftPaddle.CanMove = false; rightPaddle.CanMove = false; NewGameData(); }