/// <summary>
        /// Verifica que el componente sea del tipo especificado
        /// </summary>
        /// <param name="item">El elemento a validar.</param>
        /// <returns>Verdadero si el elemento esta dentro del filtro</returns>
        private bool HPFilter(object item)
        {
            HPItem hpItem = (item as HPItem);

            if (this.Fases == 1)
            {
                return(hpItem.HP <= 10);
            }
            else if (this.Fases == 2)
            {
                return(hpItem.HP <= 200 && hpItem.HP >= 0.5);
            }
            else if (this.Fases == 3)
            {
                if (Tension?.Value > 220)
                {
                    return(hpItem.HP <= 500 && hpItem.HP >= 0.5);
                }
                return(hpItem.HP <= 200 && hpItem.HP >= 0.5);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// Maneja el evento que realizá el cambio de selección de potencia
 /// </summary>
 /// <param name="sender">La fuente del evento.</param>
 /// <param name="e">Los argumentos de tipo <see cref="SelectionChangedEventArgs"/> que contienen la información del evento.</param>
 private void cboHP_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (this.cboHP.SelectedIndex != -1)
     {
         HPItem   item = this.cboHP.SelectedItem as HPItem;
         Potencia p    = new Potencia(item.HP, true);
         this.tbokW.Text   = item.KW.ToString();
         this.tboHpVA.Text = p.PotenciaAparenteAsString;
     }
 }
Beispiel #3
0
    internal void GiveHP(HPItem hPItem)
    {
        int newHP = hp.Value + hPItem.hp;

        if (newHP > maxHP.Value)
        {
            newHP = maxHP.Value;
        }

        hp.Value = newHP;
    }
Beispiel #4
0
    public void AddHpItem(string name, int hp, Transform root)
    {
        GameObject go = resSev.LoadGoPrefab(PathDefine.HpItemPrefab, true, new Vector3(-1000f, 0, 0), Quaternion.identity);

        go.transform.SetParent(hpItemRoot);
        HPItem pItem = go.GetComponent <HPItem>();

        pItem.SetWindowState(true);
        hpDic[name] = pItem;
        pItem.SetItemInfo(hp, root);
    }
        public static Double GetCorriente(Componente componente, Circuito circuito, Tension tension)
        {
            if (!(componente is Motor))
            {
                return(0);
            }
            HPItem SelectedMotor = TabalimApp.Motores.First(x => x.HP == componente.Potencia.HP);

            switch (circuito.Polos.Length)
            {
            case 1: return(tension.TensionAlNeutro <= 127 ? SelectedMotor.I_1_127 : SelectedMotor.I_1_230);

            case 2: return(tension.Value <= 220 ? SelectedMotor.I_2_230 : SelectedMotor.I_2_460);

            case 3: return(tension.Value <= 208 ? SelectedMotor.I_3_208 : tension.Value <= 220 ? SelectedMotor.I_3_230 : SelectedMotor.I_3_460);
            }
            return(1);
        }