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); } }
public override bool canEnter() { // 检查角色是否有导弹,没有导弹不能瞄准 PlayerItemBase playerItem = mPlayer.getPlayerPack().getCurItem(); if (playerItem == null || playerItem.getItemType() != PLAYER_ITEM.PI_MISSILE) { return(false); } return(true); }
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); }
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); }
public override void init() { base.init(); mItem = null; }