Esempio n. 1
0
        public override bool Proc(EntityParent theOwner)
        {
            EntityParent enemy = theOwner.GetTargetEntity();

            if (enemy == null || enemy.curHp <= 0)
            {
                theOwner.blackBoard.enemyId = 0;
            }

            if (theOwner.blackBoard.enemyId != 0)
            {
                //Mogo.Util.LoggerHelper.Debug("AI:" + "HasFightTarget:" + "true");
            }
            else
            {
                //Mogo.Util.LoggerHelper.Debug("AI:" + "HasFightTarget:" + "false");
            }

            return(theOwner.blackBoard.enemyId != 0);
        }
Esempio n. 2
0
        public override bool Proc(EntityParent theOwner)
        {
            //todo检查与之前使用技能时候所在坐标距离
            EntityParent target = theOwner.GetTargetEntity();

            if (target == null || target.Transform == null)
            {
                //Mogo.Util.LoggerHelper.Debug("AI:" + "CmpTargetDistance:" + "false");
                return(false);
            }
            float testDis = Vector3.Distance(target.Transform.position, theOwner.Transform.position);
            bool  rnt     = CmpTypeMethod.Cmp(_cmp, (int)(testDis * 100), _distance);

            if (rnt)
            {
                //Mogo.Util.LoggerHelper.Debug("AI:" + "CmpTargetDistance:" + "true");
            }
            else
            {
                //Mogo.Util.LoggerHelper.Debug("AI:" + "CmpTargetDistance:" + "false");
            }

            return(rnt);
        }
Esempio n. 3
0
    // 发出攻击
    public void OnAttacking(int hitActionID, Matrix4x4 ltwm, Quaternion rotation, Vector3 forward, Vector3 position)
    {
        //能进本方法,说明已经能过前面的ID存在校验
        SkillAction action = SkillAction.dataMap[hitActionID];

        // 如果需要,关闭碰撞
        if (action.removeCollider == 1)
        {
            // 调用自己去除碰撞
            Physics.IgnoreLayerCollision(8, 11);
            TimerHeap.AddTimer(500, 0, () => { Physics.IgnoreLayerCollision(8, 11, false); });
        }
        if (action.freeze == 1)
        {//冻结周围, hitAction后解冻
            FreezeButMyself();
        }
        if (action.replication == 1)
        {//分身
            theOwner.CreateDuplication();
        }
        // 播动作
        int act = action.action;

        if (act > 0)
        {
            if (PlayerActionNames.names.ContainsKey(act))
            {
                theOwner.skillActName = PlayerActionNames.names[act];
            }
            else
            {
                theOwner.skillActName = "";
            }

            if (theOwner is EntityMercenary && theOwner.blackBoard.skillReversal == 0 && !theOwner.NotTurn())
            {//雇佣兵每action都会面朝敌人
                EntityParent enemy = theOwner.GetTargetEntity();
                if (enemy != null && enemy.Transform != null && theOwner.Transform != null)
                {
                    //theOwner.motor.SetTargetToLookAt(enemy.Transform);
                    theOwner.Transform.LookAt(new Vector3(enemy.Transform.position.x, theOwner.Transform.position.y, enemy.Transform.position.z));
                }
            }
            theOwner.SetAction(act);
        }
        AttackingFx(action);
        AttackingMove(action);
        AttackBuff(action);

        List <object> args = new List <object>();

        args.Add(ltwm);
        args.Add(rotation);
        args.Add(forward);
        args.Add(position);
        theOwner.delayAttackTimerID = TimerHeap.AddTimer((uint)(action.actionBeginDuration / theOwner.aiRate), 0, DelayAttack, hitActionID, args);
        if (theOwner is EntityDummy && action.spawnPoint > 0 && MogoWorld.IsClientMission)
        {
            MogoWorld.thePlayer.RpcCall("CliEntitySkillReq", (uint)1, (uint)action.spawnPoint);
        }
        //theOwner.breakAble = false;
    }