Quantcast
Channel: Answers by "shriya"
Viewing all articles
Browse latest Browse all 98

Answer by shriya

$
0
0
Hi, Got it working.Check below the scripts using UnityEngine; using System.Collections; public class ScoreperSec : MonoBehaviour { public int startingScore = 0; public int currentScore = 0; public GUIText scoregui; private float time; public static int score; public static int localscore; void Update (){ time+=Time.deltaTime; print ((int)time); localscore = (int)time * 100; score = localscore + coins.coinscore; Debug.Log ("total score "+score); // scoregui.text = "Score: "+ score; } } this is the coin one using UnityEngine; using System.Collections; public class coins : MonoBehaviour { public static int coinscore; // Use this for initialization void OnTriggerEnter(Collider coll) { Debug.Log ("Trigger enter"); if (coll.gameObject.tag == "Player"){ coinscore += 1158; Debug.Log ("coins score"+ScoreperSec.score); Destroy(this.gameObject); } } } Hope it helps :)

Viewing all articles
Browse latest Browse all 98

Trending Articles



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