Ejemplo n.º 1
0
        public void SetSkillId(int skillId)
        {
            Skill = SkillModuleMgr.Instance.GetSkill(skillId);
//			DebugUtil.Info("sprite Icon:" + Skill.SkillIcon);
            _spriteIcon.spriteName = Skill.SkillIcon;
            _labelNeedEnergy.text  = Skill.NeedEnergy.ToString();

            _goSelBtn.SetActive(false);
            _goNotNeedEnergy.SetActive(FightMgr.Instance.CurrentBossEnergy < Skill.NeedEnergy);

            this.transform.localScale    = Vector3.one * _oriScale;
            this.transform.localPosition = _oriPos;
            _canMove  = true;
            _timeAdd  = 0f;
            _timeTemp = 0f;
            _progress = 0f;

//			_tweenPos = this.transform.DOLocalPath(new Vector3[]{normal * 30,_targetPos},3f,PathType.Linear,PathMode.TopDown2D,10,Color.red);//.DOLocalJump(_targetPos,0.4f,1,0.4f);//(_targetPos,1f);
//			_tweenPos.SetEase(Ease.InSine);
//			_tweenPos.SetDelay(_delayDisplay);
//			_tweenPos.SetAutoKill(true);
//
//			_tweenScale = this.transform.DOScale(Vector3.one,0.4f);
//			_tweenScale.SetEase(Ease.InBack);
//			_tweenPos.Play();
        }
Ejemplo n.º 2
0
        public SkillModule GetSkill(int skillId)
        {
            SkillModule skill = null;

            _dicSkillModule.TryGetValue(skillId, out skill);
            return(skill);
        }
Ejemplo n.º 3
0
 public void AddSkill(SkillModule skill)
 {
     if (skill != null)
     {
         _dicSkillModule[skill.Id] = skill;
     }
 }
Ejemplo n.º 4
0
        public void TriggerSkill(int skillId)
        {
            SkillModule skill = SkillModuleMgr.Instance.GetSkill(skillId);

            if (skill == null)
            {
                DebugUtil.Error("未找到skill,id = " + skillId);
            }

            BossData bossData = ModuleFight.CurrentMyBoss;

            //暂时屏蔽
            if (skill.NeedEnergy > bossData.Energy)
            {
                ShowMsg(FightDefine.E_NoteMsgType.NotEnoughEnergy);
                return;
            }

            ModuleFight.UseEnergy(skill.NeedEnergy);
            ModuleFight.SkillAttackBoss(skill);
        }
Ejemplo n.º 5
0
        public void UseSkill(PlayerBase target, int targetBossId, int currentHp, SkillTable.SkillType skillType, int damage, bool isLaskSkill, int skillId)
        {
//			if(skillId != 0)
//			{
//				Debug.LogError("UseSkill:" + skillId);
//			}

            bool useSkill = true;

            if (damage <= 0)
            {
                SkillModule skill = SkillModuleMgr.Instance.GetSkill(skillId);
                if (skill.IsNoHarmSkill)
                {
                    useSkill = false;
                }
            }
            if (!useSkill)
            {
                //伤害为0,且不需要特效,直接触发技能
                FightMgr.Instance.PlaySkillEffect(skillId, target.IsOpp);
            }
            else
            {
                GameObject projectile = null;
                if (skillId == 1002)
                {
                    projectile = FightMgr.Instance.LoadAndInstantiate(SkillTable.GetSkill(SkillTable.SkillType.BinFen));
                }
                else
                {
                    projectile = FightMgr.Instance.LoadAndInstantiate(SkillTable.GetSkill(skillType));                    //Instantiate(GoSkillEffect, TransSkillPos.position, Quaternion.identity) as GameObject;
                }
                projectile.transform.position = TransSkillPos.position;
                //			projectile.transform.LookAt(target.transform.position);
                var vecDiff   = target.transform.position - TransSkillPos.position;
                var roatation = Quaternion.FromToRotation(TransSkillPos.up, vecDiff);
                projectile.transform.rotation = roatation;

                var pos = projectile.transform.position;
                pos.z = -0.2f;
                projectile.transform.position = pos;

                projectile.GetComponent <Rigidbody>().AddForce(projectile.transform.up * 700);

                var myProject = projectile.GetComponent <MyProjectileScript>();
                myProject.impactNormal = target.transform.position.normalized;
                myProject.GoTarget     = target;

                myProject.CurrentHp    = currentHp;
                myProject.TargetBossId = targetBossId;
                myProject.Damage       = damage;
                myProject.IsLastSkill  = isLaskSkill;
                myProject.SkillId      = skillId;
            }


//			Debug.Log("<color=green>useSkill</color> :" + skillType + ",target:" + target.IsOpp);


//			GameObject goSkill = Instantiate<GameObject>(GoSkillEffect);
//			SkillEffect skill = goSkill.GetComponent<SkillEffect>();
//			skill.transform.SetParent(TransSkillPos,false);
//			skill.Target = target;
//			skill.CurrentHp = currentHp;
//			skill.TargetBossId = targetBossId;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 技能攻击对方
        /// </summary>
        public void SkillAttackBoss(SkillModule skill)
        {
            BossData boss    = CurrentMyBoss;
            BossData bossOpp = CurrentOppBoss;

            if (boss != null && bossOpp != null)
            {
                int bossHp = bossOpp.RealCurrentHp;

                if (bossHp <= 0)
                {
                    return;
                }

                                #if MinDamage
                int damage = 1;
                                #else
                int damage = (int)(boss.NormalAttack * skill.HarmPara);
                                #endif

                bossHp -= damage;
                if (bossHp < 0)
                {
                    bossHp = 0;
                }
//				bossOpp.CurrentHp = bossHp;
                bossOpp.RealCurrentHp = bossHp;

                //通知服务端
                Util.CallMethod("Network", "ClientAttack", CurrentOppBossId, damage, (int)AttackType.SKILL_1, skill.Id, 0, 0);

//				Debug.Log("<color=orange>boss :</color>" + CurrentOppBoss.CurrentHp.ToString() + " damage:" + (-damage).ToString());
                SkillData skillData = new SkillData();
                skillData.BossId       = CurrentOppBossId;
                skillData.CurrentHp    = bossOpp.RealCurrentHp;
                skillData.Damage       = damage;
                skillData.SkillType    = SkillTable.SkillType.GongZhuSkill;
                skillData.SkillId      = skill.Id;
                skillData.IsLastAttack = bossHp <= 0;

                FightMgr.Instance.CurrentMyBoss.AddAttackAction(skillData);

//				boss.AddEnergy(E_AddEnergyType.UseSkill);
            }
            else
            {
                DebugUtil.Error("技能攻击对方Boss,本方boss不存在");
            }



            //原来直接播放技能伤害逻辑
//			BossData boss = CurrentMyBoss;
//			BossData bossOpp = CurrentOppBoss;
//
//			if(boss != null && bossOpp != null && boss.IsCanUseSkill)
//			{
//
//				int bossHp = bossOpp.RealCurrentHp;
//
//				if(bossHp <= 0) return;
//
//				#if MinDamage
//				int damage = 1;
//				#else
//				int damage = boss.SkillAttack;
//				#endif
//
//				bossHp -= damage;
//				if(bossHp < 0) bossHp = 0;
////				bossOpp.CurrentHp = bossHp;
//				bossOpp.RealCurrentHp = bossHp;
//
//				//通知服务端
//				Util.CallMethod("Network", "ClientAttack",CurrentOppBossId, damage, (int)AttackType.SKILL_1);
//
////				Debug.Log("<color=orange>boss :</color>" + CurrentOppBoss.CurrentHp.ToString() + " damage:" + (-damage).ToString());
//				SkillData skillData = new SkillData();
//				skillData.BossId = CurrentOppBossId;
//				skillData.CurrentHp = bossOpp.RealCurrentHp;
//				skillData.Damage = damage;
//				skillData.SkillType = SkillTable.SkillType.GongZhuSkill;
//				skillData.IsLastAttack = bossHp <= 0;
//
//				FightMgr.Instance.CurrentMyBoss.AddAttackAction(skillData);
//
//				boss.AddEnergy(E_AddEnergyType.UseSkill);
//			}
//			else
//			{
//				DebugUtil.Error("技能攻击对方Boss,本方boss不存在");
//			}
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 播放技能效果
        /// </summary>
        /// <param name="skill">Skill.</param>
        public void PlaySkillEffect(int skillId, bool isMyAttack)
        {
//			isMyAttack = !isMyAttack;

            SkillModule skill = SkillModuleMgr.Instance.GetSkill(skillId);

            if (skill == null)
            {
                DebugUtil.Error("未找到skill,id = " + skillId);
            }

            if (skill.SkillTypeDetail == E_SkillTypeDetail.AddMoves)
            {
                if (isMyAttack)
                {
                    //增加自己步数
                    int addMoves = int.Parse(skill.EffectNum);
                    EventDispatcher.TriggerEvent <int, bool>(UIFight.AddMoves, addMoves, true);
                }
                else
                {
                    ShowMsg(FightDefine.E_NoteMsgType.OppUseAddMoves);
                }
            }
            else if (skill.SkillTypeDetail == E_SkillTypeDetail.AddBlocks)
            {
                if (isMyAttack)
                {
                    //自己飞向对方
                    List <FlyingBezier> list = new List <FlyingBezier>();
                    int count = int.Parse(skill.EffectNum);
                    for (int i = 0; i < count; i++)
                    {
                        FlyingBezier         obj  = null;
                        Queue <FlyingBezier> pool = null;
                        bool isBlock = true;                        //Random.Range(1,1000) <= 750;
                        if (isBlock)
                        {
                            //木块
                            if (_poolsBlock.Count > 0)
                            {
                                obj = _poolsBlock.Dequeue();
                            }
                            else
                            {
                                obj = FightMgr.Instance.LoadAndInstantiate(FightDefine.Prefab_Flying_Block).GetComponent <BlockFlyToOpp>();                               // ResourceMgr.Instance.LoadAndInstanceGameObjectFromPreload(FightDefine.ParticleCardCrush);
                            }

                            pool = _poolsBlock;
                        }
//						else
//						{
//							//杂草
//							if(_poolsBlockWeed.Count > 0)
//							{
//								obj = _poolsBlockWeed.Dequeue();
//							}
//							else
//							{
//								obj = FightMgr.Instance.LoadAndInstantiate(FightDefine.Prefab_Flying_Weed).GetComponent<BlockFlyToOpp>();// ResourceMgr.Instance.LoadAndInstanceGameObjectFromPreload(FightDefine.ParticleCardCrush);
//							}
//
//							pool = _poolsBlockWeed;
//						}
                        list.Add(obj);

                        obj.transform.SetParent(_energyMgr.transform, false);
                        obj.transform.localPosition = new Vector3(Random.Range(-46f, 46f), Random.Range(-46f, 46f), 0);
                        obj.transform.SetParent(goBossOpp.transform);
                        obj.gameObject.SetActive(false);
                        obj.Speed = 0.8f;

                        (obj as BlockFlyToOpp).Play(i * 0.3f, pool, list, true, null, null, null);
                    }
                }
                else
                {
                    //对方往我棋盘飞
                    _FlyBlockToMyCnt = int.Parse(skill.EffectNum);
                }
            }
            else if (skill.SkillTypeDetail == E_SkillTypeDetail.ForbidAttack)
            {
                if (isMyAttack)
                {
                    //不管
                }
                else
                {
                    IsIceBlcok = true;
                    //获取冰封路径
                    var dicSlot = _filedMgr.FindIcePath();

                    //停止原来协程
                    if (_iceBlock != null)
                    {
                        StopCoroutine(_iceBlock);
                    }

                    //开始冰封
                    _iceBlock = StartCoroutine(ReIceBlockTimer(dicSlot, float.Parse(skill.EffectNum)));

                    //恢复冰封协程
                    StartCoroutine(IceSlot(dicSlot));

                    ShowMsg(FightDefine.E_NoteMsgType.ShowIceNotice, skill.Effect);
                }
            }
        }
Ejemplo n.º 8
0
        public void AddTestData()
        {
                        #if !FightTest
            object[] obj = Util.CallMethod("TableSkillCtrl", "Get_All_Skills");

            LuaTable skills = obj[0] as LuaTable;

            DebugUtil.Info("skills.Length: " + skills.Length);

            SkillModule skill = null;

            for (int i = 1; i <= skills.Length; i++)
            {
                skill = new SkillModule();
                LuaTable _skill = skills[i] as LuaTable;
                skill.Id               = int.Parse(_skill.GetStringField("id"));
                skill.Name             = _skill.GetStringField("name");
                skill.Desc             = _skill.GetStringField("desc");
                skill.SkillTypeMain    = (E_SkillTypeMain)int.Parse(_skill.GetStringField("skill_type_main"));
                skill.SkillTypeDetail  = (E_SkillTypeDetail)int.Parse(_skill.GetStringField("skill_type_detail"));
                skill.EffectNum        = _skill.GetStringField("effect_num");
                skill.NeedEnergy       = int.Parse(_skill.GetStringField("need_energy"));
                skill.HarmPara         = float.Parse(_skill.GetStringField("harm_para"));
                skill.CoolDown         = int.Parse(_skill.GetStringField("cooldown"));
                skill.SkillIcon        = _skill.GetStringField("skill_icon");
                skill.AnimationName    = _skill.GetStringField("animation_name");
                skill.AttackFashion    = int.Parse(_skill.GetStringField("attack_fashion"));
                skill.Effect           = _skill.GetStringField("effect");
                skill.AttackPrefabName = _skill.GetStringField("attack_prefab_name");
                skill.AudioName        = _skill.GetStringField("audio_name");

                if (_minNeedEnergy > skill.NeedEnergy)
                {
                    _minSkillId    = skill.Id;
                    _minNeedEnergy = skill.NeedEnergy;
                }

                AddSkill(skill);
            }
                        #else
            //1001 造成大额伤害
            SkillModule skill = new SkillModule();
            skill.Id              = 1001;
            skill.SkillTypeMain   = E_SkillTypeMain.Active;
            skill.SkillTypeDetail = E_SkillTypeDetail.DoHarm;
            skill.EffectNum       = "";
            skill.SkillIcon       = "icon-9";
            skill.NeedEnergy      = 0;
            skill.HarmPara        = 2;
            skill.AnimationName   = string.Empty;
            skill.AudioName       = string.Empty;
            skill.CoolDown        = 0;
            skill.AttackFashion   = 1;
            skill.Effect          = string.Empty;
            AddSkill(skill);

            //1007 增加5步(可以突破上限)
            skill                 = new SkillModule();
            skill.Id              = 1002;
            skill.SkillTypeMain   = E_SkillTypeMain.Active;
            skill.SkillTypeDetail = E_SkillTypeDetail.AddMoves;
            skill.EffectNum       = "5";
            skill.SkillIcon       = "icon-7";
            skill.NeedEnergy      = 0;
            skill.HarmPara        = 2;
            skill.AnimationName   = string.Empty;
            skill.AudioName       = string.Empty;
            skill.CoolDown        = 0;
            skill.AttackFashion   = 1;
            skill.Effect          = string.Empty;
            AddSkill(skill);

            //1003 放置障碍
            skill                 = new SkillModule();
            skill.Id              = 1003;
            skill.SkillTypeMain   = E_SkillTypeMain.Active;
            skill.SkillTypeDetail = E_SkillTypeDetail.AddBlocks;
            skill.EffectNum       = "4";
            skill.SkillIcon       = "icon-8";
            skill.NeedEnergy      = 0;
            skill.HarmPara        = 2;
            skill.AnimationName   = string.Empty;
            skill.AudioName       = string.Empty;
            skill.CoolDown        = 0;
            skill.AttackFashion   = 1;
            skill.Effect          = string.Empty;
            AddSkill(skill);

            //1004 冰封对手
            skill                 = new SkillModule();
            skill.Id              = 1004;
            skill.SkillTypeMain   = E_SkillTypeMain.Active;
            skill.SkillTypeDetail = E_SkillTypeDetail.ForbidAttack;
            skill.EffectNum       = "2.5";
            skill.SkillIcon       = "icon-10";
            skill.NeedEnergy      = 0;
            skill.HarmPara        = 2;
            skill.AnimationName   = string.Empty;
            skill.AudioName       = string.Empty;
            skill.CoolDown        = 0;
            skill.AttackFashion   = 1;
            skill.Effect          = string.Empty;
            AddSkill(skill);
                        #endif
        }