示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        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 hudChangingColors.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(10f);
        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;
    }
示例#2
0
    //Material localMat;
    // Start is called before the first frame update
    void Start()
    {
        rendertimings         = 0;
        arrowTimer            = 0f;
        missileWarningAlpha   = 0f;
        latestStatus          = invStatus.Normal;
        missileWarningPulse   = 0f;
        missileIconAltDeplete = 0f;
        missileIconIncrement  = 0f;
        visible            = true;
        IconTranslateRange = 342.5f;
        hudColors          = new hudChangingColors.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();
    }
示例#3
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, int totalTanks, int NumTanksFilled, bool EnergyLow)
    {
        //calculateMode = calculate;
        hudTypes         = hud;
        tankEnergy       = TankEnergy;
        totalEnergyTanks = totalTanks;
        numTanksFilled   = NumTanksFilled;
        energyLow        = EnergyLow;
        cEmptyTanks      = new List <Image>();
        cFilledTanks     = new List <Image>();
        updateItems(hud);
        combatEnergyBar.SetTesselation(1f);
        ballEnergyBar.SetTesselation(1f);
        //energyBar.SetCalulateMode(calculate);

        combatEnergyBar.SetMaxEnergy(100f);
        ballEnergyBar.SetMaxEnergy(100f);
        combatEnergyBar.SetFilledColor(hudColors.getVisorEnergyBarColors(true).filled);
        ballEnergyBar.SetFilledColor(hudColors.getVisorEnergyBarColors(false).filled);
        combatEnergyBar.SetShadowColor(hudColors.getVisorEnergyBarColors(true).shadow);
        ballEnergyBar.SetShadowColor(hudColors.getVisorEnergyBarColors(false).shadow);
        combatEnergyBar.SetEmptyColor(hudColors.getVisorEnergyBarColors(true).empty);
        ballEnergyBar.SetEmptyColor(hudColors.getVisorEnergyBarColors(false).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      = initColors.digitsFont;
        combatEnergyDigits.color = hudColors.getVisorEnergyInitColors(true).digitsFont;
        ballEnergyDigits.color   = hudColors.getVisorEnergyInitColors(false).digitsFont;

        cEnergyDigits.gameObject.GetComponent <Outline>().effectColor      = initColors.digitsOutline;
        combatEnergyDigits.gameObject.GetComponent <Outline>().effectColor = hudColors.getVisorEnergyInitColors(true).digitsOutline;
        ballEnergyDigits.gameObject.GetComponent <Outline>().effectColor   = hudColors.getVisorEnergyInitColors(false).digitsOutline;

        cEnergyWarning.color      = hudColors.energyWarningFont;
        combatEnergyWarning.color = hudColors.energyWarningFont;
        ballEnergyWarning.color   = hudColors.energyWarningFont;
        cEnergyWarning.gameObject.GetComponent <Outline>().effectColor      = hudColors.energyWarningOutline;
        combatEnergyWarning.gameObject.GetComponent <Outline>().effectColor = hudColors.energyWarningOutline;
        ballEnergyWarning.gameObject.GetComponent <Outline>().effectColor   = hudColors.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       = initColors.tankEmpty;
            combatEmptyTanks[i].color  = hudColors.getVisorEnergyInitColors(true).tankEmpty;
            ballEmptyTanks[i].color    = hudColors.getVisorEnergyInitColors(false).tankEmpty;
            cFilledTanks[i].color      = initColors.tankFilled;
            combatFilledTanks[i].color = hudColors.getVisorEnergyInitColors(true).tankFilled;
            ballFilledTanks[i].color   = hudColors.getVisorEnergyInitColors(false).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;
    }