void CheckPlayer() { int playersAround = 0; for (int i = 0; i < Board.possibleMoveableChars.Length; i++) { if (Board.possibleMoveableChars[i].rowPosition == 1000) { continue; } bool a = false; bool b = false; if (transform.GetComponent <Piece>().rowPosition == Board.possibleMoveableChars[i].rowPosition - 1 || transform.GetComponent <Piece>().rowPosition == Board.possibleMoveableChars[i].rowPosition + 1 || transform.GetComponent <Piece>().rowPosition == Board.possibleMoveableChars[i].rowPosition) { a = true; } if (transform.GetComponent <Piece>().colPosition == Board.possibleMoveableChars[i].colPosition - 1 || transform.GetComponent <Piece>().colPosition == Board.possibleMoveableChars[i].colPosition + 1 || transform.GetComponent <Piece>().colPosition == Board.possibleMoveableChars[i].colPosition) { b = true; } if (a && b) { playersAround += 1; } } if (!isEncumbered && playersAround >= 3) { isEncumbered = true; stats.health /= 3; if (stats.damage > 1) { stats.damage /= 2; } } UIValues resistance = resistanceObj.GetComponent <UIValues>(); resistance.SetValue(stats.health); UIValues attack = presenceObj.GetComponent <UIValues>(); attack.SetValue(stats.damage); }
void CheckPlayer() { int count = 0; for (int i = 0; i < Board.possibleMoveableChars.Length; i++) { if (Board.possibleMoveableChars[i].thePiece.GetComponent <Stats>().health <= 0) { if (selectedUnit == Board.possibleMoveableChars[i].GetPiece()) { selectedUnit = null; } Board.possibleMoveableChars[i].SetRowAndCol(1000, 1000); Board.possibleMoveableChars[i].GetPiece().transform.position = new Vector3(10000, 10000, 0); } //if (Board.possibleMoveableChars[i].rowPosition == 1000) //{ // count++; // continue; //} //int enemiesAround = 0; //for (int j = 0; j < Board.spawnedEnemies.Count; j++) //{ // if (Board.possibleMoveableChars[i].rowPosition == Board.spawnedEnemies[j].rowPosition - 1 || // Board.possibleMoveableChars[i].rowPosition == Board.spawnedEnemies[j].rowPosition || // Board.possibleMoveableChars[i].rowPosition == Board.spawnedEnemies[j].rowPosition + 1) // { // } // else // { // continue; // } // if (Board.possibleMoveableChars[i].colPosition == Board.spawnedEnemies[j].colPosition - 1 || // Board.possibleMoveableChars[i].colPosition == Board.spawnedEnemies[j].colPosition || // Board.possibleMoveableChars[i].colPosition == Board.spawnedEnemies[j].colPosition + 1) // { // } // else // { // continue; // } // // enemiesAround += 1; //} //if (Board.pirateBoss != null) //{ // if (Board.possibleMoveableChars[i].rowPosition == Board.pirateBoss.rowPosition - 1 || // Board.possibleMoveableChars[i].rowPosition == Board.pirateBoss.rowPosition || // Board.possibleMoveableChars[i].rowPosition == Board.pirateBoss.rowPosition + 1) // { // if (Board.possibleMoveableChars[i].colPosition == Board.pirateBoss.colPosition - 1 || // Board.possibleMoveableChars[i].colPosition == Board.pirateBoss.colPosition || // Board.possibleMoveableChars[i].colPosition == Board.pirateBoss.colPosition + 1) // { // enemiesAround += 2; // } // } //} // //if (enemiesAround >= 4) //{ // if (selectedUnit == Board.possibleMoveableChars[i].GetPiece()) // { // selectedUnit = null; // } // Board.possibleMoveableChars[i].SetRowAndCol(1000, 1000); // Board.possibleMoveableChars[i].GetPiece().transform.position = new Vector3(10000, 10000, 0); //} UIValues resistance = Board.possibleMoveableChars[i].thePiece.GetComponent <ValueHolder>().resistanceObj.GetComponent <UIValues>(); resistance.SetValue(Board.possibleMoveableChars[i].thePiece.GetComponent <Stats>().health); UIValues health = Board.possibleMoveableChars[i].thePiece.GetComponent <ValueHolder>().presenceObj.GetComponent <UIValues>(); health.SetValue(Board.possibleMoveableChars[i].thePiece.GetComponent <Stats>().damage); //resistance.SetValue(resistance.initialValue - enemiesAround); //Board.possibleMoveableChars[i].resistanceValue = resistance.initialValue - enemiesAround; } if (count >= 2 && !Board.first) { //GameObject.Find("WinScreen").GetComponentInChildren<YouWin>().youLose = true; } }