You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

51 lines
1.1 KiB

using UnityEngine;
using System.Collections;
public class flameColor : MonoBehaviour {
public playerController player1;
public playerController player2;
public playerController player3;
public playerController player4;
private int playerLeader;
private int topscore;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
playerLeader = 1;
topscore = player1.score;
if (player2.score > topscore) {
playerLeader = 2;
topscore = player2.score;
}
if (player3.score > topscore) {
playerLeader = 3;
topscore = player3.score;
}
if (player4.score > topscore) {
playerLeader = 4;
topscore = player4.score;
}
if (playerLeader == 1){
gameObject.GetComponent<ParticleSystem>().startColor = new Color(0, 255, 255);
}
if (playerLeader == 2){
gameObject.GetComponent<ParticleSystem>().startColor = new Color(255, 255, 0);
}
if (playerLeader == 3){
gameObject.GetComponent<ParticleSystem>().startColor = new Color(255, 0, 255);
}
if (playerLeader == 4){
gameObject.GetComponent<ParticleSystem>().startColor = new Color(0, 255, 0);
}
}
}