mirror of
https://github.com/smyalygames/monopoly.git
synced 2025-12-19 19:19:44 +01:00
yes
This commit is contained in:
27
Assets/Scripts/Waypoints.cs
Normal file
27
Assets/Scripts/Waypoints.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Waypoints : MonoBehaviour
|
||||
{
|
||||
|
||||
public GameObject[] waypoints;
|
||||
int current = 0;
|
||||
float rotSpeed;
|
||||
public float speed;
|
||||
float WPradius = 0;
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(Vector3.Distance(waypoints[current].transform.position, transform.position) < WPradius)
|
||||
{
|
||||
current++;
|
||||
if (current >= waypoints.Length)
|
||||
{
|
||||
current = 0;
|
||||
}
|
||||
}
|
||||
transform.position = Vector3.MoveTowards(transform.position, waypoints[current].transform.position, Time.deltaTime * speed);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Waypoints.cs.meta
Normal file
11
Assets/Scripts/Waypoints.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 550f9904aca105748a4db408bc7b4202
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
Assets/Scripts/board.cs
Normal file
40
Assets/Scripts/board.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class board : MonoBehaviour
|
||||
{
|
||||
|
||||
public class Board //Creating the class for the board mechanics.
|
||||
{
|
||||
public int houses; //Initialising houses
|
||||
public int hotels; //Initialising hotels
|
||||
// List<properties.Property> cards = new List<properties.Property>;
|
||||
|
||||
|
||||
|
||||
|
||||
public Board()
|
||||
{
|
||||
houses = 32; //Defining the amount of houses - They have a finite amount
|
||||
hotels = 12; //Defining the amount of hotels - They have a finite amount
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
Property cards = new Property("cunt cunt cunt", "test", 200, 400);
|
||||
Debug.Log(cards.ToString());
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/board.cs.meta
Normal file
11
Assets/Scripts/board.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d799e8e3a27dfe948be91afe90af4cad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
Assets/Scripts/player.cs
Normal file
56
Assets/Scripts/player.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class player : MonoBehaviour
|
||||
{
|
||||
|
||||
public class Player
|
||||
{
|
||||
|
||||
public int money; //Initializes the variable for money.
|
||||
public int position = 0; //Positions vary from 0-39 (40 squares on the board) (Go is 0)
|
||||
|
||||
public Player()
|
||||
{
|
||||
money = 1500;
|
||||
}
|
||||
|
||||
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.
|
||||
{
|
||||
position += length; //Adds the length that the player needs to move.
|
||||
}
|
||||
else //If they pass go.
|
||||
{
|
||||
position = length - (39 - position); //Makes it so that the position is
|
||||
money += 200; //Collect money as they pass go.
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void goToJail() //If the player needs to go to jail.
|
||||
{
|
||||
position = 40; //Special position for 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.
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/player.cs.meta
Normal file
11
Assets/Scripts/player.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74cd34bd689e47d48862579cdb566e89
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
104
Assets/Scripts/properties.cs
Normal file
104
Assets/Scripts/properties.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Property
|
||||
{
|
||||
public string title; //The name of the property.
|
||||
public string group; //The colour, station or utility.
|
||||
public int value; //How much it costs to buy.
|
||||
public int houseCost; //How much it costs to buy a house on that property.
|
||||
public int houses = 0; //How many houses it has. (Can have up to 4)
|
||||
public bool hotel = false; //Whether it has a hotel or not. (Can only have 1)
|
||||
public bool mortgage = false; //Whether the property has been mortgaged.
|
||||
|
||||
public Property(string name, string importGroup, int importValue, int house) //For houses.
|
||||
{
|
||||
//Initialising all the variables.
|
||||
title = name;
|
||||
group = importGroup;
|
||||
value = importValue;
|
||||
houseCost = house;
|
||||
}
|
||||
|
||||
public Property(string name, string importGroup, int importValue) //For stations or utility.
|
||||
{
|
||||
//Initialising all the variables.
|
||||
title = name;
|
||||
group = importGroup;
|
||||
value = importValue;
|
||||
}
|
||||
|
||||
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.
|
||||
{
|
||||
houses += 1; //Adds a house to the property.
|
||||
}
|
||||
}
|
||||
|
||||
public void removeHouse() //Used to remove a house.
|
||||
{
|
||||
if (houses > 0) //Checks if there is at least 1 house on the property.
|
||||
{
|
||||
houses -= 1; //Removes the house from the property.
|
||||
}
|
||||
}
|
||||
|
||||
public void addHotel() //Used to add a hotel.
|
||||
{
|
||||
if (houses == 4) //Checks if the user has enough houses.
|
||||
{
|
||||
houses = 0; //Removes all the houses.
|
||||
hotel = true; //Creates the hotel.
|
||||
}
|
||||
}
|
||||
|
||||
public void removeHotel() //Removes the hotel.
|
||||
{
|
||||
if (hotel) //Checks if they have a hotel already.
|
||||
{
|
||||
houses = 4; //Gives the user back their 4 houses.
|
||||
hotel = false; //Removes the hotel.
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void mortgageProperty() //Mortgages the property.
|
||||
{
|
||||
if (!hotel && (houses == 0)) //Checks if there is not a hotel and if there are no houses.
|
||||
{
|
||||
mortgage = true; //Mortgages the property.
|
||||
}
|
||||
}
|
||||
|
||||
public void unmortgageProperty() //Removes the mortgage on the property.
|
||||
{
|
||||
if (mortgage) //Checks if the property has been mortgaged.
|
||||
{
|
||||
mortgage = false; //Removes the mortgage.
|
||||
}
|
||||
}
|
||||
|
||||
public string printTitle() {
|
||||
return title;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class properties : MonoBehaviour
|
||||
{
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/properties.cs.meta
Normal file
11
Assets/Scripts/properties.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ede8e3ed967bcfe42886d342fcf3d755
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user