public void UsePowerUp(PowerUpTypes powerUp) { Debug.Log("UsePowerUp: " + powerUp.ToString()); switch (powerUp) { case PowerUpTypes.EXTRA_TIME: ExtraTime(); break; case PowerUpTypes.GOLDEN_KNIFE: GoldenKnife(); break; } }
public void ActivatePowerUp(PowerUpTypes powerUpType, bool active, float length) { if (active) { inGameActivePowerUpCutoffMaterial.SetFloat("_Cutoff", 0.0f); #if !(UNITY_4_3 || UNITY_4_4 || UNITY_4_5) if (useuGUI) { inGameActivePowerUpImage.sprite = inGamePowerUpSprites[(int)powerUpType]; } else { #endif #if COMPILE_NGUI inGameActivePowerUp.spriteName = powerUpType.ToString(); #endif #if !(UNITY_4_3 || UNITY_4_4 || UNITY_4_5) } #endif if (inGamePowerUpProgressWaitForSeconds == null) { inGamePowerUpProgressWaitForSeconds = new WaitForSeconds(0.05f); } inGamePowerUpData.duration = length; StartCoroutine("UpdatePowerUpProgress"); } else { StopCoroutine("UpdatePowerUpProgress"); } #if !(UNITY_4_3 || UNITY_4_4 || UNITY_4_5) if (useuGUI) { inGameActivePowerUpImage.gameObject.SetActive(active); } else { #endif #if COMPILE_NGUI inGameActivePowerUp.gameObject.SetActive(active); #endif #if !(UNITY_4_3 || UNITY_4_4 || UNITY_4_5) } #endif powerUpActive = active; }
/// <summary> /// Returns the prefab of the power up with the given type. /// </summary> /// <returns>The power up prefab.</returns> /// <param name="type">The type of the power up.</param> private GameObject getPowerUpPrefab(PowerUpTypes type) { string powerUpString = type.ToString(); return Resources.Load("Prefabs/PowerUps/" + powerUpString) as GameObject; }
private void UpdateGraphics() { text.text = powerUp.ToString() + "\n" + PlayerStats.GetPowerUpUsesLeft(powerUp).ToString(); }
public void activatePowerUp(PowerUpTypes powerUpType, bool active, float length) { if (active) { inGameActivePowerUpCutoffMaterial.SetFloat("_Cutoff", 0.0f); inGameActivePowerUp.spriteName = powerUpType.ToString(); if (inGamePowerUpProgressWaitForSeconds == null) { inGamePowerUpProgressWaitForSeconds = new WaitForSeconds(0.05f); } inGamePowerUpData.duration = length; StartCoroutine("updatePowerUpProgress"); } else { StopCoroutine("updatePowerUpProgress"); } inGameActivePowerUp.enabled = active; inGameActivePowerUpCutoff.enabled = active; powerUpActive = active; }
private void UpdateGraphics() { text.text = "ADD ONE" + "\n" + powerUp.ToString() + "\nFOR FREE"; }
/// <summary> /// Returns the prefab of the power up with the given type. /// </summary> /// <returns>The power up prefab.</returns> /// <param name="type">The type of the power up.</param> private GameObject getPowerUpPrefab(PowerUpTypes type) { string powerUpString = type.ToString(); return(Resources.Load("Prefabs/PowerUps/" + powerUpString) as GameObject); }