Example #1
0
    public void UsePowerUp(PowerUpTypes powerUp)
    {
        Debug.Log("UsePowerUp: " + powerUp.ToString());
        switch (powerUp)
        {
        case PowerUpTypes.EXTRA_TIME:
            ExtraTime(); break;

        case PowerUpTypes.GOLDEN_KNIFE:
            GoldenKnife(); break;
        }
    }
Example #2
0
        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;
        }
Example #3
0
 /// <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;
 }
Example #4
0
        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;
        }
Example #5
0
 private void UpdateGraphics()
 {
     text.text = powerUp.ToString() + "\n" + PlayerStats.GetPowerUpUsesLeft(powerUp).ToString();
 }
Example #6
0
    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";
 }
Example #8
0
    /// <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);
    }