public override bool OnSelectSkill(EnumSkillType eType, int unSkillId)
 {
     Debug.Log("Use Skill Select Skill");
     if (unSkillId == 0)
     {
         ActionState.Singleton.ChangeState(enumSubActionState.eSubActionState_Enable);
         return(true);
     }
     else if (this.m_curState.OnSelectSkill(eType, unSkillId))
     {
         return(true);
     }
     else
     {
         if (this.ChangeSkill(eType, unSkillId))
         {
             SkillBase skill = null;
             skill = SkillGameManager.GetSkillBase(unSkillId);
             EnumErrorCodeCheckUse errorCode = skill.CheckUse(Singleton <BeastRole> .singleton.Id);
             if (errorCode == EnumErrorCodeCheckUse.eCheckErr_Success)
             {
                 this.m_curState.OnLockOperation();
             }
             else
             {
                 this.m_curState.ShowErrCheckUse(errorCode);
                 ActionState.Singleton.ChangeState(enumSubActionState.eSubActionState_Enable);
             }
         }
     }
     return(true);
 }
Example #2
0
    public virtual void UpdateState()
    {
        Debug.Log("UpdateState");
        float y   = Input.mousePosition.y;
        float num = y / Screen.height;

        if (num > 0.27f && !this.m_bOutMainUI)
        {
            SkillBase skill = SkillGameManager.GetSkillBase(this.m_unSkillId);
            if (skill != null)
            {
                EnumErrorCodeCheckUse errorCode = skill.CheckUse(Singleton <BeastRole> .singleton.Id);
                if (errorCode != EnumErrorCodeCheckUse.eCheckErr_Success)
                {
                    this.ShowErrCheckUse(errorCode);
                }
                else
                {
                    this.m_bOutMainUI = true;
                    //当鼠标离开UI做的处理
                }
            }
        }
        if (num < 0.25f && this.m_bOutMainUI)
        {
            this.m_bOutMainUI = false;
            //当鼠标进入UI做的处理
        }
    }
Example #3
0
    protected virtual void ShowCastRange()
    {
        SkillBase skill = SkillGameManager.GetSkillBase(this.m_unSkillId);

        if (skill != null)
        {
            List <CVector3> castRange = skill.GetCastRange(Singleton <BeastRole> .singleton.Id);
            CSceneMgr.singleton.ShowCaseRange(castRange);
        }
    }
 /// <summary>
 /// 神兽血量改变
 /// </summary>
 public void OnBeastHpChange()
 {
     foreach (var skill in this.m_listSkillData)
     {
         SkillBase skillStrategy = SkillGameManager.GetSkillBase(skill.Id);
         if (skillStrategy != null)
         {
             skillStrategy.OnBeastHpChange(this.m_unMasterBeastId);
         }
     }
 }
Example #5
0
    public override void Trigger()
    {
        XLog.Log.Debug("UseSkillEvent:Trigger:" + this.UseSkillParam.m_dwSkillId);
        base.Trigger();
        SkillBase skill = SkillGameManager.GetSkillBase(this.m_param.m_dwSkillId);

        if (skill != null)
        {
            skill.OnUseSkillAction(this.m_param);
        }
    }
    /// <summary>
    /// 获取技能特效的播放时间
    /// </summary>
    /// <param name="skillId"></param>
    /// <param name="attackerId"></param>
    /// <param name="targetId"></param>
    /// <param name="vTargetPos"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    public static float GetSkillHitTime(int skillId, long attackerId, long targetId, Vector3 vTargetPos, EffectInstanceType type)
    {
        SkillBase skill = SkillGameManager.GetSkillBase(skillId);

        if (skill != null)
        {
            return(skill.GetHitTime(attackerId, targetId, vTargetPos, type));
        }
        else
        {
            return(-1);
        }
    }
    /// <summary>
    /// 取得技能延迟
    /// </summary>
    /// <param name="skillID"></param>
    /// <param name="attakerId"></param>
    /// <param name="beAttacker"></param>
    /// <param name="targetPos"></param>
    /// <returns></returns>
    public static float GetSkillDuration(int skillID, long attakerId, List <long> beAttacker, Vector3 targetPos)
    {
        SkillBase skill = SkillGameManager.GetSkillBase(skillID);

        if (skill != null)
        {
            return(skill.GetDuration(attakerId, beAttacker, targetPos));
        }
        else
        {
            return(0);
        }
    }
Example #8
0
        /// <summary>
        /// 取得普通攻击范围内的所有敌人
        /// </summary>
        /// <param name="unMasterBeastId"></param>
        /// <returns></returns>
        public override List <CVector3> GetValidTargetHexs(long unMasterBeastId)
        {
            List <CVector3> listTargetHex = new List <CVector3>();
            Beast           beast         = Singleton <BeastManager> .singleton.GetBeastById(unMasterBeastId);

            if (beast == null || beast.IsError)
            {
                return(listTargetHex);
            }
            else
            {
                int       maxAttackDis = beast.MaxAttackDis;
                SkillBase skill        = SkillGameManager.GetSkillBase(this.m_unskillId);
                if (skill != null)
                {
                    List <long> list = new List <long>();
                    Singleton <ClientMain> .singleton.scene.GetNearEnemys(unMasterBeastId, maxAttackDis, ref list);

                    foreach (var id in list)
                    {
                        Beast beastById = Singleton <BeastManager> .singleton.GetBeastById(id);

                        if (beastById != null)
                        {
                            listTargetHex.Add(beastById.Pos);
                        }
                    }
                }

                /*
                 * ECampType nCamp = ECampType.CAMP_EMPIRE;
                 * if (Singleton<BeastRole>.singleton.CampType == ECampType.CAMP_EMPIRE)
                 * {
                 *  nCamp = ECampType.CAMP_LEAGUE;
                 * }
                 * CVector3 basePos = Singleton<ClientMain>.singleton.
                 */
                List <CVector3> targetList = new List <CVector3>();
                Singleton <ClientMain> .singleton.scene.GetNearNodesIgnoreObstruct(1, 1, beast.Pos, ref targetList, true, true);

                targetList.ForEach(delegate(CVector3 hex)
                {
                    if (listTargetHex.Contains(hex))
                    {
                        listTargetHex.Remove(hex);
                    }
                });
                return(listTargetHex);
            }
        }
 /// <summary>
 /// 技能释放特效
 /// </summary>
 /// <param name="unSkillId"></param>
 /// <param name="castSkillParam"></param>
 public void OnCastSkillEffect(int unSkillId, CastSkillParam castSkillParam)
 {
     try
     {
         SkillBase skillStrategy = SkillGameManager.GetSkillBase(unSkillId);
         if (null != skillStrategy)
         {
             skillStrategy.OnCastSkillEffect(castSkillParam);
         }
     }
     catch (Exception ex)
     {
         this.m_log.Fatal(ex.ToString());
     }
 }
Example #10
0
 /// <summary>
 /// 激活所有技能
 /// </summary>
 public void ActiveSkills()
 {
     for (int i = 0; i < this.m_listSkillData.Count; i++)
     {
         SkillGameData skillData = this.m_listSkillData[i];
         if (!skillData.IsActive)
         {
         }
         SkillBase skillBase = SkillGameManager.GetSkillBase(skillData.Id);
         if (skillBase != null)
         {
             skillBase.Active(this.m_unMasterBeastId);
         }
     }
 }
Example #11
0
 /// <summary>
 /// 神兽释放技能表现
 /// </summary>
 /// <param name="skillId"></param>
 /// <param name="param"></param>
 public void OnCastSkillAction(int skillId, CastSkillParam param)
 {
     try
     {
         SkillBase skill = SkillGameManager.GetSkillBase(skillId);
         if (skill != null)
         {
             skill.OnCastAction(param);
         }
     }
     catch (Exception e)
     {
         this.m_log.Fatal(e.ToString());
     }
 }
Example #12
0
    /// <summary>
    /// 取得该神兽能使用的技能列表
    /// </summary>
    /// <returns></returns>
    public List <int> GetCanUseSkills()
    {
        List <int> list = new List <int>();

        foreach (var data in this.m_listSkillData)
        {
            SkillBase skillStrategy = SkillGameManager.GetSkillBase(data.Id);
            if (skillStrategy != null)
            {
                if (skillStrategy.CheckUse(this.m_unMasterBeastId) == EnumErrorCodeCheckUse.eCheckErr_Success)
                {
                    list.Add(data.Id);
                }
            }
        }
        return(list);
    }
Example #13
0
    /// <summary>
    /// 激活某个技能
    /// </summary>
    /// <param name="unSkillId"></param>
    public void ActiveSkill(int unSkillId)
    {
        SkillGameData skill = this.GetSkillById(unSkillId);

        if (skill != null && !skill.IsError)
        {
            if (!skill.IsActive)
            {
                //this.MasterBeast
            }
            SkillBase skillStrategy = SkillGameManager.GetSkillBase(skill.Id);
            if (skillStrategy != null)
            {
                skillStrategy.Active(this.m_unMasterBeastId);
            }
        }
    }
Example #14
0
 private void Register(UseSkillBase skillState)
 {
     if (skillState != null)
     {
         SkillBase skill = SkillGameManager.GetSkillBase(skillState.SkillId);
         if (null == skill)
         {
             this.m_log.Error("null == skillBase,找不到该技能");
         }
         else
         {
             if (!this.m_dicSkillState.ContainsKey(skillState.SkillType))
             {
                 this.m_dicSkillState.Add(skillState.SkillType, new Dictionary <int, UseSkillBase>());
             }
             this.m_dicSkillState[skillState.SkillType][skillState.SkillId] = skillState;
         }
     }
 }
Example #15
0
    public override void OnEnter()
    {
        base.OnEnter();
        SkillBase skill = SkillGameManager.GetSkillBase(this.m_unSkillId);

        if (skill != null)
        {
            this.m_listValidTargetPos     = skill.GetValidTargetHexs(Singleton <BeastRole> .singleton.Id);
            this.m_listValidTargetBeastId = skill.GetValidTargetPlayers(Singleton <BeastRole> .singleton.Id);
        }
        Beast beast = Singleton <BeastManager> .singleton.GetBeastById(Singleton <BeastRole> .singleton.Id);

        //还没有攻击过
        if (beast.UsedAttackToBaseBuildingCount < 1)
        {
            Singleton <HexagonManager> .singleton.ShowHexagon(EnumShowHexagonType.eShowHexagonType_Highlight, this.m_listValidTargetPos);
        }
        //高亮角色模型(边缘外发光)
    }
Example #16
0
    public override bool OnHoverPos(CVector3 pos)
    {
        if (m_listValidTargetPos.Exists((CVector3 p) => p.Equals(pos)))
        {
            SkillBase skill = SkillGameManager.GetSkillBase(this.m_unSkillId);
            if (skill != null)
            {
                List <CVector3> affectAreaByTargetBeast = skill.GetAffectAreaByTargetPos(Singleton <BeastRole> .singleton.Id, pos);
                Singleton <HexagonManager> .singleton.ShowHexagon(EnumShowHexagonType.eShowHexagonType_Affect, affectAreaByTargetBeast);

                List <long> affectBeastsByTargetBeast = skill.GetAffectBeastsByTargetPos(Singleton <BeastRole> .singleton.Id, pos);
                //高亮角色模型
            }
        }
        else
        {
            Singleton <HexagonManager> .singleton.ClearHexagon(EnumShowHexagonType.eShowHexagonType_Affect);

            //不显示角色模型高亮
        }
        return(true);
    }
Example #17
0
    public override bool OnHoverBeast(long beastId)
    {
        if (this.m_listValidTargetBeastId.Contains(beastId))
        {
            SkillBase skill = SkillGameManager.GetSkillBase(this.m_unSkillId);
            if (skill != null)
            {
                List <CVector3> affectAreaByTargetBeast = skill.GetAffectAreaByTargetBeast(Singleton <BeastRole> .singleton.Id, beastId);
                Singleton <HexagonManager> .singleton.ShowHexagon(EnumShowHexagonType.eShowHexagonType_Affect, affectAreaByTargetBeast);

                List <long> affectBeastsByTargetBeast = skill.GetAffectBeastsByTargetBeast(Singleton <BeastRole> .singleton.Id, beastId);
                //高亮角色模型
            }
        }
        else
        {
            Singleton <HexagonManager> .singleton.ClearHexagon(EnumShowHexagonType.eShowHexagonType_Affect);

            //不显示角色模型高亮
        }
        return(true);
    }
Example #18
0
 /// <summary>
 /// 释放技能
 /// </summary>
 /// <param name="skillId"></param>
 /// <param name="param"></param>
 public void OnCastSkill(int skillId, CastSkillParam param)
 {
     try
     {
         SkillGameData skillData = this.GetSkillById(skillId);
         if (skillData != null && !skillData.IsError)
         {
             foreach (var current in this.m_listSkillData)
             {
                 SkillBase skillBegin = SkillGameManager.GetSkillBase(current.Id);
                 if (skillBegin != null)
                 {
                     skillBegin.OnCastSkillBegin(this.m_unMasterBeastId, skillId);
                 }
             }
             SkillBase skill = SkillGameManager.GetSkillBase(skillData.Id);
             if (skill != null)
             {
                 param.unTargetSkillID = skillId;
                 skill.Cast(param);
             }
             foreach (var current in this.m_listSkillData)
             {
                 SkillBase skillEnd = SkillGameManager.GetSkillBase(current.Id);
                 if (skillEnd != null)
                 {
                     skillEnd.OnCastSkillBegin(this.m_unMasterBeastId, skillId);
                 }
             }
         }
     }
     catch (Exception e)
     {
         this.m_log.Fatal(e);
     }
 }
Example #19
0
    /// <summary>
    /// 该技能是否被攻击者向前
    /// </summary>
    /// <param name="skillId"></param>
    /// <returns></returns>
    public static bool IsBeAttackForward(int skillId)
    {
        SkillBase skill = SkillGameManager.GetSkillBase(skillId);

        return(skill != null && skill.IsBeAttackForward);
    }