Quantcast
Channel: Questions in topic: "count"
Viewing all articles
Browse latest Browse all 187

Count >= then object tag becomes active

$
0
0
"Pickup" the Diamonds. After 7 Diamonds have reached. Objective: The portal opens and the WinPad trigger is active. This code runs but whenever I go over the Winpad its still active. I dont want it to be active until 7 diamonds have been met. C# using UnityEngine; using System.Collections; public class PlayerController1 : MonoBehaviour { public GUIText CountText; public GUIText WinText; private int count; void Update() { } void start () { count = 0; SetCountText (); WinText.text = ""; } void FixedUpdate () { } void OnTriggerEnter(Collider other) { { if (other.gameObject.tag == "pickup") { other.gameObject.SetActive (false); count = count + 1; SetCountText (); } if(other.gameObject.tag == "WinPad") { if(count >= 7) other.renderer.enabled = true; } } } void SetCountText () { CountText.text = "Diamonds " + count.ToString (); if(count >= 7) { WinText.text = "Portal Open"; animation.Play("spawn"); } } }

Viewing all articles
Browse latest Browse all 187

Trending Articles



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