Hello I am making 2D platformer for two players and now I am stucked. I want to count score for both players and then compare it who wins. Can you help me?
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class SimplePlatformController : MonoBehaviour
{
public GUIText scoreText;
private int score;
public SimplePlatformController player1;
public SimplePlatformController player2;
void Start()
{
score = 0;
UpdateScore();
}
public void AddScore (int newScoreValue)
{
score += newScoreValue;
UpdateScore();
}
void UpdateScore ()
{
scoreText.text = "Korunky: " + score;
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.CompareTag("PickUp"))
{
other.gameObject.SetActive(false);
}
}
}