diff options
author | Jakob Stendahl <jakob.stendahl@outlook.com> | 2017-10-06 16:04:38 +0200 |
---|---|---|
committer | Jakob Stendahl <jakob.stendahl@outlook.com> | 2017-10-06 16:04:38 +0200 |
commit | e13fd4cf1fc0ad9eff857295fd5abc15ab01462c (patch) | |
tree | 91786e1557ef801a64e059857dc0ad71c1d281df /td/Assets/Scripts/player.cs | |
parent | c5a786326fab8850342005a1eb4da9653c4642c8 (diff) | |
download | TD-e13fd4cf1fc0ad9eff857295fd5abc15ab01462c.tar.gz TD-e13fd4cf1fc0ad9eff857295fd5abc15ab01462c.zip |
Startet på tårn, fiksa dev-mode, laga stats UI
Diffstat (limited to 'td/Assets/Scripts/player.cs')
-rw-r--r-- | td/Assets/Scripts/player.cs | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/td/Assets/Scripts/player.cs b/td/Assets/Scripts/player.cs new file mode 100644 index 0000000..b972477 --- /dev/null +++ b/td/Assets/Scripts/player.cs @@ -0,0 +1,48 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class player : MonoBehaviour { + + public int startingMoney; + + GameObject[] towers; + + int playerMoney; + int playerScore; + + bool placingTower; + + void Awake() { + playerMoney = startingMoney; + } + + #region stats + public int score() { + return playerScore; + } + + public void score(int points) { + playerScore += points; + } + + public int money() { + return playerMoney; + } + + public void moneyAdd(int sum) { + playerMoney += sum; + } + + public void moneySubtract(int sum) { + playerMoney -= sum; + } + #endregion + + public void spawnTower(GameObject towerType) { + GameObject tower = Instantiate (towerType, new Vector3 (0, 0, 0), Quaternion.identity, transform.Find ("towers").transform); + tower script = tower.GetComponent <tower>(); + script.player = this; + } + +} |