示例#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 { }
         }
     }
 }