i trying to get a scoremanager script working it work find but i want to add a score multiplier to every enemy when i kill the enemy and boss. and also text showing how much score i gain and fade out like this game
this is my scoremanager script
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ScoreManager : MonoBehaviour {
public static int score;
Text text;
void Awake ()
{
text = GetComponent<Text> ();
score = 0;
}
// Update is called once per frame
void Update (){
text.text = "" + score;
}
}
I Have a Another Score script but i still want the multiplier
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ScoreManager : MonoBehaviour {
public static int score{ get; private set;}
float lastEnemyKillTime;
int streakCount;
float streakExpiryTime = 1;
public Text scoreUI;
Text text;
void Start ()
{
Health.EnemyDeath += OnEnemyKilled;
PlayerHealth.PlayerDeath += OnPlayerDeath;
text = GetComponent<Text> ();
score = 0;
}
void OnEnemyKilled ()
{
if (Time.time < lastEnemyKillTime + streakExpiryTime) {
streakCount++;
} else {
streakCount = 0;
}
lastEnemyKillTime = Time.time;
score += 5 + (int)Mathf.Pow(5, streakCount);
}
void OnPlayerDeath ()
{
Health.EnemyDeath -= OnEnemyKilled;
}
// Update is called once per frame
void Update (){
scoreUI.text = score.ToString("D6");
text.text = "" + score;
}
}