From cdd06568a58f9aef9b84a3a0de239f0c770f6a29 Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 1 Dec 2020 13:14:38 +0000 Subject: [PATCH] Started AI programming --- Assets/Scripts/monopoly/AI.cs | 13 +++++++++++++ Assets/Scripts/monopoly/AI.cs.meta | 11 +++++++++++ Assets/Scripts/monopoly/Main.cs | 6 ++++-- 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 Assets/Scripts/monopoly/AI.cs create mode 100644 Assets/Scripts/monopoly/AI.cs.meta diff --git a/Assets/Scripts/monopoly/AI.cs b/Assets/Scripts/monopoly/AI.cs new file mode 100644 index 0000000..774f840 --- /dev/null +++ b/Assets/Scripts/monopoly/AI.cs @@ -0,0 +1,13 @@ +using System.Collections; +using System.Collections.Generic; + +public class AI +{ + /* TODO + * Write out a way to roll a dice. + * Buy properties + * Buy houses + * Trade + * Etc... + */ +} diff --git a/Assets/Scripts/monopoly/AI.cs.meta b/Assets/Scripts/monopoly/AI.cs.meta new file mode 100644 index 0000000..4930cb3 --- /dev/null +++ b/Assets/Scripts/monopoly/AI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b0ed40fdbd0be7e4fa7cb5d3f95617d2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/monopoly/Main.cs b/Assets/Scripts/monopoly/Main.cs index 86281c1..35ea2cc 100644 --- a/Assets/Scripts/monopoly/Main.cs +++ b/Assets/Scripts/monopoly/Main.cs @@ -633,6 +633,7 @@ public class Board //Creating the class for the board mechanics. public class Player { public string name; //This is the username of the player + private bool isAI; //This defines if the player is an AI. private int playerNumber; //This is the player number in the queue public int money; //Initializes the variable for money. public int position; //Positions vary from 0-39 (40 squares on the board) (Go is 0) @@ -643,9 +644,10 @@ public class Player private Movement movement; private TextHandler textHandler; - public Player(string playerName, int playerNumber, GameObject player) + public Player(string playerName, bool isAI, int playerNumber, GameObject player) { name = playerName; //This initialises the username of the player + this.isAI = isAI; position = 0; //This sets to the default position - GO inJail = false; //This initialises that the player isn't in jail this.playerNumber = playerNumber; //This is the position in the queue that the player is in @@ -875,7 +877,7 @@ public class Main : MonoBehaviour //Names the game object player and a unique number Instantiate(playerTemplate, playerTemplate.transform.position, Quaternion.identity, playerParentGameObject.transform).name = $"Player{i}"; playersGameObjects.Add(GameObject.Find($"/Players/Player{i}")); //Adds to a list of GameObjects by searching for the GameObject. - players.Add(new Player($"Player {i}", i, playersGameObjects[i])); //Creates a unique player class for that specific GameObject + players.Add(new Player($"Player {i}", false, i, playersGameObjects[i])); //Creates a unique player class for that specific GameObject } Destroy(playerTemplate); //Deletes the player template GameObject.