mirror of
https://github.com/smyalygames/monopoly.git
synced 2025-05-18 06:14:10 +02:00
Allowed buying property and next turn
This commit is contained in:
parent
1b8bf63ae2
commit
f81194c110
@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AI
|
||||
{
|
||||
@ -32,6 +33,7 @@ public class AI
|
||||
/* TASK DESCRIPTIONS:
|
||||
* 0 - Move
|
||||
* 1 - Buy
|
||||
* 99 - End Turn
|
||||
*/
|
||||
|
||||
public AI(int money)
|
||||
@ -52,16 +54,23 @@ public class AI
|
||||
//The AI will decide to move.
|
||||
RollDice(); //The AI will roll the dice.
|
||||
currentTask = 0; //It will set the current task to 0 to represent movement.
|
||||
startedRound = true;
|
||||
}
|
||||
else if (buyProperty)
|
||||
{
|
||||
currentTask = 1; //This will buy a property.
|
||||
buyProperty = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("I NEED TO FINISH");
|
||||
currentTask = 99;
|
||||
startedRound = false;
|
||||
}
|
||||
return currentTask;
|
||||
}
|
||||
|
||||
public void RollDice()
|
||||
private void RollDice()
|
||||
{
|
||||
dice1 = random.Next(1, 7);
|
||||
dice2 = random.Next(1, 7);
|
||||
|
@ -357,6 +357,9 @@ public class Board //Creating the class for the board mechanics.
|
||||
case 1: //Buy Property
|
||||
BuyProperty();
|
||||
break;
|
||||
case 99:
|
||||
NextPlayer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -403,6 +406,7 @@ public class Board //Creating the class for the board mechanics.
|
||||
}
|
||||
else
|
||||
{
|
||||
AINextTask();
|
||||
players[currentPlayer].AI.buyProperty = false;
|
||||
}
|
||||
return false; //Returns false if the property is not buybale.
|
||||
@ -454,6 +458,10 @@ public class Board //Creating the class for the board mechanics.
|
||||
buttonHandler.DisableBuying(); //Removes the buy button.
|
||||
buttonHandler.EnableNextTurn();
|
||||
}
|
||||
else
|
||||
{
|
||||
AINextTask();
|
||||
}
|
||||
return; //Stops the function
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user