示例#1
0
 public invStatus GetInvStatus()
 {
     if (missileBar.GetSetEnergy() == 0f)
     {
         return(invStatus.Depleted);
     }
     else if (missileBar.GetActualFraction() < 0.2f && missileBar.GetActualFraction() > 0)
     {
         return(invStatus.Warning);
     }
     else
     {
         return(invStatus.Normal);
     }
 }
示例#2
0
 public float GetCurrentHealth()
 {
     return(bossBar.GetSetEnergy());
 }
示例#3
0
        public void UpdateHud(float dt)
        {
            threatBar.updateBar(dt);
            debugMaxEnergy = threatBar.GetMaxEnergy();
            Color warningColor = Color.Lerp(hudColors.threatIconColor, hudColors.threatIconWarning, warningColorLerp);

            float maxThreatEnergy = 10f;


            if (arrowTimer > 0f)
            {
                arrowUp.enabled = true;
                arrowTimer      = Mathf.Max(0f, arrowTimer - dt);
                Color color = warningColor;
                color.a           = arrowTimer / 0.5f;
                arrowUp.color     = color;
                arrowDown.enabled = false;
            }
            else if (arrowTimer < 0f)
            {
                arrowDown.enabled = true;
                arrowTimer        = Mathf.Min(0f, arrowTimer + dt);
                Color color = warningColor;
                color.a         = -arrowTimer / 0.5f;
                arrowDown.color = color;
                arrowUp.enabled = false;
            }
            else
            {
                arrowUp.enabled   = false;
                arrowDown.enabled = false;
            }


            if (threatDist <= maxThreatEnergy)
            {
                float tmp = threatDist - (maxThreatEnergy - threatBar.GetSetEnergy());



                debugTMP = tmp;
                if (tmp < -0.01f)
                {
                    arrowTimer = 0.5f;
                }
                else if (tmp > 0.01f)
                {
                    arrowTimer = -0.5f;
                }
            }
            else
            {
                arrowTimer = 0f;
            }

            if (threatDist <= maxThreatEnergy)
            {
                threatBar.SetCurrEnergy(threatBar.GetMaxEnergy() - threatDist, hudEnergyBar.ESetMode.Normal);
                threatIcon[0].GetComponent <Image>().color = warningColor;
            }
            else
            {
                threatBar.SetCurrEnergy(0f, hudEnergyBar.ESetMode.Normal);
                threatIcon[0].GetComponent <Image>().color = hudColors.threatIconSafeColor;
            }

            threatIcon[0].transform.localPosition = new Vector3(0f, Mathf.Max(0f, maxThreatEnergy - threatDist) * iconTranslateRange / maxThreatEnergy, 0f);

            if (threatWarning)
            {
                if (threatBar.GetActualFraction() > 0.8f)
                {
                    threatWarning.enabled = true;
                }
                else
                {
                    threatWarning.enabled = false;
                }

                ThreatStatus newStatus;
                if (maxThreatEnergy == threatBar.GetSetEnergy())
                {
                    newStatus = ThreatStatus.Damage;
                }
                else if (threatBar.GetActualFraction() > 0.8f)
                {
                    newStatus = ThreatStatus.Warning;
                }
                else
                {
                    newStatus = ThreatStatus.Normal;
                }

                if (threatStatus != newStatus)
                {
                    string tString = "";
                    if (newStatus == ThreatStatus.Warning)
                    {
                        tString = "Warning";
                    }
                    else if (newStatus == ThreatStatus.Damage)
                    {
                        tString = "Damage";
                    }

                    threatWarning.text = tString;

                    if (threatStatus == ThreatStatus.Normal && newStatus == ThreatStatus.Warning)
                    {
                        //AkSoundEngine.PostEvent(1988175364, gameObject);
                        SamusHUD.playSound(1988175364, gameObject);
                    }
                    else if (newStatus == ThreatStatus.Damage)
                    {
                        //AkSoundEngine.PostEvent(1246534283, gameObject);
                        SamusHUD.playSound(1246534283, gameObject);
                    }

                    threatStatus = newStatus;
                }
            }

            float oldDPT = damagePulseTimer;

            damagePulseTimer = Mathf.Abs(fmod(GetSecondsMod900(), 0.5f));
            if (damagePulseTimer < 0.25f)
            {
                damagePulse = damagePulseTimer / 0.25f;
            }
            else
            {
                damagePulse = (0.5f - damagePulseTimer) / 0.25f;
            }

            if (threatStatus == ThreatStatus.Damage && damagePulseTimer < oldDPT)
            {
                //AkSoundEngine.PostEvent(1246534283, gameObject);
                SamusHUD.playSound(1246534283, gameObject);
            }

            if (threatWarning)
            {
                if (threatStatus != ThreatStatus.Normal)
                {
                    warningLerpAlpha = Mathf.Min(warningLerpAlpha + 2f * dt, 1f);
                    Color color = Color.white;
                    color.a = warningLerpAlpha * damagePulse;
                    threatWarning.material.color = color;
                }
                else
                {
                    warningLerpAlpha = Mathf.Max(0f, warningLerpAlpha - 2f * dt);
                    Color color = Color.white;
                    color.a = warningLerpAlpha * damagePulse;
                    threatWarning.material.color = color;
                }
                if (threatWarning.material.color.a > 0f)
                {
                    threatWarning.enabled = true;
                }
                else
                {
                    threatWarning.enabled = false;
                }
            }

            if (threatStatus == ThreatStatus.Damage)
            {
                warningColorLerp = Mathf.Min(warningColorLerp + 2f * dt, 1f);
            }
            else
            {
                warningColorLerp = Mathf.Max(0f, warningColorLerp - 2f * dt);
            }
        }