Exemplo n.º 1
0
 private void OnDestroy()
 {
     if (me != null)
     {
         GameInterface_Skill.RemoveSkillBuff(me.gameObject, (int)GameBuff.NuclearDamageHP);
         me = null;
     }
 }
Exemplo n.º 2
0
 private void OnDestroy()
 {
     if (me != null)
     {
         GameInterface_Skill.RemoveSkillBuff(me.gameObject, (int)GameBuff.LaserDamageHP);
         GameInterface_Skill.RemoveSkillBuff(me.gameObject, Affix.EffectType.SlowDown2);
         me = null;
     }
 }
Exemplo n.º 3
0
 IEnumerator ContinueBuff()
 {
     while (true)
     {
         if (me != null)
         {
             GameInterface_Skill.AddSkillBuff(me.gameObject, (int)GameBuff.NuclearDamageHP, Vector3.zero, PlayerId);
         }
         yield return(new WaitForSeconds(1));
     }
 }
Exemplo n.º 4
0
        private void OnTriggerExit(Collider other)
        {
            var attr = NetworkUtil.GetAttr(other.gameObject);

            if (attr != null)
            {
                if (attr == me)
                {
                    Util.ShowMsg("退出核弹区域");
                    me = null;
                    GameInterface_Skill.RemoveSkillBuff(attr.gameObject, (int)GameBuff.NuclearDamageHP);
                }
            }
        }
Exemplo n.º 5
0
        private void OnTriggerEnter(Collider other)
        {
            var attr = NetworkUtil.GetAttr(other.gameObject);

            if (attr != null)
            {
                if (attr.IsMine())
                {
                    Util.ShowMsg("警告:进入核弹区域");
                    me = attr;
                    GameInterface_Skill.AddSkillBuff(me.gameObject, (int)GameBuff.NuclearDamageHP, Vector3.zero, PlayerId);
                }
            }
        }
Exemplo n.º 6
0
        private void OnTriggerExit(Collider other)
        {
            var attr = NetworkUtil.GetAttr(other.gameObject);

            if (attr != null)
            {
                if (attr.IsMine())
                {
                    GameInterface_Skill.RemoveSkillBuff(attr.gameObject, (int)GameBuff.LaserDamageHP);
                    GameInterface_Skill.RemoveSkillBuff(attr.gameObject, Affix.EffectType.SlowDown2);
                    me = null;
                }
            }
        }
Exemplo n.º 7
0
        private void OnTriggerEnter(Collider other)
        {
            //Debug.LogError("OnTriggerEnter: "+other);
            var attr = NetworkUtil.GetAttr(other.gameObject);

            if (attr != null)
            {
                if (attr.IsMine())
                {
                    Util.ShowMsg("警告:进入辐射区域");
                    me = attr;
                    GameInterface_Skill.AddSkillBuff(me.gameObject, (int)GameBuff.DamageHP, Vector3.zero);
                }
            }
        }
Exemplo n.º 8
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();
        }
Exemplo n.º 9
0
        /// <summary>
        /// 设置技能的名字
        /// </summary>
        /// <param name="skillId">Skill identifier.</param>
        /// <param name="n">N.</param>
        /// <param name="lev">Lev.</param>
        /// <param name="needLev">Need lev.</param>
        /// <param name="desc">Desc.</param>
        /// <param name="maxLev">Max lev.</param>
        public void SetSkillName(int skillId, string n, int lev, int needLev, string desc, int maxLev)
        {
            sId = skillId;
            var pos = GameInterface_Skill.GetSkillPos(skillId);
            var ps  = "";

            if (pos == 0)
            {
                ps = "未装备";
            }
            else if (pos == 1)
            {
                ps = "装备位置:一";
            }
            else if (pos == 2)
            {
                ps = "装备位置:二";
            }
            else if (pos == 3)
            {
                ps = "装备位置:三";
            }
            else if (pos == 4)
            {
                ps = "装备位置:四";
            }

            if (lev <= 0)
            {
                nameLabel.text = string.Format("[959595]{0}[-]\n[98fcfc]{3}[-]\n[959595]需要等级:{1}[-]\n[959595]{2}[-]", n, needLev, desc, ps);
                SetLearn(0);
            }
            else if (lev < maxLev)
            {
                SetLearn(1);
                nameLabel.text = string.Format("[ff9500]{0}[-]\n[98fcfc]{4}[-]\n[0098fc]等级:{1}[-]\n[73d216]下一级需要:{2}[-]\n[f85818]{3}[-]", n, lev, needLev, desc, ps);
            }
            else
            {
                SetLearn(2);
                nameLabel.text = string.Format("[ff9500]{0}[-]\n[98fcfc]{3}[-]\n[0098fc]等级:{1}满级[-]\n[f85818]{2}[-]", n, lev, desc, ps);
            }
        }
Exemplo n.º 10
0
        //0.1s 开启关闭
        private void OnTriggerEnter(Collider other)
        {
            var meId = ObjectManager.objectManager.GetMyServerID();

            if (meId == PlayerId)
            {
                return;
            }
            var attr = NetworkUtil.GetAttr(other.gameObject);

            if (attr != null)
            {
                Log.Sys("LaserEnter: " + other.gameObject);
                if (attr.IsMine())
                {
                    me = attr;
                    GameInterface_Skill.AddSkillBuff(me.gameObject, (int)GameBuff.LaserDamageHP, Vector3.zero, PlayerId);
                    GameInterface_Skill.AddSkillBuff(me.gameObject, "SlowDown2", Vector3.zero, PlayerId);
                }
            }
        }
Exemplo n.º 11
0
        static System.Collections.IEnumerator UseItemCor(int itemId)
        {
            yield return(new WaitForSeconds(0.1f));

            var id       = BackPack.backpack.GetItemId(itemId);
            var itemData = Util.GetItemData(0, itemId);

            var use = CGUseUserProps.CreateBuilder();

            use.UserPropsId = id;
            use.Count       = 1;
            var packet = new KBEngine.PacketHolder();

            Log.Net("Send Use Item");
            yield return(ClientApp.Instance.StartCoroutine(KBEngine.Bundle.sendSimple(ClientApp.Instance, use, packet)));

            Log.Sys("UseResult " + packet.packet.flag);
            if (packet.packet.responseFlag == 0)
            {
                //GameInterface_Skill.MeUseSkill(itemData.triggerBuffId);
                GameInterface_Skill.AddSkillBuff(ObjectManager.objectManager.GetMyPlayer(), itemData.triggerBuffId, Vector3.zero);
            }
        }
Exemplo n.º 12
0
 //TODO: 和SkillController协作处理玩家的技能数据
 void OnSkill(int skIndex)
 {
     Debug.Log("skillbutton is " + skIndex);
     GameInterface_Skill.OnSkill(skIndex);
 }
Exemplo n.º 13
0
 void RemoveBuff(GameObject go)
 {
     GameInterface_Skill.RemoveSkillBuff(go, 151);
     healObjects.Remove(go);
 }
Exemplo n.º 14
0
 void AddHP(GameObject go)
 {
     GameInterface_Skill.AddSkillBuff(go, (int)GameBuff.AddHP, Vector3.zero);
     healObjects.Add(go);
 }
Exemplo n.º 15
0
        private IEnumerator Move()
        {
            var playerMove   = GetAttr().GetComponent <MoveController>();
            var vcontroller  = playerMove.vcontroller;
            var camRight     = playerMove.camRight;
            var camForward   = playerMove.camForward;
            var physics      = playerMove.GetComponent <TankPhysicComponent>();
            var first        = true;
            var logicCommand = playerMove.GetComponent <LogicCommand>();

            while (!quit)
            {
                if (CheckEvent())
                {
                    yield break;
                }



                float v = 0;
                float h = 0;
                if (vcontroller != null)
                {
                    h = vcontroller.inputVector.x; //CameraRight
                    v = vcontroller.inputVector.y; //CameraForward
                }
                bool isMoving = Mathf.Abs(h) > 0.1 || Mathf.Abs(v) > 0.1;
                isMoving = Mathf.Abs(h) > 0.1 || Mathf.Abs(v) > 0.1;
                if (!isMoving)
                {
                    physics.MoveSpeed(Vector3.zero);
                    if (!inSkill && !first)
                    {
                        aiCharacter.ChangeState(AIStateEnum.IDLE);
                        break;
                    }
                    else
                    {
                        first = false;
                        yield return(null);

                        continue;
                    }
                }

                Vector3 moveDirection   = Vector3.zero;
                Vector3 targetDirection = h * camRight + v * camForward;
                if (targetDirection != Vector3.zero)
                {
                    moveDirection = targetDirection;
                }

                var curSmooth   = speedSmoothing * Time.deltaTime;
                var targetSpeed = Mathf.Min(targetDirection.magnitude, 1.0f);
                targetSpeed        *= walkSpeed;
                moveSpeed           = Mathf.Lerp(moveSpeed, targetSpeed, curSmooth);
                GetAttr().MoveSpeed = moveSpeed;

                physics.TurnTo(moveDirection);
                var curDir   = physics.transform.forward;
                var movement = moveDirection * moveSpeed;

                var cosDir = Vector3.Dot(moveDirection.normalized, curDir.normalized);
                cosDir   = Mathf.Max(0, cosDir);
                movement = cosDir * movement;
                //movement = cosDir * movement;
                //当前不动 旋转
                //在目标方向移动
                //在当前方向移动
                //在当前方向旋转

                if (GetAttr().IsMine() && sendRemoveBuff)
                {
                    if (GetAttr().MoveSpeed > 0.05f)
                    {
                        sendRemoveBuff = false;
                        GameInterface_Skill.RemoveStaticShootBuff(GetAttr().gameObject, 155, Vector3.zero);
                    }
                }

                physics.MoveSpeed(movement);
                //没有使用技能则自动设置方向 有技能则最近设置方向
                yield return(null);
            }
        }
Exemplo n.º 16
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);
                }
            }
        }