Fixed up the classes with voids

This commit is contained in:
smyalygames 2020-03-05 15:24:13 +00:00
parent 00759d32f8
commit 33834069d3
3 changed files with 86 additions and 82 deletions

View File

@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using properties;
public class board : MonoBehaviour
{
@ -9,6 +10,7 @@ public class board : MonoBehaviour
{
public int houses; //Initialising houses
public int hotels; //Initialising hotels
List<properties.Property> cards = new List<properties.Property>;
public Board()
{

View File

@ -13,10 +13,10 @@ public class player : MonoBehaviour
public Player()
{
money = 1500;
}
public Move(int length) //This moves the player a certain length (what they got from rolling the dice).
public void Move(int length) //This moves the player a certain length (what they got from rolling the dice).
{
if (position + length < 40) //Checks if the player will not pass go.
{
@ -30,12 +30,12 @@ public class player : MonoBehaviour
}
}
public goToJail() //If the player needs to go to jail.
public void goToJail() //If the player needs to go to jail.
{
position = 40; //Special position for jail.
}
public getOutOfJail(int length) //If the player is going out of jail.
public void getOutOfJail(int length) //If the player is going out of jail.
{
position = 10; //Moves the player out of jail.
Move(length); //Then moves the player.

View File

@ -2,9 +2,6 @@
using System.Collections.Generic;
using UnityEngine;
public class properties : MonoBehaviour
{
public class Property
{
public string title; //The name of the property.
@ -32,7 +29,7 @@ public class properties : MonoBehaviour
value = importValue;
}
public addHouse() //Used to add a house.
public void addHouse() //Used to add a house.
{
if (!mortgage && (houses < 4) && !hotel) //Checks if there is not a mortgage and there are less than 4 houses and that there isn't a hotel.
{
@ -40,7 +37,7 @@ public class properties : MonoBehaviour
}
}
public removeHouse() //Used to remove a house.
public void removeHouse() //Used to remove a house.
{
if (houses > 0) //Checks if there is at least 1 house on the property.
{
@ -48,7 +45,7 @@ public class properties : MonoBehaviour
}
}
public addHotel() //Used to add a hotel.
public void addHotel() //Used to add a hotel.
{
if (houses == 4) //Checks if the user has enough houses.
{
@ -57,7 +54,7 @@ public class properties : MonoBehaviour
}
}
public removeHotel() //Removes the hotel.
public void removeHotel() //Removes the hotel.
{
if (hotel) //Checks if they have a hotel already.
{
@ -67,23 +64,28 @@ public class properties : MonoBehaviour
}
}
public mortgageProperty() //Mortgages the property.
public void mortgageProperty() //Mortgages the property.
{
if (!hotel && (houses = 0)) //Checks if there is not a hotel and if there are no houses.
if (!hotel && (houses == 0)) //Checks if there is not a hotel and if there are no houses.
{
mortgage = true; //Mortgages the property.
}
}
public unmortgageProperty() //Removes the mortgage on the property.
public void unmortgageProperty() //Removes the mortgage on the property.
{
if (mortgage)
if (mortgage) //Checks if the property has been mortgaged.
{
mortgage = false;
mortgage = false; //Removes the mortgage.
}
}
}
public class properties : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{