Esempio n. 1
0
 public override void Init(TaskModeMgr mgr, GameObject playerGo)
 {
     m_FightArrowType = FightTaskUiType.CollectProp;
     gameObject.SetActive(false);
     base.Init(mgr, playerGo);
     m_NpcProp = GetComponentInChildren <NpcProp>();
     m_NpcProp.gameObject.GetComponent <Collider2D>().enabled = false;
 }
Esempio n. 2
0
        private void JieSuan(float times, PassItem passItem = null)
        {
            if (passItem == null)
            {
                passItem = Global.gApp.gSystemMgr.GetPassMgr().GetPassItem();
            }
            ItemDTO itemDTO = new ItemDTO(SpecialItemIdConstVal.GOLD, passItem.goldParam * passItem.coinNum * times, BehaviorTypeConstVal.OPT_BALANCE);

            itemDTO.param2 = times;
            GameItemFactory.GetInstance().AddItem(itemDTO);


            ItemDTO item1DTO = new ItemDTO(SpecialItemIdConstVal.EXP, passItem.levelEXP, BehaviorTypeConstVal.OPT_BALANCE);

            GameItemFactory.GetInstance().AddItem(item1DTO);
            int branckId = Global.gApp.gSystemMgr.GetPassMgr().GetBranchPassId();

            Global.gApp.gSystemMgr.GetPassMgr().GameSucess(passItem.id, 0, 0);

            int[] sourceParam = passItem.sourceParam;
            if (sourceParam.Length == 2)
            {
                int      dropId    = sourceParam[0];
                int      dropTimes = sourceParam[1];
                DropItem dropData  = Global.gApp.gGameData.DropData.Get(dropId);
                if (dropData != null)
                {
                    for (int i = 0; i < dropTimes; i++)
                    {
                        int curRate    = 0;
                        int randomRate = Random.Range(0, 10001);
                        int index      = 0;
                        foreach (int rate in dropData.rate)
                        {
                            curRate = curRate + rate;
                            if (randomRate < curRate)
                            {
                                string     path     = "Prefabs/Prop/" + dropData.prop[index];
                                GameObject propGo   = Global.gApp.gResMgr.InstantiateObj(path);
                                NpcProp    npcProp  = propGo.GetComponent <NpcProp>();
                                string     itemName = string.Empty;
                                if (npcProp != null)
                                {
                                    itemName = npcProp.GetItemName();
                                }
                                else
                                {
                                    CampResProp resProp = propGo.GetComponent <CampResProp>();;
                                    if (resProp != null)
                                    {
                                        itemName = resProp.GetItemName();
                                    }
                                }
                                Destroy(propGo);
                                if (!itemName.Equals(string.Empty))
                                {
                                    ItemItem itemItem   = Global.gApp.gGameData.GetItemDataByName(itemName);
                                    ItemDTO  addItemDTO = new ItemDTO(itemItem.id, 1, BehaviorTypeConstVal.OPT_BALANCE);
                                    GameItemFactory.GetInstance().AddItem(addItemDTO);
                                }
                                break;
                            }
                            index++;
                        }
                    }
                }
            }


            if (branckId > 0)
            {
                PassItem newPassItem = Global.gApp.gGameData.PassData.Get(branckId);
                JieSuan(times, newPassItem);
            }
        }