En breves instantes video explicativo........
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AUMENTAPUNTOSP : MonoBehaviour {
// Create public variables for player speed, and for the Text UI game objects
public float speed;
public Text countText;
public Text winText;
// Create private references to the rigidbody component on the player, and the count of pick up objects picked up so far
private Rigidbody rb;
private int count;/// <summary>
void Start ()
{
// Assign the Rigidbody component to our private rb variable
rb = GetComponent<Rigidbody>();
// Set the count to zero
count = 0;
// Run the SetCountText function to update the UI (see below)
SetCountText ();
// Set the text property of our Win Text UI to an empty string, making the 'You Win' (game over message) blank
winText.text = "";
}
// store a reference to that collider in a variable named 'other'..
void OnTriggerEnter(Collider other)
{
//if (other.gameObject.CompareTag ("ogri2"))
if (other.gameObject.CompareTag ("MATA"))
//if (other.gameObject.CompareTag ("lateral"))
{
// Make the other game object (the pick up) inactive, to make it disappear
// other.gameObject.SetActive (false);////ESTO DE AQUI SI ESTA ACTIVADO BORRA EL GRAFICO GIRATORIO MUY OMPORTANTISIMO
// Add one to the score variable 'count'
count = count + 1;
// Run the 'SetCountText()' function (see below)
SetCountText ();
}
}
// Create a standalone function that can update the 'countText' UI and check if the required amount to win has been achieved
void SetCountText()
{
// Update the text field of our 'countText' variable
//countText.text = "Count: " + count.ToString ();
countText.text = "PUNTOS: " + count.ToString ();
// Check if our 'count' is equal to or exceeded 12
//if (count == 11)
//if (count >= 11) /////////original
if (count >= 44) ////////7original
{
// Destroy (gameObject);
Application.LoadLevel (1);/////7originalllllllllllllllllllllllllllll
}
}
}
------------------------------------------------------------------------
-------------------------------------------------------------------
------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class AUMENTAPUNTOSPlateral : MonoBehaviour {
// Create public variables for player speed, and for the Text UI game objects
public float speed;
public Text countText;
public Text winText;
// Create private references to the rigidbody component on the player, and the count of pick up objects picked up so far
private Rigidbody rb;
private int count;/// <summary>
void Start ()
{
// Assign the Rigidbody component to our private rb variable
rb = GetComponent<Rigidbody>();
// Set the count to zero
count = 44;
// Run the SetCountText function to update the UI (see below)
SetCountText ();
// Set the text property of our Win Text UI to an empty string, making the 'You Win' (game over message) blank
winText.text = "";
}
// store a reference to that collider in a variable named 'other'..
void OnTriggerEnter(Collider other)
{
//if (other.gameObject.CompareTag ("ogri2"))
//if (other.gameObject.CompareTag ("MATA"))
if (other.gameObject.CompareTag ("lateral"))
{
// Make the other game object (the pick up) inactive, to make it disappear
// other.gameObject.SetActive (false);////ESTO DE AQUI SI ESTA ACTIVADO BORRA EL GRAFICO GIRATORIO MUY OMPORTANTISIMO
// Add one to the score variable 'count'
count = count + 10;
// Run the 'SetCountText()' function (see below)
SetCountText ();
}
}
// Create a standalone function that can update the 'countText' UI and check if the required amount to win has been achieved
void SetCountText()
{
// Update the text field of our 'countText' variable
//countText.text = "Count: " + count.ToString ();
countText.text = "PUNTOS: " + count.ToString ();
// Check if our 'count' is equal to or exceeded 12
//if (count == 11)
//if (count >= 11) /////////original
if (count >= 4) ////////7original
{
// Destroy (gameObject);
//Application.LoadLevel (1);/////7originalllllllllllllllllllllllllllll
}
}
}