コード例 #1
0
    void SelectAbilities(AgentAI a)
    {
        string[] aNames; int[] aIds;
        a.GetAbilities().m_AbilityManager.GetAbilityNamesAndIDs(out aIds, out aNames);
        for (int i = 0; i < aIds.Length; i++)
        {
            if (a.GetAbilities() != null && a.GetAbilities().GetAbility(aIds[i]) != null)
            {
                try
                {
                    if (a.GetAbilities().HasAbility(aIds[i]))
                    {
                        Ability abil    = a.GetAbilities().GetAbility(aIds[i]);
                        KeyCode keycode = KeyRemapper.GetMappingForAbility(aIds[i]).m_Key;

                        switch (abil.State)
                        {
                        case Ability.AbilityState.prepped:
                            Keyboard.Instance[keycode.ToKey()] = UnityEngine.Color.yellow.ToColore();
                            break;

                        case Ability.AbilityState.activating:
                            Keyboard.Instance[keycode.ToKey()] = UnityEngine.Color.gray.ToColore();
                            break;

                        case Ability.AbilityState.active:
                            Keyboard.Instance[keycode.ToKey()] = UnityEngine.Color.green.ToColore();
                            break;

                        case Ability.AbilityState.ready:
                            Keyboard.Instance[keycode.ToKey()] = UnityEngine.Color.white.ToColore();
                            break;

                        default:
                            Keyboard.Instance[keycode.ToKey()] = magenta;
                            break;
                        }

                        if (abil.GetCooldownPercentage() > 0)
                        {
                            Keyboard.Instance[keycode.ToKey()] = a.IsSelected() ? UnityEngine.Color.yellow.ToColore() : magenta;
                        }
                        else if (abil.GetAmmoCount() == 0 && abil.GetMaxAmmo() != 0 && abil.GetCooldownPercentage() > 0)
                        {
                            Keyboard.Instance[keycode.ToKey()] = a.IsSelected() ? UnityEngine.Color.red.ToColore() : magenta;
                        }
                    }
                }
                catch { }
            }
        }
    }
コード例 #2
0
 void DeselectAbilities(AgentAI a)
 {
     string[] aNames; int[] aIds;
     a.GetAbilities().m_AbilityManager.GetAbilityNamesAndIDs(out aIds, out aNames);
     for (int i = 0; i < aIds.Length; i++)
     {
         if (a.GetAbilities() != null && a.GetAbilities().GetAbility(aIds[i]) != null)
         {
             try
             {
                 if (a.GetAbilities().HasAbility(aIds[i]))
                 {
                     Ability abil    = a.GetAbilities().GetAbility(aIds[i]);
                     KeyCode keycode = KeyRemapper.GetMappingForAbility(aIds[i]).m_Key;
                     Keyboard.Instance[keycode.ToKey()] = magenta;
                 }
             }
             catch { }
         }
     }
 }
コード例 #3
0
    /// <summary>
    /// Called once per frame.
    /// </summary>
    public void Update()
    {
        if (Manager.Get().GameInProgress)
        {
            if (Input.GetKeyDown(KeyCode.Delete))
            {
                try
                {
                    List <AgentAI> agents  = AgentAI.GetAgents();
                    AgentAI        soldier = agents[0];

                    Abilities abilities = soldier.GetAbilities();

                    Manager.GetUIManager().ShowMessagePopup(abilities.ToString());
                    abilities.AddAbility(999);
                }
                catch (Exception e)
                {
                    Debug.Log(e.Message + "\n" + e.StackTrace);
                    Manager.GetUIManager().ShowMessagePopup(e.Message);
                }
            }
        }
    }