using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ScoreManager : MonoBehaviour
{
public int score;
Text text;
void Start()
{
text = GetComponent<Text> ();
score = 0f;
}
void Update ()
{
if (score < 0f)
text.text = "" + score;
}
public static void AddPoints (int pointsToAdd)
{
score += pointsToAdd;
}
public static void Reset()
{
score = 0f;
}
}
using UnityEngine;
using System.Collections;
public class CoinPickup : MonoBehaviour
{
public int pointsToAdd;
void OnTriggerEnter2D (Collider2D other)
{
if (other.GetComponent<AstromanController>() == null)
return;
ScoreManager.AddPoints(pointsToAdd);
Destroy (gameObject);
}
}