Пример #1
0
        //TODO:拾取掉落物品
        IEnumerator PickTreasure()
        {
            Log.Sys("PickThisTreasure " + itemData.ItemName);
            Vector2 dir           = Random.insideUnitCircle;
            float   curFlySpeed   = 0;
            Vector3 upSpeed       = new Vector3(0, 5, 0);
            Vector3 moveDirection = new Vector3(dir.x, 0, dir.y);
            var     controller    = GetComponent <CharacterController> ();
            float   Gravity       = 5.0f;

            float passTime = 0;
            float rotSpeed = 360;

            while (passTime < 2f)
            {
                curFlySpeed = Mathf.Lerp(curFlySpeed, 2, 5 * Time.deltaTime);
                var movement = moveDirection * curFlySpeed + upSpeed;
                movement *= Time.deltaTime;
                controller.Move(movement);
                upSpeed.y -= Gravity * Time.deltaTime;

                passTime += Time.deltaTime;
                transform.localRotation = Quaternion.Euler(rotSpeed * Time.deltaTime, 0, 0) * transform.localRotation;
                yield return(null);
            }

            yield return(new WaitForSeconds(1));

            float flySpeed = 20;
            float UpSpeed  = 10;

            upSpeed = new Vector3(0, UpSpeed, 0);
            while (true)
            {
                if (player == null)
                {
                    break;
                }
                moveDirection = player.transform.position - transform.position;
                if (moveDirection.magnitude < 0.3f)
                {
                    break;
                }

                var nor = moveDirection.normalized;


                var movement = nor * flySpeed + upSpeed;
                movement *= Time.deltaTime;
                controller.Move(movement);
                upSpeed.y -= Gravity * Time.deltaTime;

                passTime += Time.deltaTime;
                yield return(null);
            }
            BackgroundSound.Instance.PlayEffect("pickup");
            GameObject.Destroy(gameObject);
            GameInterface_Backpack.PickItem(itemData, num);
            IsOnGround = false;
        }
Пример #2
0
        public void PickItemFromNetwork(GameObject who)
        {
            pickYet = true;
            BackgroundSound.Instance.PlayEffect("pickup");
            GameObject.Destroy(gameObject);
            var me = ObjectManager.objectManager.GetMyPlayer();

            if (who == me)
            {
                if (itemData.UnitType == ItemData.UnitTypeEnum.POWER_DRUG)
                {
                    WindowMng.windowMng.ShowNotifyLog("炸弹威力上升");
                    GameInterface_Backpack.LearnSkill((int)SkillData.SkillConstId.Bomb);
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.QIPAO_DRUG)
                {
                    var attr = ObjectManager.objectManager.GetMyAttr();
                    attr.AddMpMax(20);
                    attr.AddThrowSpeed(0.1f);
                    WindowMng.windowMng.ShowNotifyLog("MP上限增加");
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.XieZi_DRUG)
                {
                    ObjectManager.objectManager.GetMyAttr().AddNetSpeed(0.1f);
                    WindowMng.windowMng.ShowNotifyLog("速度提升");
                }
                else
                {
                    GameInterface_Backpack.PickItem(itemData, num);
                }
            }
        }
Пример #3
0
        void OnLevel(int levId)
        {
            Log.GUI("OnLevelId " + levId);
            var levData = allLevels[levId];

            if (levData.levelLocal.condition != 0 && allLevels.Count > (levId + 1))
            {
                var num  = BackPack.backpack.GetItemCount(0, levData.levelLocal.condition);
                var item = Util.GetItemData(0, levData.levelLocal.condition);
                if (num <= 0)
                {
                    WindowMng.windowMng.ShowNotifyLog(string.Format("[ff1010]{0}[-]被魔神强大结界所笼罩,需要[ff1010]{1}[-]打破结界, 似乎[ff1010]商店[-]有此物可以获得。",
                                                                    levData.levelLocal.name, item.ItemName));
                    return;
                }
                else
                {
                    GameInterface_Backpack.UseItem(levData.levelLocal.condition);
                }
            }

            CopyController.copyController.SelectLevel(curChapter, allLevels[levId]);
            WorldManager.worldManager.WorldChangeScene(CopyController.copyController.SelectLevelInfo.levelLocal.id, false);
            Log.GUI("OnCopyLevel " + levId);
        }
Пример #4
0
        void UpdateFrame()
        {
            hpLabel.text = GameInterface_Backpack.GetHpNum().ToString();
            var lev = GameInterface_Player.GetLevel();

            Log.GUI("lev " + lev);
            level.text = "[ff9500]等级:" + lev + "[-]";
        }
Пример #5
0
        void OnLearn()
        {
            WindowMng.windowMng.PopView();
            var pt = backpackData.itemData.propsConfig.propsType;

            if (pt == (int)ItemData.UnitTypeEnum.SKILL_BOOK)
            {
                GameInterface_Backpack.LearnSkillBook(backpackData.id);
            }
            else if (pt == (int)ItemData.UnitTypeEnum.FORGE_GRAPH)
            {
                GameInterface_Forge.LearnForgeSkill(backpackData.id);
            }
        }
Пример #6
0
        IEnumerator  InitGameData()
        {
            GameInterface_Backpack.ClearDrug();
            yield return(StartCoroutine(NetworkUtil.WaitForPlayer()));

            var me = ObjectManager.objectManager.GetMyPlayer();

            GameInterface_Skill.AddSkillBuff(ObjectManager.objectManager.GetMyPlayer(), (int)SkillData.SkillConstId.AddMP, Vector3.zero);
            var attr = me.GetComponent <NpcAttribute>();

            var sync = CGSetProp.CreateBuilder();

            sync.Key   = (int)CharAttribute.CharAttributeEnum.LEVEL;
            sync.Value = 1;
            KBEngine.Bundle.sendImmediate(sync);
            PlayerData.ResetSkillLevel();
        }
Пример #7
0
        void UpdateFrame()
        {
            hpLabel.text = GameInterface_Backpack.GetHpNum().ToString();

            var me = ObjectManager.objectManager.GetMyData();

            HpLabel.text = me.GetProp(CharAttribute.CharAttributeEnum.HP).ToString() + "/" + me.GetProp(CharAttribute.CharAttributeEnum.HP_MAX).ToString();
            mpLabel.text = me.GetProp(CharAttribute.CharAttributeEnum.MP).ToString() + "/" + me.GetProp(CharAttribute.CharAttributeEnum.MP_MAX).ToString();

            hp.value = me.GetProp(CharAttribute.CharAttributeEnum.HP) * 1.0f / me.GetProp(CharAttribute.CharAttributeEnum.HP_MAX);
            mp.value = me.GetProp(CharAttribute.CharAttributeEnum.MP) * 1.0f / me.GetProp(CharAttribute.CharAttributeEnum.MP_MAX);

            var ep = me.GetProp(CharAttribute.CharAttributeEnum.EXP);
            var ma = me.GetProp(CharAttribute.CharAttributeEnum.EXP_MAX);

            exp.value     = ep * 1.0f / ma;
            expLabel.text = ep + "/" + ma;

            level.text = "[ff9500]等级:" + me.GetProp(CharAttribute.CharAttributeEnum.LEVEL) + "[-]";
        }
Пример #8
0
 void OnBottle(GameObject g)
 {
     GameInterface_Backpack.UseItem((int)ItemData.ItemID.DRUG);
 }
Пример #9
0
 void OnBuy()
 {
     GameInterface_Backpack.Charge(numMoney);
 }
Пример #10
0
        public void PickItemFromNetwork(GameObject who)
        {
            pickYet = true;
            var whoAttr = NetworkUtil.GetAttr(who);

            BackgroundSound.Instance.PlayEffect("pickup");
            GameObject.Destroy(gameObject);
            var me = ObjectManager.objectManager.GetMyPlayer();

            Log.Sys("PickItemFromNetwork: " + whoAttr + " itemType: " + itemData.UnitType);

            var gen = Resources.Load <GameObject>("particles/drops/generic_item");
            var par = ParticlePool.Instance.GetGameObject(gen, ParticlePool.InitParticle);

            //var par = Instantiate() as GameObject;

            //par.transform.parent = g.transform;
            par.transform.position = gameObject.transform.position;
            var rm = par.AddMissingComponent <RemoveSelf>();

            rm.StartCoroutine(rm.WaitReturn(3));

            if (whoAttr != null && whoAttr.gameObject == me)
            {
                if (itemData.UnitType == ItemData.UnitTypeEnum.POWER_DRUG)
                {
                    WindowMng.windowMng.ShowNotifyLog("炸弹威力上升");
                    GameInterface_Backpack.LearnSkill((int)SkillData.SkillConstId.Bomb);
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.QIPAO_DRUG)
                {
                    var attr = ObjectManager.objectManager.GetMyAttr();
                    attr.AddMpMax(20);
                    attr.AddThrowSpeed(0.1f);
                    WindowMng.windowMng.ShowNotifyLog("MP上限增加");
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.XieZi_DRUG)
                {
                    ObjectManager.objectManager.GetMyAttr().AddNetSpeed(0.1f);
                    WindowMng.windowMng.ShowNotifyLog("速度提升");
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.LIAN_FA)
                {
                    GameInterface_Skill.AddSkillBuff(me, (int)GameBuff.LianFa, Vector3.zero);
                    WindowMng.windowMng.ShowNotifyLog("连发弹");
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.POTION)
                {
                    GameInterface_Skill.AddSkillBuff(me, (int)GameBuff.AddHP, Vector3.zero);
                    WindowMng.windowMng.ShowNotifyLog("恢复生命");
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.FASHI)
                {
                    var attr = ObjectManager.objectManager.GetMyAttr();
                    attr.SetNetSpeed(0);
                    attr.SetJob(Job.ALCHEMIST);
                    WindowMng.windowMng.ShowNotifyLog("攻击提升", 2, null, true);
                    WindowMng.windowMng.ShowNotifyLog("生命值变化", 2, null, true);
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.CIKE)
                {
                    var attr = ObjectManager.objectManager.GetMyAttr();
                    attr.SetJob(Job.ARMOURER);
                    attr.SetNetSpeed(0.5f);
                    WindowMng.windowMng.ShowNotifyLog("移动速度加快", 2, null, true);
                    WindowMng.windowMng.ShowNotifyLog("生命值变化", 2, null, true);
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.SUPER)
                {
                    GameInterface_Skill.AddBuffWithNet(me, (int)GameBuff.SuperShoot, Vector3.zero);
                    WindowMng.windowMng.ShowNotifyLog("拾获超能子弹", 2, null, true);
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.HIDE)
                {
                    GameInterface_Skill.AddBuffWithNet(me, (int)GameBuff.Hide, Vector3.zero);
                    WindowMng.windowMng.ShowNotifyLog("拾获隐身药水", 2, null, true);
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.NUCLEAR)
                {
                    GameInterface_Skill.AddBuffWithNet(me, (int)GameBuff.NuclearBuff, Vector3.zero);
                    WindowMng.windowMng.ShowNotifyLog("拾获核弹,使用后立即逃离区域", 4, null, true);
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.KNOCK)
                {
                    GameInterface_Skill.AddBuffWithNet(me, (int)GameBuff.KnockBuff, Vector3.zero);
                    WindowMng.windowMng.ShowNotifyLog("获得击退能力", 4, null, true);
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.WUDI)
                {
                    GameInterface_Skill.AddBuffWithNet(me, (int)GameBuff.WuDi, Vector3.zero);
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.DaoDan)
                {
                    GameInterface_Skill.AddBuffWithNet(me, (int)GameBuff.DaoDan, Vector3.zero);
                }
                else if (itemData.UnitType == ItemData.UnitTypeEnum.DefaultSkill)
                {
                    GameInterface_Skill.AddBuffWithNet(me, itemData.triggerBuffId, Vector3.zero);
                    Util.ShowMsg("获得" + itemData.ItemName);
                }
                else
                {
                    GameInterface_Backpack.PickItem(itemData, num);
                }
            }
        }
Пример #11
0
 public void OnBuy(int id)
 {
     GameInterface_Backpack.BuyItem(id);
 }
Пример #12
0
 void SetSlot(int s)
 {
     WindowMng.windowMng.PopView();
     GameInterface_Backpack.SetSkillPos(skillId, s);
 }