public bool CheckShakeDistance(ActorRoot captain, ActorRoot user)
        {
            if (captain == null || user == null)
            {
                return(false);
            }
            if (captain == user)
            {
                return(true);
            }
            VInt3 vInt = captain.location - user.location;
            long  num  = (long)CameraShakeDuration.shakeDistance;

            num *= num;
            return(vInt.get_sqrMagnitudeLong2D() <= num);
        }
Beispiel #2
0
        private void MoveToTarget(Action _action, int _localTime)
        {
            int num = _localTime - this.lastTime;

            this.lastTime = _localTime;
            VInt3 location = this.moveActor.get_handle().location;

            this.InitTarget();
            VInt3 dir = this.destPosition - location;

            if (this.bMoveRotate)
            {
                this.RotateMoveBullet(dir);
            }
            int num2 = this.velocity * num / 1000;

            if ((long)num2 * (long)num2 >= dir.get_sqrMagnitudeLong2D())
            {
                this.moveActor.get_handle().location = this.destPosition;
                if (this.curEffectCount < this.maxEffectCount)
                {
                    this.curEffectCount++;
                    int num3 = 0;
                    if (this.effectCountMap.TryGetValue(this.tarActor.get_handle().ObjID, ref num3))
                    {
                        this.effectCountMap.set_Item(this.tarActor.get_handle().ObjID, ++num3);
                    }
                    else
                    {
                        this.effectCountMap.Add(this.tarActor.get_handle().ObjID, ++num3);
                    }
                    this.SpawnBuff(_action, this.curEffectCount);
                    this.tarActor = this.SearchTarget();
                    if (!this.tarActor)
                    {
                        this.stopCondtion = true;
                    }
                }
                else
                {
                    this.stopCondtion = true;
                }
            }
            else
            {
                VInt3 vInt;
                if (this.gravity < 0 && this.InitGravity())
                {
                    dir.y   = 0;
                    vInt    = location + dir.NormalizeTo(num2);
                    vInt.y += this.gravityControler.GetMotionDeltaDistance(num);
                    VInt vInt2;
                    if (PathfindingUtility.GetGroundY(vInt, out vInt2) && vInt.y < vInt2.i)
                    {
                        vInt.y = vInt2.i;
                    }
                }
                else
                {
                    vInt = location + dir.NormalizeTo(num2);
                }
                this.moveActor.get_handle().location = vInt;
            }
        }
Beispiel #3
0
    public void Move(out VInt3 targetDir, int dt)
    {
        targetDir = VInt3.forward;
        if (this.targetReached || !this.canMove)
        {
            return;
        }
        ActorRoot handle   = this.actor.get_handle();
        VInt3     location = handle.location;
        VInt3     vInt     = this.CaculateDir(location);

        if (this.targetDirection.x != 0 || this.targetDirection.z != 0)
        {
            targetDir = this.targetDirection;
            targetDir.NormalizeTo(1000);
        }
        else
        {
            targetDir = handle.forward;
        }
        VInt3 vInt2 = handle.location;
        VInt3 vInt3 = vInt;

        vInt3 *= this.speed * dt / 1000;
        vInt3 /= 1000f;
        bool flag = this.rvo != null && this.rvo.enabled;
        bool hasReachedNavEdge = false;

        if (this.checkNavNode && !flag)
        {
            VInt groundY;
            vInt3          = PathfindingUtility.Move(this.actor, vInt3, out groundY, out hasReachedNavEdge, null);
            handle.groundY = groundY;
        }
        if ((handle.location - this.targetPos).get_sqrMagnitudeLong2D() <= vInt3.get_sqrMagnitudeLong2D())
        {
            if (this.checkNavNode && !this.targetPosIsValid)
            {
                vInt2 = handle.location + vInt3;
            }
            else
            {
                vInt2 = this.targetPos;
            }
            this.targetReached = true;
            this.OnTargetReached();
        }
        else
        {
            vInt2 = handle.location + vInt3;
        }
        if (flag)
        {
            VInt3 vInt4 = vInt2 - handle.location;
            vInt4 = IntMath.Divide(vInt4, 1000L, (long)dt);
            this.rvo.Move(vInt4);
        }
        else
        {
            handle.location          = vInt2;
            handle.hasReachedNavEdge = hasReachedNavEdge;
        }
    }
        public override void BeAttackHit(PoolObjHandle <ActorRoot> atker, bool bExposeAttacker)
        {
            if (!this.actor.IsSelfCamp(atker.get_handle()))
            {
                if (this.actorSubType == 2)
                {
                    long num = (long)this.cfgInfo.iPursuitR;
                    if (this.actor.ValueComponent.actorHp * 10000 / this.actor.ValueComponent.actorHpTotal > 500 || (atker.get_handle().location - this.originalPos).get_sqrMagnitudeLong2D() < num * num)
                    {
                        if (this.actorSubSoliderType == 8)
                        {
                            Vector3 vec = this.actor.forward.get_vec3();
                            Vector3 rhs = atker.get_handle().location.get_vec3() - this.actor.location.get_vec3();
                            if (Vector3.Dot(vec, rhs) < 0f)
                            {
                                if ((atker.get_handle().location - this.actor.location).get_sqrMagnitudeLong2D() < this.BaronPretectDistance)
                                {
                                    base.SetInBattle();
                                    this.m_isAttacked = true;
                                }
                                else
                                {
                                    for (int i = 0; i < Singleton <GameObjMgr> .get_instance().HeroActors.get_Count(); i++)
                                    {
                                        Vector3 rhs2 = Singleton <GameObjMgr> .get_instance().HeroActors.get_Item(i).get_handle().location.get_vec3() - this.actor.location.get_vec3();

                                        VInt3 vInt = Singleton <GameObjMgr> .get_instance().HeroActors.get_Item(i).get_handle().location - this.actor.location;

                                        if (vInt.get_sqrMagnitudeLong2D() < this.BaronPretectDistance || (vInt.get_sqrMagnitudeLong2D() < num * num && Vector3.Dot(vec, rhs2) > 0f))
                                        {
                                            base.SetInBattle();
                                            this.m_isAttacked = true;
                                            break;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                base.SetInBattle();
                                this.m_isAttacked = true;
                            }
                            Singleton <SoundCookieSys> .get_instance().OnBaronAttacked(this, atker.get_handle());
                        }
                        else
                        {
                            base.SetInBattle();
                            this.m_isAttacked = true;
                        }
                    }
                }
                else
                {
                    base.SetInBattle();
                    this.m_isAttacked = true;
                }
                atker.get_handle().ActorControl.SetInBattle();
                atker.get_handle().ActorControl.SetInAttack(this.actorPtr, bExposeAttacker);
                DefaultGameEventParam defaultGameEventParam = new DefaultGameEventParam(base.GetActor(), atker);
                Singleton <GameEventSys> .get_instance().SendEvent <DefaultGameEventParam>(GameEventDef.Event_ActorBeAttack, ref defaultGameEventParam);
            }
        }
        public override void UpdateLogic(int delta)
        {
            this.actor.ActorAgent.UpdateLogic(delta);
            base.UpdateLogic(delta);
            if (base.IsBornState)
            {
                this.UpdateBornLogic(delta);
            }
            else
            {
                if (this.isEnduranceDown)
                {
                    this.endurance -= delta;
                    if (this.endurance < 0)
                    {
                        this.endurance = 0;
                    }
                }
                if (this.lifeTime > 0)
                {
                    this.lifeTime -= delta;
                    if (this.lifeTime <= 0)
                    {
                        base.SetObjBehaviMode(ObjBehaviMode.State_Dead);
                    }
                }
                if (this.actorSubSoliderType == 8 && this.myBehavior == ObjBehaviMode.State_AutoAI && !this.actor.SkillControl.isUsing)
                {
                    List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .get_instance().HeroActors;

                    Vector3 vec = this.actor.forward.get_vec3();
                    long    num = (long)this.cfgInfo.iPursuitR;
                    num *= num;
                    bool flag  = false;
                    int  count = heroActors.get_Count();
                    for (int i = 0; i < count; i++)
                    {
                        VInt3   location           = heroActors.get_Item(i).get_handle().location;
                        VInt3   vInt               = location - this.actor.location;
                        Vector3 vec2               = vInt.get_vec3();
                        long    sqrMagnitudeLong2D = vInt.get_sqrMagnitudeLong2D();
                        if (sqrMagnitudeLong2D < this.BaronPretectDistance || (sqrMagnitudeLong2D < num && Vector3.Dot(vec, vec2) > 0f))
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        base.SetObjBehaviMode(ObjBehaviMode.State_Idle);
                    }
                }
                if (this.actor.ActorControl.IsDeadState || this.myBehavior != ObjBehaviMode.State_Idle)
                {
                    this.nOutCombatHpRecoveryTick = 0;
                }
                else
                {
                    this.nOutCombatHpRecoveryTick += delta;
                    if (this.nOutCombatHpRecoveryTick >= 1000)
                    {
                        int nAddHp = this.cfgInfo.iOutCombatHPAdd * this.actor.ValueComponent.mActorValue[5].totalValue / 10000;
                        base.ReviveHp(nAddHp);
                        this.nOutCombatHpRecoveryTick -= 1000;
                    }
                }
                if (this.isCalledMonster)
                {
                    this.OnCheckDistance(0);
                }
            }
        }