Пример #1
0
    IEnumerator DoSkill24(Controller controller)//Lightning Call
    {
        GameObject target = controller.target;

        if (target == null)
        {
            Controller con = controller.stateManager.FindEnemyNearest(true);
            if (con != null)
            {
                target = con.gameObject;
            }
        }

        if (target != null)
        {
            controller.transform.LookAt(target.transform);
        }

        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 24);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        GameObject prefab     = GetSkillPrefab(skill.SkillId);
        int        skillIndex = controller.role.RoleSkills.IndexOf(skill);
        GameObject go         = Instantiate(prefab, controller.transform.position, controller.transform.rotation) as GameObject;

        SkillRootManager skillRootManager = go.GetComponent <SkillRootManager>();

        skillRootManager.gameSkill   = skill;
        skillRootManager.controller  = controller;
        skillRootManager.skillIndex  = skillIndex;
        skillRootManager.audioEffect = null;

        yield return(null);
    }
Пример #2
0
    IEnumerator DoSkill22(Controller controller)//Calm shot
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 22);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        GameObject prefab     = GetSkillPrefab(skill.SkillId);
        int        skillIndex = controller.role.RoleSkills.IndexOf(skill);
        GameObject enemy      = controller.target;

        if (enemy != null)
        {
            GameObject     spellObj = (GameObject)Instantiate(prefab, controller.pointSpell.position, controller.pointSpell.rotation) as GameObject;
            EffectSettings setting  = spellObj.GetComponent <EffectSettings>();
            if (setting != null)
            {
                setting.Target      = enemy;
                setting.gameSkill   = skill;
                setting.controller  = controller;
                setting.skillIndex  = skillIndex;
                setting.audioEffect = null;
            }
        }
        yield return(null);
    }
Пример #3
0
    IEnumerator DoSkill05(Controller controller)//Group Heal
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 5);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        int subSkillID = 1;

        switch ((RoleType)controller.roleID)
        {
        case RoleType.Hecate: subSkillID = 2; break;
        }

        GameObject prefab = GetSkillPrefab(skill.SkillId, subSkillID);

        foreach (GameObject player in GameObject.FindGameObjectsWithTag(controller.tag))
        {
            if (player == null)
            {
                continue;
            }
            Controller playerTarget = player.GetComponent <Controller>();

            if (playerTarget == null)
            {
                continue;
            }
            Instantiate(prefab, playerTarget.transform.position, playerTarget.transform.rotation);

            gamePlayManager.SendSkillHit(controller.role.Id, controller.index, playerTarget, skill);

            yield return(null);
        }
    }
Пример #4
0
    IEnumerator DoSkill06(Controller controller)//Mega Heal
    {
        if (controller.target != null)
        {
            Controller playerTarget = controller.target.GetComponent <Controller>();

            RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 6);

            SoundManager.Instance.PlaySkillBegin(skill, controller);

            int subSkillID = 1;
            switch ((RoleType)controller.roleID)
            {
            case RoleType.WoodElf: subSkillID = 2; break;
            }
            GameObject prefab = GetSkillPrefab(skill.SkillId, subSkillID);

            Instantiate(prefab, playerTarget.transform.position, playerTarget.transform.rotation);


            if (controller != null && controller.target != null)
            {
                gamePlayManager.SendSkillHit(controller.role.Id,
                                             controller.index, controller.target.GetComponent <Controller>(), skill);
            }
        }
        yield return(null);
    }
Пример #5
0
    IEnumerator DoSkill25(Controller controller)//Dew of Nature
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 25);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        GameObject prefab = GetSkillPrefab(skill.SkillId);

        foreach (GameObject player in GameObject.FindGameObjectsWithTag(controller.tag))
        {
            if (player == null)
            {
                continue;
            }
            Controller playerTarget = player.GetComponent <Controller>();

            if (playerTarget == null)
            {
                continue;
            }
            Instantiate(prefab, playerTarget.transform.position, playerTarget.transform.rotation);

            gamePlayManager.SendSkillHit(controller.role.Id, controller.index, playerTarget, skill);

            yield return(null);
        }
    }
Пример #6
0
    IEnumerator DoSkill03(Controller controller)
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 3);

        Shoot(controller, skill);
        yield return(null);
    }
Пример #7
0
    public void SendSkillCast(RoleSkill roleSkill)
    {
        if (target == null)
        {
            Controller controlerTarget;
            if (role.Base.Class != RoleClass.Healer)
            {
                controlerTarget = stateManager.FindEnemyNearest(true);
            }
            else
            {
                controlerTarget = stateManager.FindAllyNearest();
            }

            if (controlerTarget != null)
            {
                OnAction(controlerTarget.gameObject);
            }
        }

        if (tag == GameManager.PlayerTagName)
        {
            if (_castRange != null)
            {
                Destroy(_castRange);
            }
            _castRange = SkillManager.Instance.CreateCastRange(_myTransform, roleSkill.GameSkill.CastRange);
        }

        GameplayManager.Instance.SendSkillCast(role.Id, roleSkill.SkillId);
        sendingSkill = true;
    }
Пример #8
0
    IEnumerator DoSkill17(Controller controller)//Frost Nova
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 17);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        GameObject prefab     = GetSkillPrefab(skill.SkillId);
        int        skillIndex = controller.role.RoleSkills.IndexOf(skill);

        string tagName = Helper.GetTagEnemy(controller);

        foreach (GameObject enemy in GameObject.FindGameObjectsWithTag(tagName))
        {
            if (enemy != null)
            {
                //  float distance = Vector3.Distance(enemy.transform.position, controller.transform.position);

                // if (distance <= controller.role.RoleSkills[1].GameSkill.CastRange)

                GameObject     spellObj = (GameObject)Instantiate(prefab, controller.pointSpell.position, controller.pointSpell.rotation) as GameObject;
                EffectSettings setting  = spellObj.GetComponent <EffectSettings>();
                if (setting != null)
                {
                    setting.Target      = enemy;
                    setting.gameSkill   = skill;
                    setting.controller  = controller;
                    setting.skillIndex  = skillIndex;
                    setting.audioEffect = null;
                }
            }
        }

        yield return(null);
    }
Пример #9
0
    private bool PlaySkill()
    {
        if (_stateManager.controller.actionStat != Controller.ActionStat.Action)
        {
            return(false);
        }

        List <RoleSkill> roleSkills = _stateManager.controller.role.RoleSkills.Where(p => p.GameSkill.SkillType != (int)SkillType.Aura).ToList();

        if (roleSkills.Count <= 1)
        {
            return(false);
        }


        if (_stateManager.controller.actionStat != Controller.ActionStat.Skill)
        {
            if (Time.time - _stateManager.timerSkillLast > 1)
            {
                for (int i = 1; i < roleSkills.Count; i++)
                {
                    RoleSkill roleSkill = roleSkills[i];
                    if (GameManager.autoSkillConfig.CheckUseSkill(_stateManager.controller, roleSkill))
                    {
                        int skillIndex = _stateManager.controller.role.RoleSkills.IndexOf(roleSkill);
                        _stateManager.OnChangeState(new SkillState(_stateManager, skillIndex));
                        _stateManager.timerSkillLast = Time.time;
                        return(true);
                    }
                }
            }
        }

        return(false);
    }
Пример #10
0
    //check skill if affect in range of target, search all enemy of attacker to check in distance will affected and send skill hit
    private void CheckEffectRange(Controller attacker, Controller target, RoleSkill skill)
    {
        if (skill.GameSkill.EffectRange <= 0 || skill.GameSkill.TargetType != (int)TargetType.AreaEffect ||
            skill.SkillId == 27)
        {
            return;
        }

        HeroSet enemySet = GameplayManager.Instance.getEnemySet(attacker);

        SkillManager.Instance.CreateRangeOfSkill(target.transform.position, skill.GameSkill.EffectRange);

        foreach (Hero enemy in enemySet)
        {
            if (enemy.gameObject.name != target.gameObject.name)
            {
                if (Vector3.Distance(target.transform.position, enemy.gameObject.transform.position) <= skill.GameSkill.EffectRange)
                {
                    if (attacker != null && enemy.controller != null)
                    {
                        _battleController.SendSkillHit(attacker.role.Id, 0, enemy.controller.role.Id, skill.SkillId);
                    }
                }
            }
        }
    }
Пример #11
0
    private void DoBuff(Controller controller, int skillID)
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == skillID);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        gamePlayManager.SendSkillHit(controller.role.Id, controller.index, controller, skill);
    }
Пример #12
0
    public void DoSkill(Controller controller, int skillIndex)
    {
        RoleSkill roleSkill = controller.role.RoleSkills[skillIndex];

        string methodName = string.Format("DoSkill{0:D2}", roleSkill.SkillId);

        StartCoroutine(methodName, controller);
    }
Пример #13
0
    private bool CheckUseSkill_EnemyOne(Controller con, RoleSkill skill, Rule rule)
    {
        HeroSet enemySet = GameplayManager.Instance.getEnemySet(con);

        if (enemySet.Count(p => p.controller.actionStat != Controller.ActionStat.Dead) > 0)
        {
            return(true);
        }
        return(false);
    }
Пример #14
0
    public void PlaySkillEnd(RoleSkill skill, Controller controller)
    {
        string    audioName = string.Format("End_{0:D2}", skill.GameSkill.Id);
        AudioClip clip      = Resources.Load("Sound/Skill/Skill/" + audioName) as AudioClip;

        if (clip != null)
        {
            controller.audio.volume = UIMusicSetting.Instance.skillValue * UIMusicSetting.Instance.totalValue;
            controller.audio.PlayOneShot(clip);
        }
    }
Пример #15
0
 private bool CheckUseSkill_Self(Controller con, RoleSkill skill, Rule rule)
 {
     switch (rule.attribType)
     {
     case AttribType.HPPercent:    //6
         if (Condition.Compair((float)con.role.State.CurHP / (float)con.role.State.MaxHP, rule.condition, rule.value / 100.0f))
         {
             return(true);
         }
         break;
     }
     return(false);
 }
Пример #16
0
    IEnumerator DoSkill01(Controller controller)//Attack
    {
        SoundManager.Instance.PlayAction(controller);
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 01);

        if (controller.target != null)
        {
            //Instantiate(FX, controller.target.transform.position, controller.target.transform.rotation);

            gamePlayManager.SendSkillHit(controller.role.Id, controller.index,
                                         controller.target.GetComponent <Controller>(), skill);
        }
        yield return(null);
    }
Пример #17
0
 public override void RemoveStatus(float duration)
 {
     base.RemoveStatus(duration);
     mcd -= duration;
     if (mcd <= 0)
     {
         mStatusActive = true;
         SoldierSkill sourceSkill = new SoldierSkill();
         SkillM.GetSkillInfo(m_StatusInfo.exSkill1, m_StatusInfo.exSkillLevel1, ref sourceSkill);
         mcd = sourceSkill.m_cd * 0.001f;
         Role attacker = CM.GetLifeM(m_StatusInfo.Releasescentid, LifeMType.SOLDIER) as Role;
         RoleSkill.GlobalUseSkill(attacker, mOwner, sourceSkill, Vector3.zero);
     }
 }
Пример #18
0
    public bool CheckAttackCondition()
    {
        PathData PrevRoad      = Path.GetPathData(PathAccess.Prev, true);
        MapGrid  attackstation = MapGrid.GetMG(m_AttackStation);

        if (m_Attack && RoleParent.m_Skill.CanAttack() &&
            (!(RoleParent.m_Skill.m_AttackTarget is Role) || RoleSkill.CheckCanAttack((RoleParent.m_Skill.m_AttackTarget as Role).CurrentAction)) &&
            (RoleParent.m_Skill.m_AttackTarget is IggWall || RoleParent.m_Skill.m_AttackTarget is IggFloor || (NdUtil.IsSameMapPos(m_PreGrid, m_AttackStation) &&
                                                                                                               attackstation.IsAttackStations() /* && attackstation.GetRoleStateInStation(m_SceneID) ==  RoleStationState.HoldStation*/) &&
             !(PrevRoad != null && (PrevRoad.state == RoleState.FALL || PrevRoad.state == RoleState.JUMP))))
        {
            return(true);
        }
        return(false);
    }
Пример #19
0
 public override void InterruptStatus(LifeAction Action)
 {
     if (mStatusActive)
     {
         return;
     }
     base.InterruptStatus(Action);
     if (Action == LifeAction.Die)
     {
         mStatusActive = true;
         SoldierSkill sourceSkill = new SoldierSkill();
         SkillM.GetSkillInfo(m_StatusInfo.exSkill1, m_StatusInfo.exSkillLevel1, ref sourceSkill);
         Role attacker = CM.GetLifeM(m_StatusInfo.Releasescentid, LifeMType.SOLDIER) as Role;
         RoleSkill.GlobalUseSkill(attacker, mOwner, sourceSkill, Vector3.zero);
     }
 }
Пример #20
0
 public override void RemoveStatus(float duration)
 {
     if (mStatusActive)
     {
         return;
     }
     base.RemoveStatus(duration);
     if (IsStatusOver())
     {
         mStatusActive = true;
         SoldierSkill sourceSkill = new SoldierSkill();
         SkillM.GetSkillInfo(m_StatusInfo.exSkill2, m_StatusInfo.exSkillLevel2, ref sourceSkill);
         Role attacker = CM.GetLifeM(m_StatusInfo.Releasescentid, LifeMType.SOLDIER) as Role;
         RoleSkill.GlobalUseSkill(attacker, mOwner, sourceSkill, Vector3.zero);
     }
 }
Пример #21
0
    public void OnReciveSkillCast(int skillID)
    {
        if (actionStat == ActionStat.Move || actionStat == ActionStat.Dead || actionStat == ActionStat.Skill)
        {
            return;
        }

        sendingSkill = false;
        RoleSkill roleSkill = role.RoleSkills.FirstOrDefault(p => p.SkillId == skillID);

        curSkill = roleSkill;

        if (roleSkill != null)
        {
            this.HandleSkillCast(role.RoleSkills.IndexOf(roleSkill));
        }
    }
Пример #22
0
 private bool CheckUseSkill_AllyOne(Controller con, RoleSkill skill, Rule rule)
 {
     switch (rule.attribType)
     {
     case AttribType.HPPercent:    //6
     {
         Controller target = GetAlly(con, rule);
         if (target != null)
         {
             con.target = target.gameObject;
             return(true);
         }
     }
     break;
     }
     return(false);
 }
Пример #23
0
    IEnumerator DoSkill27(Controller controller)//Gravily Ball
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 27);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        GameObject prefab     = GetSkillPrefab(skill.SkillId);
        int        skillIndex = controller.role.RoleSkills.IndexOf(skill);

        GameObject            go = GameObject.Instantiate(prefab, Vector3.zero, Quaternion.identity) as GameObject;
        GravilyBallController gb = go.GetComponent <GravilyBallController>();

        gb.Player           = controller.transform;
        gb.skillIndex       = skillIndex;
        gb.controllerAttack = controller;
        gb.roleSkill        = skill;
        yield return(null);
    }
Пример #24
0
    IEnumerator DoSkill10(Controller controller)//Heavy Punch
    {
        if (controller.target != null)
        {
            if (controller.target.GetComponent <Controller>().actionStat != Controller.ActionStat.Dead)
            {
                RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 10);

                SoundManager.Instance.PlaySkillBegin(skill, controller);

                GameObject prefab = GetSkillPrefab(skill.SkillId);
                Instantiate(prefab, controller.target.transform.position, controller.target.transform.rotation);

                gamePlayManager.SendSkillHit(controller.role.Id, controller.index, controller.target.GetComponent <Controller>(), skill);
            }
        }
        yield return(null);
    }
Пример #25
0
    IEnumerator DoSkill11(Controller controller)//Slam
    {
        string tagName = Helper.GetTagEnemy(controller);

        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 11);

        GameObject prefab = GetSkillPrefab(skill.SkillId);

        CreateRangeOfSkill(controller.transform.position, skill.GameSkill.EffectRange);

        bool isplayskill = false;

        foreach (GameObject enemy in GameObject.FindGameObjectsWithTag(tagName))
        {
            float distance = Vector3.Distance(enemy.transform.position, controller.transform.position);

            if (distance <= skill.GameSkill.EffectRange)
            {
                isplayskill = true;
                GameObject spellObj = (GameObject)Instantiate(prefab, prefab.transform.position, Quaternion.identity) as GameObject;

                EffectSettings setting    = spellObj.GetComponent <EffectSettings>();
                int            skillIndex = controller.role.RoleSkills.IndexOf(skill);
                Debug.Log("skillIndex " + skillIndex);

                if (setting != null)
                {
                    setting.Target     = enemy;
                    setting.gameSkill  = skill;
                    setting.skillIndex = skillIndex;
                    setting.controller = controller;
                    //setting.damage = controller.skill_1_Value;
                    setting.audioEffect = null;
                }
            }
        }

        if (isplayskill)
        {
            SoundManager.Instance.PlaySkillBegin(skill, controller);
        }

        yield return(null);
    }
Пример #26
0
    IEnumerator DoSkill56(Controller controller)//Detonate!
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 56);

        int skillIndex = controller.role.RoleSkills.IndexOf(skill);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        GameObject prefab = GetSkillPrefab(skill.SkillId);

        GameObject go = Instantiate(prefab, controller.transform.position, Quaternion.identity) as GameObject;

        SkillCollider.HandleSkillHit(null, controller, skillIndex, DEngine.Common.GameLogic.TargetType.EnemyGroup);

        gamePlayManager.SendSkillHit(controller.role.Id,
                                     controller.index, controller, skill);

        yield return(null);
    }
Пример #27
0
    IEnumerator DoSkill28(Controller controller)//Thorn Shield
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 28);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        GameObject prefab = GetSkillPrefab(skill.SkillId);

        GameObject go = GameObject.Instantiate(prefab, controller.transform.position + Vector3.up, Quaternion.identity) as GameObject;

        go.transform.parent     = controller.transform;
        go.transform.localScale = new Vector3(1.4f, 1.4f, 1.4f);

        gamePlayManager.SendSkillHit(controller.role.Id, controller.index, controller, skill);

        go.GetComponent <DestroyForTime>().time = skill.GameSkill.Duration;

        yield return(null);
    }
Пример #28
0
    IEnumerator DoSkill08(Controller controller)//Stoneskin
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 8);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        GameObject go = GameObject.Instantiate(GetSkillPrefab(skill.SkillId), controller.transform.position, controller.transform.rotation) as GameObject;

        go.transform.parent = controller.transform;

        float scale = 2.7f / controller.transform.localScale.y;

        go.transform.localScale = new Vector3(scale, scale, scale);

        gamePlayManager.SendSkillHit(controller.role.Id, controller.index, controller, skill);
        go.GetComponent <DestroyForTime>().time = skill.GameSkill.Duration;

        yield return(null);
    }
Пример #29
0
    IEnumerator DoSkill46(Controller controller)
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 46);

        string tagEnemy = Helper.GetTagEnemy(controller);

        CreateRangeOfSkill(controller.transform.position, skill.GameSkill.EffectRange);

        bool isplaySkill = false;

        foreach (GameObject player in GameObject.FindGameObjectsWithTag(tagEnemy))
        {
            if (player == null)
            {
                continue;
            }

            float distance = Vector3.Distance(player.transform.position, controller.transform.position);

            if (distance <= skill.GameSkill.EffectRange)
            {
                isplaySkill = true;

                Controller playerTarget = player.GetComponent <Controller>();

                if (playerTarget == null)
                {
                    continue;
                }

                gamePlayManager.SendSkillHit(controller.role.Id, controller.index, playerTarget, skill);
            }
        }

        if (isplaySkill)
        {
            SoundManager.Instance.PlaySkillBegin(skill, controller);
        }


        yield return(null);
    }
Пример #30
0
    IEnumerator DoSkill23(Controller controller)//God Power
    {
        RoleSkill skill = controller.role.RoleSkills.FirstOrDefault(p => p.SkillId == 23);

        SoundManager.Instance.PlaySkillBegin(skill, controller);

        GameObject prefab     = GetSkillPrefab(skill.SkillId);
        int        skillIndex = controller.role.RoleSkills.IndexOf(skill);
        GameObject enemy      = controller.target;

        if (enemy != null)
        {
            GameObject spellObj = (GameObject)Instantiate(prefab, enemy.transform.position, Quaternion.identity) as GameObject;

            yield return(new WaitForSeconds(0.1f));

            gamePlayManager.SendSkillHit(controller.role.Id,
                                         controller.index, enemy.GetComponent <Controller>(), skill);
        }
        yield return(null);
    }