コード例 #1
0
ファイル: Command.cs プロジェクト: pb0/ID0_Test
    public readonly SkillEntity skillEntity;    // ddong

    public Command(SkillEntity skillEntity, bool preCooltime, FireCondition condition)
        : this(skillEntity.Motion, skillEntity.ActionPattern, skillEntity.Priority, skillEntity.CooldownTime, skillEntity.GlobalCooldownTime, preCooltime, condition)
    {
        this.skillEntity = skillEntity;
        this.castTime = skillEntity.CastTime;
        this.castMotion = skillEntity.castMotion;
        this.manaConsume = skillEntity.ManaConsume;
    }
コード例 #2
0
ファイル: OnDemandCommand.cs プロジェクト: pb0/ID0_Test
 public OnDemandCommand(SkillEntity skillEntity, bool preCooltime, FireCondition condition)
     : base(skillEntity, preCooltime, condition)
 {
     pattern = ActionPattern.Create(actionPattern);
 }
コード例 #3
0
ファイル: SkillCommands.cs プロジェクト: pb0/ID0_Test
 public SkillCommand(SkillEntity skillEntity, FireCondition condition)
     : base(skillEntity.Motion, ApplyManaConsume(skillEntity.ActionPattern, skillEntity.ManaConsume), skillEntity.Priority, skillEntity.CooldownTime, skillEntity.GlobalCooldownTime, false, condition)
 {
     this.skillEntity = skillEntity;
 }
コード例 #4
0
 public void CreateSkill(SkillEntity skill)
 {
     skillRepository.Create(skill.ToDalSkill());
     uow.Commit();
 }
コード例 #5
0
 public void UpdateSkill(SkillEntity skill)
 {
     throw new NotImplementedException();
 }
コード例 #6
0
        public async Task Add(SkillEntity entity)
        {
            await _skillRepository.Add(entity);

            await _bus.RaiseEvent(new EntityInsertedEvent <SkillEntity>(entity)).ConfigureAwait(false);
        }
コード例 #7
0
        public async Task Delete(SkillEntity entity)
        {
            await _skillRepository.Remove(entity);

            await _bus.RaiseEvent(new EntityDeletedEvent <SkillEntity>(entity)).ConfigureAwait(false);
        }
コード例 #8
0
ファイル: RoleHurt.cs プロジェクト: tongxingyang/MMORPG
    /// <summary> 角色受伤 </summary>
    /// <param name="attackInfo"></param>
    public IEnumerator ToHurt(RoleTransferAttackInfo attackInfo)
    {
        if (m_CurrRoleFSMMgr == null)
        {
            yield break;
        }
        //如果角色已经死亡了 直接返回
        if (m_CurrRoleFSMMgr.CurrRoleStateEnum == RoleState.Die)
        {
            yield break;
        }
        SkillEntity skillEntity = SkillDBModel.Instance.Get(attackInfo.SkillId);

        if (skillEntity == null)
        {
            yield break;
        }

        yield return(new WaitForSeconds(skillEntity.ShowHurtEffectDelaySecond));

        //1.减血

        m_CurrRoleFSMMgr.CurrRoleCtrl.CurrRoleInfo.CurrHP -= attackInfo.HurtValue;
        int   fontSize = 15;
        Color color    = Color.red;

        if (attackInfo.IsCri)
        {
            fontSize = 30;
            color    = Color.yellow;
        }
        UISceneCtrl.Instance.CurrentUIScene.HUDText.NewText("- " + attackInfo.HurtValue, m_CurrRoleFSMMgr.CurrRoleCtrl.transform, color, fontSize, 15f, -1f, 2.2f, UnityEngine.Random.Range(0, 2) == 1? bl_Guidance.RightDown:bl_Guidance.LeftDown);
        if (OnRoleHurt != null)
        {
            OnRoleHurt();
        }
        if (m_CurrRoleFSMMgr.CurrRoleCtrl.CurrRoleInfo.CurrHP <= 0)
        {
            //角色死亡
            m_CurrRoleFSMMgr.CurrRoleCtrl.CurrRoleInfo.CurrHP = 0;
            m_CurrRoleFSMMgr.CurrRoleCtrl.ToDie();

            yield break;
        }
        //2.播放受伤特效
        Transform hurtTrans = EffectManager.Instance.PlayEffect("Effect_Hurt", "Common");

        //TODO 设置特效位置
        hurtTrans.position = m_CurrRoleFSMMgr.CurrRoleCtrl.transform.position;
        hurtTrans.rotation = m_CurrRoleFSMMgr.CurrRoleCtrl.transform.rotation;
        EffectManager.Instance.DestroyEffect(hurtTrans, 2f);


        //3.弹出受伤数字 HUDText(包括暴击效果)

        //4.屏幕泛红

        //不是僵直状态才播放受伤动画
        if (!m_CurrRoleFSMMgr.CurrRoleCtrl.IsRigidity)
        {
            m_CurrRoleFSMMgr.ChangeState(RoleState.Hurt);
        }
    }
コード例 #9
0
    /// <summary>
    /// 自动战斗
    /// </summary>
    private void AutoFightState()
    {
        if (CurRoleCtrl.IsRigibody)
        {
            return;
        }
        if (!GameLevelSceneCtrl.Instance.CurRegionHasMonster)   //当前区域没有怪了
        {
            //进入下一个区域
            if (GameLevelSceneCtrl.Instance.LastRegion)//如果是最后一个区域的怪
            {
                return;
            }
            else
            {
                Vector3 nextRegionPos = GameLevelSceneCtrl.Instance.NextRegionPlyaerPos;
                CurRoleCtrl.MoveTo(nextRegionPos);
            }
        }
        else    // 当前区域有怪
        {
            if (CurRoleCtrl.FSM.CurrentRoleStateEnum == RoleState.Idle)
            {
                //找怪打怪
                if (CurRoleCtrl.LockEnemy == null)  //当前没有锁定敌人
                {
                    //搜索敌人
                    m_SearchPlayerList.Clear();
                    Collider[] cols = Physics.OverlapSphere(CurRoleCtrl.transform.position, 1000, 1 << LayerMask.NameToLayer("Role"));
                    if (cols != null && cols.Length > 0)
                    {
                        //找到敌人
                        for (int i = 0; i < cols.Length; i++)
                        {
                            RoleCtrl localEnemy = cols[i].GetComponent <RoleCtrl>();
                            if (localEnemy.CurRoleType == RoleType.Monster && localEnemy.CurRoleInfo.CurrentHP > 0)
                            {
                                m_SearchPlayerList.Add(cols[i]);
                            }
                        }
                    }
                    if (m_SearchPlayerList.Count > 0)
                    {
                        m_SearchPlayerList.Sort((Collider c1, Collider c2) =>
                        {
                            if (Vector3.Distance(CurRoleCtrl.transform.position, c1.transform.position) < Vector3.Distance(CurRoleCtrl.transform.position, c2.transform.position))
                            {
                                return(-1);
                            }
                            else
                            {
                                return(1);
                            }
                        });
                        CurRoleCtrl.LockEnemy = m_SearchPlayerList[0].GetComponent <RoleCtrl>();
                    }
                    else
                    {
                        CurRoleCtrl.LockEnemy = null;
                    }
                }
                else   //当前有锁定敌人
                {
                    if (CurRoleCtrl.LockEnemy.FSM.CurrentRoleStateEnum == RoleState.Die)
                    {
                        CurRoleCtrl.LockEnemy = null;
                        return;
                    }
                    //定义要使用的id和技能类型
                    int        skillId    = 0;
                    AttackType attackType = AttackType.PhyAttack;
                    //首先检测有没有可使用的技能
                    int canUseSkillId = ((RoleInfoMainPlayer)CurRoleCtrl.CurRoleInfo).GetCanUseSkill();
                    if (canUseSkillId > 0)   //如果有可使用的技能
                    {
                        //设置技能攻击
                        skillId    = canUseSkillId;
                        attackType = AttackType.SkillAttack;
                    }
                    else
                    {
                        //设置物理攻击
                        skillId    = CurRoleCtrl.CurRoleInfo.PhyAttackList[m_PhyAttackIndex];;
                        attackType = AttackType.PhyAttack;
                        m_PhyAttackIndex++;
                        if (m_PhyAttackIndex >= CurRoleCtrl.CurRoleInfo.PhyAttackList.Length)
                        {
                            m_PhyAttackIndex = 0;
                        }
                    }
                    SkillEntity skillEntity = SkillDBModel.Instance.Get(skillId);
                    if (skillEntity == null)
                    {
                        return;
                    }
                    float attackRange = skillEntity.AttackRange;
                    //攻击范围之内

                    if (Vector3.Distance(CurRoleCtrl.LockEnemy.transform.position, CurRoleCtrl.transform.position) < attackRange)
                    {
                        if (attackType == AttackType.PhyAttack)
                        {
                            CurRoleCtrl.ToAttack(attackType, skillId);
                        }
                        else
                        {
                            PlayerCtrl.Instance.ClickSkillButton(skillId);
                        }
                    }
                    else //追击
                    {
                        if (CurRoleCtrl.FSM.CurrentRoleStateEnum == RoleState.Idle)
                        {
                            Vector3    m_MoveTarget = GameUtil.GetTargetSectorPoint(CurRoleCtrl.transform.position, CurRoleCtrl.LockEnemy.transform.position, Random.Range(0.9f, 1.1f) * attackRange);
                            RaycastHit hitinfo1;
                            Ray        ray1 = new Ray(new Vector3(m_MoveTarget.x, m_MoveTarget.y + 1000, m_MoveTarget.z), -Vector3.up);
                            if (Physics.Raycast(ray1, out hitinfo1, 1000, 1 << LayerMask.NameToLayer("RegionMask")))
                            {
                                return;
                            }
                            CurRoleCtrl.MoveTo(m_MoveTarget);
                        }
                    }
                }
            }
        }
    }
コード例 #10
0
        public void Insert(SkillEntity entity, SqliteDatabase mdb = null)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("INSERT INTO skill VALUES (")


            .Append(entity.Id)

            .Append(",")

            .Append("'")
            .Append(entity.SystemName)
            .Append("'")
            .Append(",")

            .Append("'")
            .Append(entity.DisplayName)
            .Append("'")
            .Append(",")

            .Append("'")
            .Append(entity.Lang)
            .Append("'")
            .Append(",")


            .Append(entity.Level)

            .Append(",")


            .Append(entity.Type1)

            .Append(",")


            .Append(entity.Power1)

            .Append(",")


            .Append(entity.Turn1)

            .Append(",")


            .Append(entity.Type2)

            .Append(",")


            .Append(entity.Power2)

            .Append(",")


            .Append(entity.Turn2)

            .Append(",")


            .Append(entity.Seconds)

            .Append(",")


            .Append(entity.Range)



            .Append(");");
            if (mdb == null)
            {
                DbManager.Instance.ExecuteNonQuery(sb.ToString());
            }
            else
            {
                DbManager.Instance.ExecuteNonQuery(sb.ToString(), mdb);
            }
        }
コード例 #11
0
        public void Update(SkillEntity entity, SqliteDatabase mdb = null)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("UPDATE skill SET ")

            .Append("id = ")

            .Append(entity.Id)

            .Append(",")

            .Append("system_name = ")
            .Append("'")
            .Append(entity.SystemName)
            .Append("'")
            .Append(",")

            .Append("display_name = ")
            .Append("'")
            .Append(entity.DisplayName)
            .Append("'")
            .Append(",")

            .Append("lang = ")
            .Append("'")
            .Append(entity.Lang)
            .Append("'")
            .Append(",")

            .Append("level = ")

            .Append(entity.Level)

            .Append(",")

            .Append("type1 = ")

            .Append(entity.Type1)

            .Append(",")

            .Append("power1 = ")

            .Append(entity.Power1)

            .Append(",")

            .Append("turn1 = ")

            .Append(entity.Turn1)

            .Append(",")

            .Append("type2 = ")

            .Append(entity.Type2)

            .Append(",")

            .Append("power2 = ")

            .Append(entity.Power2)

            .Append(",")

            .Append("turn2 = ")

            .Append(entity.Turn2)

            .Append(",")

            .Append("seconds = ")

            .Append(entity.Seconds)

            .Append(",")

            .Append("range = ")

            .Append(entity.Range)



            .Append(" WHERE id = ")
            .Append(entity.Id)
            .Append(";");
            if (mdb == null)
            {
                DbManager.Instance.ExecuteNonQuery(sb.ToString());
            }
            else
            {
                DbManager.Instance.ExecuteNonQuery(sb.ToString(), mdb);
            }
        }
コード例 #12
0
 public Task <Result <List <SkillEntity> > > InsertSkills(List <SkillEntity> skills)
 => skills.Select(a => SkillEntity.Create(a.UserId, a.Id, a.Name, a.Punctuation)).ToList().Success().Async();