public void LevelOneCheese() { userSum = 0; enemySum = 0; foreach (GameObject x in enemyPlayingTeam) { LeaguePlayerScript enem = x.GetComponent <LeaguePlayerScript>(); enem.randValue = Random.Range(1, 3); enem.UseAbility(); Debug.Log(enem.name + " : " + enem.randValue); enemySum = enemySum + enem.randValue; } foreach (LeaguePlayerScript x in userPlayingTeam) { x.randValue = Random.Range(1, 3); x.UseAbility(); Debug.Log(x.name + " : " + x.randValue); userSum = userSum + x.randValue; } if (userSum >= enemySum) { Debug.Log("victory"); } }
// Update is called once per frame public void AssignPlayersToTeam() { for (int i = 0; i < 5; i++) { playerSlots[i].GetComponent <BattleSlotScript>().player = teamManager.userTeamRoster[i]; playerSlots[i].GetComponent <BattleSlotScript>().AssignSprites(); } teamManager.AssignTeam(); userPlayingTeam = teamManager.userPlayingTeam; enemyPlayingTeam = enemyManager.enemyTeam1; int countPlayer = 0; foreach (LeaguePlayerScript x in userPlayingTeam) { x.enemyLaner = enemyPlayingTeam[countPlayer].GetComponent <LeaguePlayerScript>(); countPlayer++; } countPlayer = 0; foreach (GameObject x in enemyPlayingTeam) { LeaguePlayerScript enem = x.GetComponent <LeaguePlayerScript>(); enem.enemyLaner = userPlayingTeam[countPlayer]; countPlayer = 0; } }
public void StartBattle() { foreach (LeaguePlayerScript x in userPlayingTeam) { x.GetRandomValue(); Debug.Log(x.name + " : " + x.randValue); userSum = userSum + x.randValue; } foreach (GameObject x in enemyPlayingTeam) { LeaguePlayerScript enem = x.GetComponent <LeaguePlayerScript>(); enem.GetRandomValue(); Debug.Log(enem.name + " : " + enem.randValue); enemySum = enemySum + enem.randValue; } Debug.Log(userSum); Debug.Log(enemySum); userSum = 0; enemySum = 0; foreach (GameObject x in enemyPlayingTeam) { LeaguePlayerScript enem = x.GetComponent <LeaguePlayerScript>(); enem.UseAbility(); Debug.Log(enem.name + " : " + enem.randValue); enemySum = enemySum + enem.randValue; } foreach (LeaguePlayerScript x in userPlayingTeam) { x.UseAbility(); Debug.Log(x.name + " : " + x.randValue); userSum = userSum + x.randValue; } Debug.Log(userSum); Debug.Log(enemySum); }
public void CreatePlayer() { GameObject player = Instantiate(playerPrefab, new Vector3(50f, 50f, 0), Quaternion.identity); LeaguePlayerScript playerScript = player.GetComponent <LeaguePlayerScript>(); playerScript.name = listOfNames[playerListIndex]; int randMinValue = Random.Range(minValue, maxValue - 1); playerScript.minValue = randMinValue; int randMaxValue = 0; while (randMinValue > randMaxValue) { randMaxValue = Random.Range(minValue, maxValue); } playerScript.maxValue = randMaxValue; playerScript.maxValue = randMaxValue; playerScript.skill = listOfAbilities[playerListIndex]; playerScript.AssignSkill(); jacket = playerScript.jacket; hat = playerScript.hat; jacket.GetComponent <SpriteRenderer>().sprite = jacketList[playerListIndex]; hat.GetComponent <SpriteRenderer>().sprite = hatList[playerListIndex]; playerListIndex++; buttonList[buttonIndex].GetComponent <CharacterButtonPickScript>().player = player; buttonList[buttonIndex].GetComponent <CharacterButtonPickScript>().AssignSprites(); buttonIndex++; }