Beispiel #1
0
 protected bool EnoughEnergy()
 {
     if (m_SpaceObject.GetEnergyPoints("Current") >= m_EnergyDrain)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #2
0
    public void RecoverBestCombination(List <int[]> possibleCombinations)
    {
        foreach (int[] currentCombination in possibleCombinations)
        {
            //Debug.Log ("currentCombination.length = "+currentCombination.Length);
            int   energyLimit             = m_SpaceObjectSelected.GetEnergyPoints("Current");
            int   energyUse               = 0;
            bool  validCombination        = true;
            float currentCombinationScore = 0;

            string debugCombination = "";

            foreach (int weaponNumber in currentCombination)
            {
                debugCombination += weaponNumber.ToString() + "/";
                //Debug.Log("m_WeaponActions[weaponNumber].m_Target = "+m_WeaponActions[weaponNumber].m_Target);
                energyUse += m_WeaponActions[weaponNumber].m_Weapon.GetEnergyDrain();
                currentCombinationScore += m_WeaponActions[weaponNumber].m_Score;
                //Debug.Log("m_WeaponActions[weaponNumber].m_Score = "+m_WeaponActions[weaponNumber].m_Score);
                if (energyUse > energyLimit)
                {
                    validCombination = false;
                    break;
                }
            }

            currentCombinationScore = Mathf.Ceil(currentCombinationScore / currentCombination.Length);
            Debug.Log("validCombination = " + validCombination + " / combination = " + debugCombination + " / combination score = " + currentCombinationScore);
            if (validCombination == true &&
                (currentCombinationScore > m_CombinationScore || (currentCombinationScore == m_CombinationScore && currentCombination.Length > m_CombinationComplexity)))
            {
                m_CombinationScore      = currentCombinationScore;
                m_CombinationComplexity = currentCombination.Length;
                m_Combination           = new int[m_CombinationComplexity];
                currentCombination.CopyTo(m_Combination, 0);
            }
        }
    }
    public virtual void DisplayHUD(bool active)
    {
        if (active == true)
        {
            HUD.Instance.ActiveTargetPanel(true);
            HUD.Instance.ActiveActionPanel(true);
            HUD.Instance.ActiveInfoPanel(true);

            TargetPanel.Instance.DisplayArmorBar(true, m_MySpaceObject.GetArmorPoints("Current"), m_MySpaceObject.GetArmorPoints("Max"));
            TargetPanel.Instance.DisplayBuffs(true, m_MySpaceObject.GetBuffController().GetBonus(), m_MySpaceObject.GetBuffController().GetMalus());
            TargetPanel.Instance.DisplayPassives(true, m_MySpaceObject.GetPassiveController().GetPassives());
            TargetPanel.Instance.DisplayFeature(true, "MOV", m_MySpaceObject.GetMoveRange());
            TargetPanel.Instance.DisplayFeature(true, "ESQ", m_MySpaceObject.GetEvade());
            TargetPanel.Instance.DisplayFeature(true, "DEF", m_MySpaceObject.GetDefence());
            TargetPanel.Instance.DisplayFeature(true, "CRT", m_MySpaceObject.GetCritChance());
            TargetPanel.Instance.DisplayShieldBar(true, m_MySpaceObject.GetShieldPoints(), m_MySpaceObject.GetArmorPoints("Max") / 2);
            TargetPanel.Instance.DisplayTargetImage(true, m_MySpaceObject.GetHUDSprite());

            ActionPanel.Instance.DisplayEnergyBar(true, m_MySpaceObject.GetEnergyPoints("Current"), m_MySpaceObject.GetEnergyPoints("Max"));
            ActionPanel.Instance.DisplaySlots(true, m_MySpaceObject.GetWeaponController().GetEquipments());
            ActionPanel.Instance.DisplayEngineButton(!m_MySpaceObject.GetHasMoved());

            /*if(m_MyShip.GetHasMoved() == true)
             *      ActionPanel.Instance.DisplayEngineButton (false);
             * else
             *      ActionPanel.Instance.DisplayEngineButton (true);*/

            InfoPanel.Instance.SetInfos(m_MySpaceObject.GetWeaponController().GetEquipments(), m_MySpaceObject.GetPassiveController().GetPassives(), m_MySpaceObject.GetBuffController().GetBonus(), m_MySpaceObject.GetBuffController().GetMalus());
        }
        else
        {
            HUD.Instance.ActiveTargetPanel(false);
            HUD.Instance.ActiveActionPanel(false);
            HUD.Instance.ActiveInfoPanel(false);
        }
    }