When I click on the ruby it prints a message and adds 100 points to my daikon forge gui label in the game.
I just need to disable the ruby after those two steps. Any ideas? Thanks in advance ![]()
using UnityEngine;
using System.Collections;
public class TouchScore : MonoBehaviour {
//varibles
private RaycastHit hit;
private GUIManager guiManager;
int score;
void Update()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Input.GetMouseButtonDown(0))
{
print(Input.mousePosition);
if (Physics.Raycast(ray, out hit, 1000))
{
if (hit.collider.CompareTag("Ruby"))
{
print("Hit ruby");
ProcessTreasure(GameObject go);
}
}
}
}
void Start()
{
GameObject guiManagerGO = GameObject.Find("GUIManager");
if(!guiManagerGO)
Debug.LogError("No GUIManager found!", this);
guiManager = guiManagerGO.GetComponent<GUIManager>();
}
public void ProcessTreasure(GameObject go)
{
score = score + 100;
// Update the score
guiManager.SetTreasureScoreTo(score.ToString());
go.SetActive(false);
}
}