Quantcast
Channel: Latest Questions by Zargo
Viewing all articles
Browse latest Browse all 50

Wood Gathering problem

$
0
0
So i have a script where the player can chop down trees, But i want it so when the player chops down a tree, He gets wood. Heres the scripts. TREE CHOP-- var chopDistence = 10; var chopTime = 5; var inRange = false; function Start () { } function Update () { var player : Vector3 = gameObject.Find("Character").transform.position; var moveDirection : Vector3 = player - transform.position; if (moveDirection.magnitude < chopDistence) { inRange = true; } else if (moveDirection.magnitude > chopDistence) { inRange = false; } if (inRange == true) { if(Input.GetKeyUp(KeyCode.C)) { Timer(); } } } function Timer() { yield WaitForSeconds(chopTime); Destroy(gameObject); Player_Wood.players_wood += 1; guiText.text = Player_Money.players_money.ToString(); } PLAYERS WOOD-- static var players_wood = 0; function Start () { } function Update () { }

Viewing all articles
Browse latest Browse all 50


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>