Exemplo n.º 1
0
    public void AddMana(DragonType.eDragonType dragonType)
    {
        switch (dragonType)
        {
        case DragonType.eDragonType.AirDragon:
            ManaYellow += ManaToAdd;
            ManaYellow  = Mathf.Clamp(ManaYellow, 0f, ManaYellowMax);
            return;

        case DragonType.eDragonType.EarthDragon:
            ManaGreen += ManaToAdd;
            ManaGreen  = Mathf.Clamp(ManaGreen, 0f, ManaGreenMax);
            return;

        case DragonType.eDragonType.FireDragon:
            ManaRed += ManaToAdd;
            ManaRed  = Mathf.Clamp(ManaRed, 0f, ManaRedMax);
            return;

        case DragonType.eDragonType.WaterDragon:
            ManaBlue += ManaToAdd;
            ManaBlue  = Mathf.Clamp(ManaBlue, 0f, ManaBlueMax);
            return;
        }

        return;
    }
 void DragonPowerUp(DragonType.eDragonType dragonType)
 {
     if (ManaAdded != null)
     {
         ManaAdded(dragonType);
     }
 }
    void PlaySFX()
    {
        audioSource.Stop();
        thisDragon = dragonType.DragonTypeV;
        switch (thisDragon)
        {
        case DragonType.eDragonType.AirDragon:
            audioSource.clip = clips[0];
            audioSource.Play();
            break;

        case DragonType.eDragonType.EarthDragon:
            audioSource.clip = clips[1];
            audioSource.Play();
            break;

        case DragonType.eDragonType.FireDragon:
        case DragonType.eDragonType.SuperDragon:
            audioSource.clip = clips[2];
            audioSource.Play();
            break;

        case DragonType.eDragonType.WaterDragon:
            audioSource.clip = clips[3];
            audioSource.Play();
            break;
        }
    }
 // Use this for initialization
 void Start()
 {
     dragonType  = GetComponentInParent <DragonType>();
     thisDragon  = dragonType.DragonTypeV;
     audioSource = GetComponent <AudioSource>();
     stepSource  = transform.parent.GetComponent <AudioSource>();
 }
Exemplo n.º 5
0
 void DragonPowerUp(DragonType.eDragonType dragonType)
 {
     if (ManaAdded != null)
     {
         ManaAdded(dragonType);
         sk = FindObjectOfType <ScoreKeeper>();
         if (sk != null)
         {
             sk.AddScore();
         }
         else
         {
             Debug.LogWarning("Scorekeeper object missing, cannot add score.");
         }
     }
 }
Exemplo n.º 6
0
    public float GetMana(DragonType.eDragonType dragonType)
    {
        float pct = 0;

        switch (dragonType)
        {
        case DragonType.eDragonType.AirDragon:
            pct = Mathf.Clamp((ManaYellow / ManaYellowMax) * 100, 0, 100);
            break;

        case DragonType.eDragonType.EarthDragon:
            pct = Mathf.Clamp((ManaGreen / ManaGreenMax) * 100, 0, 100);
            break;

        case DragonType.eDragonType.FireDragon:
            pct = Mathf.Clamp((ManaRed / ManaRedMax) * 100, 0, 100);
            break;

        case DragonType.eDragonType.WaterDragon:
            pct = Mathf.Clamp((ManaBlue / ManaBlueMax) * 100, 0, 100);
            break;
        }
        return(pct);
    }