Пример #1
0
    //if skill in cd,we should disable key press for player
    public void SetKeyEnabledBySkillID(int skillIdx, bool toEnabled)
    {
        if (_keyCache != null && _keyCache.Length > 0)
        {
            for (int i = 1; i < FCConst.FC_KEY_FOR_TOUCH; i++)
            {
                int v = 0;
                if (_keyCache[i]._skillIdx == skillIdx && _keyCache[i]._beEnable)
                {
                    if (toEnabled)
                    {
                        //enable key for skill

                        if ((_keyCache[i]._energyCost != null &&
                             _keyCache[i]._energyCost[v] <= _owner.ACOwner.Energy) ||
                            _keyCache[i]._energyCost[v] <= 0)
                        {
                            _keyCache[i]._beActive = true;
                            _owner.ACOwner._enableInputKey((FC_KEY_BIND)i, true);
                            if (_keyCache[i]._keyPress && i > 0)
                            {
                                _owner.HandleKeyPress(i, Vector3.zero);
                            }
                        }
                    }
                    else
                    {
                        _keyCache[i]._beActive = false;
                        _owner.ACOwner._enableInputKey((FC_KEY_BIND)i, false);
                    }
                    break;
                }
            }
        }
    }