示例#1
0
        public void SetBossParams(bool Visible, string name, string subtitle, float curenerg, float maxenerg, hudColors colors, hudColors.EnergyBarColors barColors)
        {
            //calculateMode = calculate;
            hudColors       = colors;
            EnergyBarColors = barColors;

            visible = Visible;
            if (Visible)
            {
                bossBar.SetFilledColor(EnergyBarColors.filled);
                bossBar.SetShadowColor(EnergyBarColors.shadow);
                bossBar.SetEmptyColor(EnergyBarColors.empty);
                bossBar.SetColor2(Color.white);
                bossBar.SetFilledDrainSpeed(maxenerg);
                bossBar.SetCurrEnergy(curenerg, hudEnergyBar.ESetMode.Normal);
                bossBar.SetMaxEnergy(maxenerg);
                textBoss.text    = name;
                textBossSub.text = subtitle;
                //if (bossBar.GetComponent<Image>().color.a != 1 )
                //{
                //    Color a = new Color(bossBar.GetComponent<Image>().color.r, bossBar.GetComponent<Image>().color.g, bossBar.GetComponent<Image>().color.b, 1);
                //    bossBar.GetComponent<Image>().color = a;

                //    SamusPlugin.logger.Log(BepInEx.Logging.LogLevel.Message, "set bossBar image alpha to 1 manually");
                //}
            }

            curEnergy = curenerg;
            maxEnergy = maxenerg;
            bossIni   = true;
        }
示例#2
0
        // Start is called before the first frame update
        void Awake()
        {
            ini = false;
            string path = "combatHud/Envirorment";

            damagePulse        = 0f;
            damagePulseTimer   = 0f;
            arrowTimer         = 0f;
            warningColorLerp   = 0f;
            warningLerpAlpha   = 0f;
            threatStatus       = ThreatStatus.Normal;
            visible            = true;
            iconTranslateRange = 342.5f;
            hudColors          = new hudColors(true);

            //lhudTimer = new hudTimer();

            threatStuff = gameObject.transform.Find(path).gameObject;
            threatIcon  = new List <GameObject>();
            foreach (Transform transform in threatStuff.transform.Find("EnIcon").GetComponentsInChildren <Transform>())
            {
                threatIcon.Add(transform.gameObject);
                //Debug.Log(transform.gameObject + "[" + threatIcon.Count + "]");
            }
            arrowDown     = threatStuff.transform.Find("EnIcon/EnarrowDown").gameObject.GetComponent <Image>();
            arrowUp       = threatStuff.transform.Find("EnIcon/EnarrowUp").gameObject.GetComponent <Image>();
            threatWarning = threatStuff.transform.Find("EnIcon/warningText").gameObject.GetComponent <Text>();
            threatBar     = threatStuff.transform.Find("EnBarBack/EnBar").gameObject.GetComponent <hudEnergyBar>();
            //threatBar.initBars(threatBar.gameObject.GetComponent<Image>(), threatBar.gameObject.transform.parent.Find("EnBarShadow").gameObject.GetComponent<Image>());
            //Debug.Log(threatBar);
            hasArrows = arrowUp != null && arrowDown != null;

            threatIcon[0].GetComponent <Image>().color = hudColors.threatIconColor;
            threatIconTrans = threatIcon[0].transform;

            threatBar.SetFilledColor(hudColors.threatBarFilled);
            //Debug.Log(threatBar.GetFilledColor());
            threatBar.SetShadowColor(hudColors.threatBarShadow);
            //Debug.Log(threatBar.GetShadowColor());
            threatBar.SetEmptyColor(hudColors.threatBarEmpty);
            //Debug.Log(threatBar.GetEmptyColor());
            threatBar.SetTesselation(1f);
            threatBar.SetMaxEnergy(100f);
            threatBar.SetFilledDrainSpeed(9999f);
            threatBar.SetShadowDrainSpeed(9999f);
            threatBar.SetShadowDrainDelay(0f);
            threatBar.SetIsAlwaysResetTimer(false);

            if (threatWarning)
            {
                threatWarning.color = hudColors.threatWarningFont;
                threatWarning.gameObject.GetComponent <Outline>().effectColor = hudColors.threatWarningOutline;
            }

            //localMat = new Material(threatWarning.material);
            //threatWarning.material = localMat;
            debugIniMaxEnergy = threatBar.GetMaxEnergy();
            ini = true;
        }
示例#3
0
        //Material localMat;
        // Start is called before the first frame update
        void Awake()
        {
            rendertimings         = 0;
            arrowTimer            = 0f;
            missileWarningAlpha   = 0f;
            latestStatus          = invStatus.Normal;
            missileWarningPulse   = 0f;
            missileIconAltDeplete = 0f;
            missileIconIncrement  = 0f;
            visible            = true;
            IconTranslateRange = 342.5f;
            hudColors          = new hudColors(true);
            string path = "combatHud/Missiles";

            //hudType = HudType;
            //missileCapacity = MissileCapacity;
            //numMissiles = NumMissiles;
            //missilesActive = MissilesActive;
            missileIcon         = gameObject.transform.Find(path + "/MIcon").gameObject.GetComponent <Image>();
            missileDigits       = gameObject.transform.Find(path + "/MIcon/count").gameObject.GetComponent <Text>();
            missileBar          = gameObject.transform.Find(path + "/MBarBack/MBar").gameObject.GetComponent <hudEnergyBar>();
            missileWarning      = gameObject.transform.Find(path + "/MIcon/depleted").gameObject.GetComponent <Text>();
            arrowUp             = gameObject.transform.Find(path + "/MIcon/arrowUp").gameObject.GetComponent <Image>();
            arrowDown           = gameObject.transform.Find(path + "/MIcon/arrowDown").gameObject.GetComponent <Image>();
            hasArrows           = arrowUp && arrowDown;
            iconTransform       = missileIcon.transform;
            missileDigits.color = hudColors.missileDigitsFont;
            missileDigits.gameObject.GetComponent <Outline>().effectColor = hudColors.missileDigitsOutline;
            missileIcon.color = hudColors.missileIconColorInactive;
            missileBar.SetEmptyColor(hudColors.missileBarEmpty);
            missileBar.SetFilledColor(hudColors.missileBarFilled);
            missileBar.SetShadowColor(hudColors.missileBarShadow);
            missileBar.SetTesselation(1f);
            missileBar.SetMaxEnergy(5f);
            missileBar.SetFilledDrainSpeed(99f);
            missileBar.SetShadowDrainSpeed(20f);
            missileBar.SetShadowDrainDelay(0.7f);
            missileBar.SetIsAlwaysResetTimer(true);
            rIconLerp = 1f;
            missIni   = false;
            if (missileWarning)
            {
                missileWarning.color = hudColors.missileWarningFont;
                missileWarning.gameObject.GetComponent <Outline>().effectColor = hudColors.missileWarningOutline;
            }
            //localMat = new Material(missileDigits.material);
            //missileDigits.material = localMat;
            latestStatus = GetInvStatus();
        }
示例#4
0
        public void UpdateHud(float dt, float energyLowPulse)
        {
            //if (energyBar.GetCalculateMode() != calculateMode)
            //    energyBar.SetCalulateMode(calculateMode);
            if (cEnergyWarning)
            {
                if (energyLow)
                {
                    energyLowFader = Mathf.Min(energyLowFader + 2f * dt, 1f);
                    Color color = Color.white;
                    color.a = energyLowFader * energyLowPulse;
                    cEnergyWarning.material.color      = color;
                    combatEnergyWarning.material.color = color;
                    ballEnergyWarning.material.color   = color;
                }
                else
                {
                    energyLowFader = Mathf.Max(0f, energyLowFader - 2f * dt);
                    Color color = Color.white;
                    color.a = energyLowFader * energyLowPulse;
                    cEnergyWarning.material.color      = color;
                    combatEnergyWarning.material.color = color;
                    ballEnergyWarning.material.color   = color;
                }
                if (cEnergyWarning.material.color.a > 0f)
                {
                    cEnergyWarning.enabled      = true;
                    combatEnergyWarning.enabled = true;
                    ballEnergyWarning.enabled   = true;
                }

                else
                {
                    cEnergyWarning.enabled      = false;
                    combatEnergyWarning.enabled = false;
                    ballEnergyWarning.enabled   = false;
                }
            }

            if (cEnergyBar.GetFilledEnergy() != cachedBarEnergy || barDirty)
            {
                barDirty        = false;
                cachedBarEnergy = cEnergyBar.GetFilledEnergy();
                string lString = ((int)Mathf.Ceil(healthComponent.combinedHealthFraction * 100)).ToString("d2");
                cEnergyDigits.text      = lString;
                combatEnergyDigits.text = lString;
                ballEnergyDigits.text   = lString;
            }

            //hudColors.EnergyBarColors barColors = hudColors.getVisorEnergyBarColors();
            Color emptyColor   = energyLow ? cHudColors.energyBarEmptyLow : cBarColors.empty;
            Color filledColor  = energyLow ? cHudColors.energyBarFilledLow : cBarColors.filled;
            Color shadowColor  = energyLow ? cHudColors.energyBarShadowLow : cBarColors.shadow;
            Color useFillColor = Color.Lerp(filledColor, cHudColors.energyBarFlashColor, flashMag);

            if (energyLow)
            {
                useFillColor = Color.Lerp(useFillColor, new Color(1f, 0.8f, 0.4f, 1f), energyLowPulse);
            }
            cEnergyBar.SetFilledColor(useFillColor);

            cEnergyBar.SetShadowColor(shadowColor);
            cEnergyBar.SetEmptyColor(emptyColor);
            updateEnergyBarColors(useFillColor, shadowColor, emptyColor);
            cEnergyBar.updateBar(dt);
            //if (calculateMode == hudEnergyBar.CalculateMode.manual)
            //{

            //    energyBar.SetBarPercentage(healthP);

            //}
            cEnergyBar.Draw();
        }
示例#5
0
        //  public void SetCalculateMode(hudEnergyBar.CalculateMode calculate) { calculateMode = calculate; }
        // public hudEnergyBar.CalculateMode GetCalculateMode(){ return calculateMode; }
        //  public void SetHealthP(float per) { healthP = per; }
        public void initValues(hudTypes hud, float TankEnergy, float MaxEnergy, int totalTanks, int NumTanksFilled, HealthComponent health, bool EnergyLow)
        {
            //calculateMode = calculate;
            hudTypes         = hud;
            tankEnergy       = TankEnergy;
            totalEnergyTanks = totalTanks;
            numTanksFilled   = NumTanksFilled;
            energyLow        = EnergyLow;
            maxEnergy        = MaxEnergy;
            healthComponent  = health;
            cEmptyTanks      = new List <Image>();
            cFilledTanks     = new List <Image>();
            updateItems(hud);
            //cHudColors = colors;
            //barColors = colors.GetEnergyBarColors();
            //initColors = colors.GetEnergyInitColors();
            combatEnergyBar.SetTesselation(1f);
            ballEnergyBar.SetTesselation(1f);
            //energyBar.SetCalulateMode(calculate);

            combatEnergyBar.SetMaxEnergy(maxEnergy);
            ballEnergyBar.SetMaxEnergy(maxEnergy);
            combatEnergyBar.SetFilledColor(combatBarColors.filled);
            ballEnergyBar.SetFilledColor(ballBarColors.filled);
            combatEnergyBar.SetShadowColor(combatBarColors.shadow);
            ballEnergyBar.SetShadowColor(ballBarColors.shadow);
            combatEnergyBar.SetEmptyColor(combatBarColors.empty);
            ballEnergyBar.SetEmptyColor(ballBarColors.empty);

            combatEnergyBar.SetFilledDrainSpeed(99f);
            ballEnergyBar.SetFilledDrainSpeed(99f);
            combatEnergyBar.SetShadowDrainSpeed(20f);
            ballEnergyBar.SetShadowDrainSpeed(20f);
            combatEnergyBar.SetShadowDrainDelay(0.7f);
            ballEnergyBar.SetShadowDrainDelay(0.7f);
            combatEnergyBar.SetIsAlwaysResetTimer(false);
            ballEnergyBar.SetIsAlwaysResetTimer(false);
            cEnergyDigits.color      = cInitColors.digitsFont;
            combatEnergyDigits.color = combatInitColors.digitsFont;
            ballEnergyDigits.color   = ballInitColors.digitsFont;

            cEnergyDigits.gameObject.GetComponent <Outline>().effectColor      = cInitColors.digitsOutline;
            combatEnergyDigits.gameObject.GetComponent <Outline>().effectColor = combatInitColors.digitsOutline;
            ballEnergyDigits.gameObject.GetComponent <Outline>().effectColor   = ballInitColors.digitsOutline;

            cEnergyWarning.color      = cHudColors.energyWarningFont;
            combatEnergyWarning.color = combatHudColors.energyWarningFont;
            ballEnergyWarning.color   = ballHudColors.energyWarningFont;
            cEnergyWarning.gameObject.GetComponent <Outline>().effectColor      = cHudColors.energyWarningOutline;
            combatEnergyWarning.gameObject.GetComponent <Outline>().effectColor = combatHudColors.energyWarningOutline;
            ballEnergyWarning.gameObject.GetComponent <Outline>().effectColor   = ballHudColors.energyWarningOutline;
            if (energyLow)
            {
                cEnergyWarning.text      = "Energy Low";
                combatEnergyWarning.text = "Energy Low";
                ballEnergyWarning.text   = "Energy Low";
            }

            else
            {
                cEnergyWarning.text      = "";
                combatEnergyWarning.text = "";
                ballEnergyWarning.text   = "";
            }



            for (int i = 0; i < 6; i++)
            {
                cEmptyTanks[i].color       = cInitColors.tankEmpty;
                combatEmptyTanks[i].color  = combatInitColors.tankEmpty;
                ballEmptyTanks[i].color    = ballInitColors.tankEmpty;
                cFilledTanks[i].color      = cInitColors.tankFilled;
                combatFilledTanks[i].color = combatInitColors.tankFilled;
                ballFilledTanks[i].color   = ballInitColors.tankFilled;
            }
            for (int i = 0; i < 6; i++)
            {
                if (i < numTanksFilled)
                {
                    cFilledTanks[i].gameObject.SetActive(true);
                    combatFilledTanks[i].gameObject.SetActive(true);
                    ballFilledTanks[i].gameObject.SetActive(true);
                }


                else
                {
                    cFilledTanks[i].gameObject.SetActive(false);
                    combatFilledTanks[i].gameObject.SetActive(false);
                    ballFilledTanks[i].gameObject.SetActive(false);
                }
            }
            initHealth = true;
        }