//TODO: this seems redundant but, might be useful later on in the game /*** turns any enemy type to a normal enemy */ private void turnToNormalEnemy() { this.GetComponent <SpriteRenderer>().sprite = enemySprites[0]; this.GetComponent <Rigidbody2D>().gravityScale = 2f; //returns gravity to how it was, now he will fall like a normal trooper highestY = 0; enemyType = enemyTypeEnum.Normal; this.GetComponent <DragAndDrop>().enabled = true; }
public void SelectEnemyType() { ////TODO: this needs to change , its just a trick ////if not enough time has passed to start the parachute type, then it will automatically select the normal enemy type //GameObject gameEngin = GameObject.Find("GameEngine"); //timePassedInGame = gameEngin.GetComponent<GameEngine>().timeElapsed; //if (gameEngin.GetComponent<GameEngine>().timeElapsed <= startEnemyTypeAfter[1]) //{ // enemyType = enemyTypeEnum.Normal; // return; //} //TODO: this needs to //int currentWave = gameEngine.getWaveNumber(); //Debug.Log(currentWave); currentWave = gameEngine.getWaveNumber(); Debug.Log("im here"); float rnd = UnityEngine.Random.Range(0f, 1f); //float enemyProbabilityFinder = 0f; //int i; //for (i = 0; i < enemyTypeProbability.Length; i++) //{ // //enemyTypeProbability has a map of which enemy type should appear ,, in which probability , and selects the correct type randomly // enemyProbabilityFinder += enemyTypeProbability[i]; // if (rnd < enemyProbabilityFinder) //THE LOGIC BEHIND THIS, if the normal enemy has 70% chance and the paracchuter 30% , then if our random falls inside the 70% nothing happens, thus it stays as a normal soldier // { // break; // } //} //enemyType = (enemyTypeEnum)(Enum.GetValues(typeof(enemyTypeEnum))).GetValue(i) // enemyType = enemyTypeEnum.Parachuter; //TODO: change graphics to a parachuter if (rnd > 0.5 && rnd < 0.85 && currentWave > 1) { this.GetComponent <SpriteRenderer>().sprite = enemySprites[1]; enemyType = enemyTypeEnum.Parachuter; } else if (rnd > 0.85 && currentWave > 2) { this.GetComponent <SpriteRenderer>().sprite = enemySprites[3]; this.GetComponent <DragAndDrop>().enabled = false; this.GetComponent <clickDitect>().enabled = true; enemyType = enemyTypeEnum.Armor; } //if (enemyType == enemyTypeEnum.Parachuter) //{ // this.GetComponent<SpriteRenderer>().sprite = enemySprites[1]; //} //if (enemyType == enemyTypeEnum.Armor) //{ // this.GetComponent<SpriteRenderer>().sprite = enemySprites[3]; //} }