@@ -0,0 +1,76 @@
using UnityEngine;
using System.Collections;


public class PowerupsManager : MonoBehaviour
{
private bool doublePoints;
private bool safeMode;

private bool powerupActive;
private float powerLengthCounter;

private ScoreManager scoreManager;
private PlatformGenerator platformGenerator;

private float spikeRate;
private float normalPointsPerSecond;

private PlatformDestroyer[] spikeList;

// Use this for initialization
void Start ()
{
scoreManager = FindObjectOfType<ScoreManager>();
platformGenerator = FindObjectOfType<PlatformGenerator>();

}

// Update is called once per frame
void Update ()
{
if (powerupActive)
{
powerLengthCounter -= Time.deltaTime;

if (doublePoints)
{
scoreManager.shouldDouble = true;

}

if (safeMode)
{
platformGenerator.randomSpikeThreshold = 0.0f;
spikeList = FindObjectsOfType<PlatformDestroyer>();
for (int i = 0, count = spikeList.Length; i < count; i++)
{
if(spikeList[i].gameObject.name.Contains("spikes"))
spikeList[i].gameObject.SetActive(false);
}
}

if (powerLengthCounter <= 0)
{
scoreManager.pointsPerSecond = normalPointsPerSecond;
platformGenerator.randomSpikeThreshold = spikeRate;
scoreManager.shouldDouble = false;
safeMode = false;
doublePoints = false;
}
}

}

public void ActivatePowerup(bool points, bool safe, float time)
{
doublePoints = points;
safeMode = safe;

normalPointsPerSecond = scoreManager.pointsPerSecond;
spikeRate = platformGenerator.randomSpikeThreshold;

powerLengthCounter = time;
powerupActive = true;
}
}
@@ -15,6 +15,7 @@ public class ScoreManager : MonoBehaviour {

public bool scoreIncreasing;

public bool shouldDouble;
// Use this for initialization
void Start () {
scoreValueText.text = "0";
@@ -28,7 +29,7 @@ public class ScoreManager : MonoBehaviour {
if (!scoreIncreasing)
return;
//scoreValueText.text = Mathf.RoundToInt(player.transform.position.x).ToString();
scoreCount += pointsPerSecond * Time.deltaTime;
AddScore(pointsPerSecond * Time.deltaTime);
scoreValueText.text = "Score: " + Mathf.Round(scoreCount);
if (scoreCount > highscoreCount)
{
@@ -38,8 +39,10 @@ public class ScoreManager : MonoBehaviour {
highscoreValueText.text = "High score: " + Mathf.RoundToInt(highscoreCount);
}

public void AddScore(int amount)
public void AddScore(float amount)
{
scoreCount += 100;
if (shouldDouble)
amount *= 2;
scoreCount += amount;
}
}

Large diffs are not rendered by default.