コード例 #1
0
 public void notifyAIGetBoxItem(PlayerItemBase playerItem)
 {
     if (playerItem.getItemType() != PLAYER_ITEM.PI_MISSILE)
     {
         CommandCharacterUseItem cmd = newCmd(out cmd);
         cmd.mItemIndex = mCharacter.getPlayerPack().getSelectedIndex();
         pushCommand(cmd, mCharacter);
     }
 }
コード例 #2
0
    public override bool canEnter()
    {
        // 检查角色是否有导弹,没有导弹不能瞄准
        PlayerItemBase playerItem = mPlayer.getPlayerPack().getCurItem();

        if (playerItem == null || playerItem.getItemType() != PLAYER_ITEM.PI_MISSILE)
        {
            return(false);
        }
        return(true);
    }
コード例 #3
0
    public int removeItem(PlayerItemBase item)
    {
        int itemIndex = 0;
        int maxCount  = mPackItem.Length;

        for (int i = 0; i < maxCount; ++i)
        {
            if (mPackItem[i] == item)
            {
                --mItemCount;
                mPackItem[i] = null;
                itemIndex    = i;
                break;
            }
        }
        return(itemIndex);
    }
コード例 #4
0
    public int addItem(PLAYER_ITEM type)
    {
        PlayerItemBase item       = createPlayerItem(type);
        int            maxCount   = mPackItem.Length;
        int            startIndex = mSelectedIndex == -1 ? 0 : mSelectedIndex;

        for (int i = 0; i < maxCount; ++i)
        {
            int index = (startIndex + i) % maxCount;
            if (mPackItem[index] == null)
            {
                ++mItemCount;
                mPackItem[index] = item;
                return(index);
            }
        }
        return(0);
    }
コード例 #5
0
 public override void init()
 {
     base.init();
     mItem = null;
 }