示例#1
0
    public PLAYER_ITEM generateItemType()
    {
        PLAYER_ITEM[] typeList  = new PLAYER_ITEM[] { PLAYER_ITEM.PI_MISSILE, PLAYER_ITEM.PI_SHIELD, PLAYER_ITEM.PI_TURBO, PLAYER_ITEM.PI_LAND_MINE };
        int           itemIndex = MathUtility.randomInt(0, typeList.Length - 1);

        return(typeList[itemIndex]);
    }
示例#2
0
    public void addProp(PLAYER_ITEM type)
    {
        activeProp(true);
        ItemInfo itemInfo = mScript.mItemInfoList[type];

        mIcon.setSpriteName(itemInfo.mIconSpriteName);
        mIcon.setWindowSize(itemInfo.mSpriteSize);
        mLabel.setLabel(itemInfo.mPropsName);
    }
示例#3
0
 public void addProps(PLAYER_ITEM itemType, int itemIndex)
 {
     if (itemIndex > GameDefine.PACK_ITEM_COUNT)
     {
         UnityUtility.logError("itemIndex " + itemIndex + " is out of range count : " + mPropsList.Count);
         return;
     }
     mPropsList[itemIndex].addProp(itemType);
 }
示例#4
0
    public int getFirstItemIndex(PLAYER_ITEM item)
    {
        int maxCount = mPackItem.Length;

        for (int i = 0; i < maxCount; ++i)
        {
            if (mPackItem[i] != null && mPackItem[i].getItemType() == item)
            {
                return(i);
            }
        }
        return(-1);
    }
示例#5
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);
    }
示例#6
0
 public PlayerTurbo(PLAYER_ITEM type)
     :
     base(type)
 {
     ;
 }
示例#7
0
 public PlayerMissile(PLAYER_ITEM type)
     :
     base(type)
 {
     ;
 }
 public override void init()
 {
     base.init();
     mItemType = PLAYER_ITEM.PI_MAX;
 }
示例#9
0
 public PlayerItemBase(PLAYER_ITEM type)
 {
     mType = type;
 }
示例#10
0
 protected void registePlayerItem <T>(PLAYER_ITEM type) where T : PlayerItemBase
 {
     mRegisteList.Add(type, typeof(T));
 }
示例#11
0
 //----------------------------------------------------------------------------------------------------------------
 protected PlayerItemBase createPlayerItem(PLAYER_ITEM type)
 {
     return(UnityUtility.createInstance <PlayerItemBase>(mRegisteList[type], type));
 }
示例#12
0
 public PlayerShield(PLAYER_ITEM type)
     :
     base(type)
 {
     ;
 }
示例#13
0
 public PlayerLandMine(PLAYER_ITEM type)
     :
     base(type)
 {
     ;
 }