示例#1
0
 public override void Leave(Action _action, Track _track)
 {
     if (this.actor_ != 0)
     {
         if (this.IgnoreCollision)
         {
             bool flag = false;
             _action.refParams.GetRefParam("_HitTargetHero", ref flag);
             if (!flag)
             {
                 this.SetFinalPos();
             }
             else
             {
                 VInt3 zero = VInt3.zero;
                 _action.refParams.GetRefParam("_HitTargetHeroPos", ref zero);
                 if (!PathfindingUtility.IsValidTarget((ActorRoot)this.actor_, zero))
                 {
                     this.SetFinalPos();
                 }
                 else
                 {
                     this.actor_.handle.location = zero;
                 }
             }
         }
         this.actor_.handle.ObjLinker.RmvCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp));
         this.actor_.handle.ActorControl.RmvNoAbilityFlag(ObjAbilityType.ObjAbility_Move);
         this.done_ = true;
     }
 }
示例#2
0
        public bool FindNearestNotBrickFromWorldLocNonFow(ref VInt3 newPos, ActorRoot ar)
        {
            VInt3 vInt  = new VInt3(newPos.x, newPos.z, 0);
            VInt2 vInt2 = VInt2.zero;

            this.LevelGrid.WorldPosToGrid(vInt, out vInt2.x, out vInt2.y);
            bool flag = false;

            FieldObj.SViewBlockAttr sViewBlockAttr = default(FieldObj.SViewBlockAttr);
            if (this.QueryAttr(vInt2, out sViewBlockAttr) && sViewBlockAttr.BlockType == 2)
            {
                flag = true;
            }
            else if (!PathfindingUtility.IsValidTarget(ar, newPos))
            {
                flag = true;
            }
            if (!flag)
            {
                return(true);
            }
            VInt2 zero = VInt2.zero;

            if (this.FindNearestGrid(vInt2, vInt, FieldObj.EViewBlockType.Brick, true, 4, ar, out zero))
            {
                vInt2 = zero;
                VInt3 zero2 = VInt3.zero;
                this.LevelGrid.GridToWorldPos(vInt2.x, vInt2.y, out zero2);
                newPos = new VInt3(zero2.x, newPos.y, zero2.y);
                return(true);
            }
            return(false);
        }
 private void SetFinalPos()
 {
     if (!this.bStayInCurrentPosWhenStop)
     {
         VInt vInt = 0;
         PathfindingUtility.GetGroundY(this.finalPos, out vInt);
         this.finalPos.y             = vInt.i;
         this.actor_.handle.location = this.finalPos;
     }
     else if (!PathfindingUtility.IsValidTarget(this.actor_, this.actor_.handle.location))
     {
         bool  flag  = false;
         VInt3 vInt2 = VInt3.zero;
         vInt2 = PathfindingUtility.FindValidTarget(this.actor_, this.actor_.handle.location, this.finalPos, 10000, out flag);
         if (!flag)
         {
             vInt2 = PathfindingUtility.FindValidTarget(this.actor_, this.actor_.handle.location, this.srcPos, 10000, out flag);
         }
         if (flag)
         {
             VInt vInt3 = 0;
             PathfindingUtility.GetGroundY(vInt2, out vInt3);
             vInt2.y       = vInt3.i;
             this.finalPos = vInt2;
             this.actor_.handle.location = vInt2;
         }
         else
         {
             this.actor_.handle.location = this.finalPos;
         }
     }
 }
示例#4
0
        public void Teleport()
        {
            VInt  groundY = this.actor_.get_handle().groundY;
            VInt3 vInt    = this.dir.NormalizeTo(this.moveDistance);
            VInt3 vInt2   = this.actor_.get_handle().location + vInt;
            bool  flag    = false;

            if (PathfindingUtility.IsValidTarget(this.actor_, vInt2))
            {
                PathfindingUtility.GetGroundY(vInt2, out groundY);
                vInt2.y = groundY.i;
                this.actor_.get_handle().location = vInt2;
            }
            else
            {
                VInt3 vInt3 = PathfindingUtility.FindValidTarget(this.actor_, vInt2, this.actor_.get_handle().location, 10000, out flag);
                if (flag)
                {
                    PathfindingUtility.GetGroundY(vInt3, out groundY);
                    vInt3.y = groundY.i;
                    this.actor_.get_handle().location = vInt3;
                }
                else
                {
                    vInt = PathfindingUtility.Move(this.actor_.get_handle(), vInt, out groundY, out this.actor_.get_handle().hasReachedNavEdge, null);
                    this.actor_.get_handle().location += vInt;
                }
            }
            if (this.bUseRecordPosition)
            {
                this.actor_.get_handle().ActorControl.RmvNoAbilityFlag(ObjAbilityType.ObjAbility_MoveProtect);
            }
            this.actor_.get_handle().groundY = groundY;
            this.done_ = true;
        }
示例#5
0
        public bool FindNearestGrid(VInt2 inCenterCell, VInt3 inCenterPosWorld, FieldObj.EViewBlockType inBlockType, bool bNonType, int inThicknessMax, ActorRoot ar, out VInt2 result)
        {
            result = VInt2.zero;
            FieldObj.SViewBlockAttr sViewBlockAttr = default(FieldObj.SViewBlockAttr);
            bool         flag  = false;
            int          num   = 1;
            List <VInt2> list  = new List <VInt2>();
            List <VInt2> list2 = new List <VInt2>();

            while (!flag && num <= inThicknessMax)
            {
                list2.Clear();
                this.CollectNeighbourGrids(list2, list, inCenterCell, num);
                num++;
                list.AddRange(list2);
                if (list2.get_Count() > 0)
                {
                    for (int i = list2.get_Count() - 1; i >= 0; i--)
                    {
                        this.QueryAttr(list2.get_Item(i), out sViewBlockAttr);
                        if ((bNonType && sViewBlockAttr.BlockType == (byte)inBlockType) || (!bNonType && sViewBlockAttr.BlockType != (byte)inBlockType))
                        {
                            list2.RemoveAt(i);
                        }
                    }
                }
                if (list2.get_Count() > 0)
                {
                    long num2 = 2147483647L;
                    for (int j = 0; j < list2.get_Count(); j++)
                    {
                        VInt2 vInt = list2.get_Item(j);
                        VInt3 zero = VInt3.zero;
                        this.LevelGrid.GridToWorldPos(vInt.x, vInt.y, out zero);
                        long sqrMagnitudeLong = (inCenterPosWorld - zero).sqrMagnitudeLong;
                        if (sqrMagnitudeLong < num2)
                        {
                            if (ar == null)
                            {
                                flag   = true;
                                num2   = sqrMagnitudeLong;
                                result = list2.get_Item(j);
                            }
                            else
                            {
                                VInt3 target = new VInt3(zero.x, 0, zero.y);
                                if (PathfindingUtility.IsValidTarget(ar, target))
                                {
                                    flag   = true;
                                    num2   = sqrMagnitudeLong;
                                    result = list2.get_Item(j);
                                }
                            }
                        }
                    }
                }
            }
            return(flag);
        }
示例#6
0
        public Vector3 GetRandomPointNearGivenPoint(Vector3 aimPos, int range)
        {
            int     num    = UnityEngine.Random.Range(0, range * 2) - range; //(int)FrameRandom.Random((uint)(range * 2)) - range;
            int     num2   = UnityEngine.Random.Range(0, range * 2) - range; //(int)FrameRandom.Random((uint)(range * 2)) - range;
            Vector3 vector = new Vector3(aimPos.x + (float)num * 0.001f, aimPos.y, aimPos.z + (float)num2 * 0.001f);

            if (PathfindingUtility.IsValidTarget(m_wrapper.actor, new VecInt3(vector)))
            {
                return(vector);
            }
            return(aimPos);
        }
示例#7
0
        public override void Process(Action _action, Track _track, int _localTime)
        {
            base.Process(_action, _track, _localTime);
            if (!this.triggerActor || !this.targetActor || (this.moveSpeed == 0 && this.acceleration == 0))
            {
                return;
            }
            if (this.done_)
            {
                return;
            }
            VInt3 location = this.triggerActor.handle.location;
            VInt3 vInt     = this.targetActor.handle.location;
            int   num      = _localTime - this.lastTime_;

            this.lastTime_ = _localTime;
            VInt3 vInt2 = vInt - location;
            long  num2  = (long)this.curSpeed * (long)num + (long)this.acceleration * (long)num * (long)num / 2L / 1000L;

            this.curSpeed     = Mathf.Min(this.curSpeed + this.acceleration * num / 1000, this.maxMoveSpeed);
            this.curLerpSpeed = this.curSpeed;
            num2 /= 1000L;
            if (num2 >= (long)(vInt2.magnitude - this.lastDistance))
            {
                num2       = (long)Mathf.Max(vInt2.magnitude - this.lastDistance, 0);
                this.done_ = true;
                vInt       = location + vInt2.NormalizeTo((int)num2);
                if (!PathfindingUtility.IsValidTarget(this.triggerActor.handle, vInt))
                {
                    bool  flag  = false;
                    VInt3 vInt3 = PathfindingUtility.FindValidTarget(this.triggerActor.handle, vInt, this.triggerActor.handle.location, 10000, out flag);
                    VInt  vInt4 = 0;
                    PathfindingUtility.GetGroundY(vInt3, out vInt4);
                    vInt3.y = vInt4.i;
                    vInt    = vInt3;
                    vInt2   = vInt - this.triggerActor.handle.location;
                    num2    = (long)vInt2.magnitude;
                }
            }
            this.dir = vInt2;
            if (vInt2 != VInt3.zero)
            {
                this.triggerActor.handle.MovementComponent.SetRotate(this.dir, true);
                this.triggerActor.handle.rotation = Quaternion.LookRotation((Vector3)vInt2);
            }
            this.triggerActor.handle.location += vInt2.NormalizeTo((int)num2);
        }
 public override void Leave(Action _action, Track _track)
 {
     base.Leave(_action, _track);
     if (!this.triggerActor || !this.targetActor || this.moveSpeed == 0)
     {
         return;
     }
     this.done_ = true;
     this.triggerActor.get_handle().ActorControl.RmvNoAbilityFlag(ObjAbilityType.ObjAbility_Move);
     this.triggerActor.get_handle().ObjLinker.RmvCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp));
     if (!PathfindingUtility.IsValidTarget(this.triggerActor.get_handle(), this.triggerActor.get_handle().location))
     {
         bool  flag  = false;
         VInt3 vInt  = PathfindingUtility.FindValidTarget(this.triggerActor.get_handle(), this.targetActor.get_handle().location, this.triggerActor.get_handle().location, 10000, out flag);
         VInt  vInt2 = 0;
         PathfindingUtility.GetGroundY(vInt, out vInt2);
         vInt.y = vInt2.i;
         this.triggerActor.get_handle().location = vInt;
     }
 }
示例#9
0
        public void Teleport()
        {
            VInt  groundY = this.actor_.handle.groundY;
            VInt3 delta   = this.dir.NormalizeTo(this.moveDistance);
            VInt3 target  = this.actor_.handle.location + delta;

            if (PathfindingUtility.IsValidTarget((ActorRoot)this.actor_, target))
            {
                PathfindingUtility.GetGroundY(target, out groundY);
                target.y = groundY.i;
                this.actor_.handle.location = target;
            }
            else
            {
                delta = PathfindingUtility.Move(this.actor_.handle, delta, out groundY, out this.actor_.handle.hasReachedNavEdge);
                ActorRoot handle = this.actor_.handle;
                handle.location += delta;
            }
            this.actor_.handle.groundY = groundY;
            this.done_ = true;
        }
        private void SpawnMonster(Action _action, ref PoolObjHandle <ActorRoot> tarActor)
        {
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");

            if (refParamObject == null || !refParamObject.Originator || refParamObject.Originator.handle.ActorControl == null)
            {
                DebugHelper.Assert(false, "Failed find orignal actor of this skill. action:{0}", new object[]
                {
                    _action.name
                });
                return;
            }
            if (refParamObject.Originator.handle.ActorControl.IsDeadState)
            {
                return;
            }
            DebugHelper.Assert(refParamObject.Originator.handle.ValueComponent != null, "ValueComponent is null");
            ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey((long)this.ConfigID);

            DebugHelper.Assert(dataByKey != null, "Failed find call monster config id:{0} action:{1}", new object[]
            {
                this.ConfigID,
                _action.name
            });
            if (dataByKey == null)
            {
                return;
            }
            int num = Math.Min(CallMonsterTick.MaxLevel, this.SelectLevel(ref refParamObject.Originator, ref dataByKey, ref refParamObject));
            ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, num);

            DebugHelper.Assert(dataCfgInfo != null, "Failed find monster id={0} diff={1} action:{2}", new object[]
            {
                dataByKey.dwMonsterID,
                num,
                _action.name
            });
            if (dataCfgInfo == null)
            {
                return;
            }
            string     fullPathInResources = StringHelper.UTF8BytesToString(ref dataCfgInfo.szCharacterInfo) + ".asset";
            CActorInfo exists = Singleton <CResourceManager> .GetInstance().GetResource(fullPathInResources, typeof(CActorInfo), enResourceType.BattleScene, false, false).m_content as CActorInfo;

            if (exists)
            {
                ActorMeta actorMeta  = default(ActorMeta);
                ActorMeta actorMeta2 = actorMeta;
                actorMeta2.ConfigId  = (int)dataByKey.dwMonsterID;
                actorMeta2.ActorType = ActorTypeDef.Actor_Type_Monster;
                actorMeta2.ActorCamp = this.SelectCamp(ref refParamObject.Originator);
                actorMeta2.EnCId     = (int)dataByKey.dwMonsterID;
                actorMeta2.Difficuty = (byte)num;
                actorMeta2.SkinID    = refParamObject.Originator.handle.TheActorMeta.SkinID;
                actorMeta            = actorMeta2;
                VInt3 location = tarActor.handle.location;
                VInt3 forward  = tarActor.handle.forward;
                if (!PathfindingUtility.IsValidTarget(refParamObject.Originator.handle, location))
                {
                    location = refParamObject.Originator.handle.location;
                    forward  = refParamObject.Originator.handle.forward;
                }
                PoolObjHandle <ActorRoot> poolObjHandle = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, location, forward, false, true);

                if (poolObjHandle)
                {
                    poolObjHandle.handle.InitActor();
                    this.ApplyMonsterAdditive(ref refParamObject.Originator, ref poolObjHandle, ref dataByKey);
                    MonsterWrapper monsterWrapper = poolObjHandle.handle.ActorControl as MonsterWrapper;
                    if (monsterWrapper != null)
                    {
                        monsterWrapper.SetHostActorInfo(ref refParamObject.Originator, refParamObject.SlotType, this.bCopyedHeroInfo, this.bSuicideWhenHostDead, this.bDrageToHostWhenTooFarAway, this.bUseHostValueProperty);
                        if (this.wayPoint != null)
                        {
                            monsterWrapper.AttackAlongRoute(this.wayPoint.GetComponent <WaypointsHolder>());
                        }
                        if (this.LifeTime > 0)
                        {
                            monsterWrapper.LifeTime = this.LifeTime;
                        }
                    }
                    if (this.bUseHostValueProperty)
                    {
                        refParamObject.Originator.handle.ValueComponent.mActorValue.SetChangeEvent(RES_FUNCEFT_TYPE.RES_FUNCEFT_MOVESPD, new ValueChangeDelegate(poolObjHandle.handle.ActorControl.OnMoveSpdChange));
                    }
                    refParamObject.Originator.handle.SkillControl.SetSkillIndicatorToCallMonster();
                    poolObjHandle.handle.PrepareFight();
                    Singleton <GameObjMgr> .instance.AddActor(poolObjHandle);

                    poolObjHandle.handle.StartFight();
                    poolObjHandle.handle.ObjLinker.Invincible = this.Invincible;
                    poolObjHandle.handle.ObjLinker.CanMovable = this.Moveable;
                    poolObjHandle.handle.Visible = (!this.bInitialVisibility || refParamObject.Originator.handle.Visible);
                    poolObjHandle.handle.ValueComponent.actorSoulLevel = refParamObject.Originator.handle.ValueComponent.actorSoulLevel;
                    poolObjHandle.handle.DefaultAttackModeControl      = poolObjHandle.handle.CreateLogicComponent <DefaultAttackMode>(poolObjHandle.handle);
                    if (FogOfWar.enable && poolObjHandle.handle.HorizonMarker != null)
                    {
                        poolObjHandle.handle.HorizonMarker.SightRadius = Horizon.QuerySoldierSightRadius();
                    }
                    refParamObject.Originator.handle.ValueComponent.AddSoulExp(0, false, AddSoulType.Other);
                }
            }
        }
示例#11
0
        public override void Enter(Action _action, Track _track)
        {
            this.done_     = false;
            this.lastTime_ = 0;
            base.Enter(_action, _track);
            this.actor_ = _action.GetActorHandle(this.actorId);
            if (!this.actor_ || (!this.teleport && this.moveSpeed == 0 && this.acceleration == 0))
            {
                return;
            }
            this.srcPos = this.actor_.get_handle().location;
            if (this.bForbidMoveFollowing)
            {
                this.actor_.get_handle().ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_MoveProtect);
            }
            if (this.bUseRecordPosition && this.actor_.get_handle().SkillControl != null)
            {
                this.destPos = this.actor_.get_handle().SkillControl.RecordPosition;
                this.dir     = this.destPos - this.srcPos;
                int magnitude2D = (this.destPos - this.srcPos).get_magnitude2D();
                this.moveDistance += magnitude2D;
            }
            else if (this.moveType == ActorMoveType.Target)
            {
                PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.destId);
                if (!this.actor_ || !actorHandle)
                {
                    this.actor_.Release();
                    return;
                }
                int num;
                if (actorHandle.get_handle().ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_MoveProtect) && actorHandle.get_handle().TheActorMeta.ActorCamp != this.actor_.get_handle().TheActorMeta.ActorCamp)
                {
                    num = 0;
                }
                else
                {
                    this.dir = actorHandle.get_handle().location - this.srcPos;
                    num      = (actorHandle.get_handle().location - this.srcPos).get_magnitude2D();
                }
                this.moveDistance += num;
            }
            else if (this.moveType == ActorMoveType.Position)
            {
                this.dir = this.destPos - this.srcPos;
                int magnitude2D2 = (this.destPos - this.srcPos).get_magnitude2D();
                if (magnitude2D2 < this.minMoveDistance)
                {
                    magnitude2D2 = this.minMoveDistance;
                }
                this.moveDistance += magnitude2D2;
            }
            else if (this.moveType == ActorMoveType.Directional)
            {
                this.dir = this.actor_.get_handle().forward;
            }
            this.dir.y = 0;
            this.actor_.get_handle().ActorControl.TerminateMove();
            if (this.bRecordPosition && this.actor_.get_handle().SkillControl != null)
            {
                this.actor_.get_handle().SkillControl.RecordPosition = this.actor_.get_handle().location;
            }
            if (!this.actor_.get_handle().isMovable || this.dir.get_sqrMagnitudeLong() <= 1L)
            {
                this.actor_.Release();
                this.done_ = true;
                return;
            }
            VInt3 vInt = this.dir;

            if (!this.bUseRecordPosition)
            {
                this.finalPos = this.srcPos + vInt.NormalizeTo(this.moveDistance);
            }
            else
            {
                this.finalPos = this.actor_.get_handle().SkillControl.RecordPosition;
                if (this.teleport)
                {
                    this.actor_.get_handle().ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_MoveProtect);
                }
            }
            if (!PathfindingUtility.IsValidTarget(this.actor_, this.finalPos))
            {
                bool flag = false;
                if (this.moveType == ActorMoveType.Directional)
                {
                    this.IgnoreCollision = false;
                }
                else
                {
                    VInt3 pos = PathfindingUtility.FindValidTarget(this.actor_, this.finalPos, this.actor_.get_handle().location, 10000, out flag);
                    if (!flag)
                    {
                        this.IgnoreCollision = false;
                    }
                    else
                    {
                        VInt vInt2 = 0;
                        PathfindingUtility.GetGroundY(pos, out vInt2);
                        pos.y             = vInt2.i;
                        this.finalPos     = pos;
                        this.moveDistance = (this.finalPos - this.actor_.get_handle().location).get_magnitude2D();
                    }
                }
            }
            if (!this.shouldUseAcceleration)
            {
                this.moveTick = this.moveDistance * 1000 / this.moveSpeed;
            }
            else
            {
                long num2 = (long)this.moveDistance;
                long num3 = (long)this.acceleration;
                long num4 = (long)this.moveSpeed;
                this.moveTick          = (int)IntMath.Divide(((long)IntMath.Sqrt(num4 * num4 + 2L * num3 * num2) - num4) * 1000L, num3);
                this.lastMoveSpeed     = this.moveSpeed;
                this.lastLerpMoveSpeed = this.moveSpeed;
            }
            this.actor_.get_handle().ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_Move);
            this.actor_.get_handle().ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp));
            this.fromRot = this.actor_.get_handle().rotation;
            this.actor_.get_handle().MovementComponent.SetRotate(this.dir, true);
            if (this.rotationTime > 0)
            {
                this.toRot = Quaternion.LookRotation((Vector3)this.actor_.get_handle().forward);
            }
            else
            {
                this.actor_.get_handle().rotation = Quaternion.LookRotation((Vector3)this.actor_.get_handle().forward);
            }
        }
示例#12
0
        private void SpawnMonster(Action _action, ref PoolObjHandle <ActorRoot> tarActor)
        {
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");

            if (((refParamObject == null) || (refParamObject.Originator == 0)) || (refParamObject.Originator.handle.ActorControl == null))
            {
                object[] inParameters = new object[] { _action.name };
                DebugHelper.Assert(false, "Failed find orignal actor of this skill. action:{0}", inParameters);
            }
            else if (!refParamObject.Originator.handle.ActorControl.IsDeadState)
            {
                DebugHelper.Assert(refParamObject.Originator.handle.ValueComponent != null, "ValueComponent is null");
                ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey(this.ConfigID);
                object[]       objArray2 = new object[] { this.ConfigID, _action.name };
                DebugHelper.Assert(dataByKey != null, "Failed find call monster config id:{0} action:{1}", objArray2);
                if (dataByKey != null)
                {
                    int diffLevel = Math.Min(MaxLevel, this.SelectLevel(ref refParamObject.Originator, ref dataByKey, ref refParamObject));
                    ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, diffLevel);
                    object[]          objArray3   = new object[] { dataByKey.dwMonsterID, diffLevel, _action.name };
                    DebugHelper.Assert(dataCfgInfo != null, "Failed find monster id={0} diff={1} action:{2}", objArray3);
                    if (dataCfgInfo != null)
                    {
                        string     fullPathInResources = StringHelper.UTF8BytesToString(ref dataCfgInfo.szCharacterInfo) + ".asset";
                        CActorInfo content             = Singleton <CResourceManager> .GetInstance().GetResource(fullPathInResources, typeof(CActorInfo), enResourceType.BattleScene, false, false).m_content as CActorInfo;

                        if (content != null)
                        {
                            ActorMeta actorMeta = new ActorMeta {
                                ConfigId  = (int)dataByKey.dwMonsterID,
                                ActorType = ActorTypeDef.Actor_Type_Monster,
                                ActorCamp = this.SelectCamp(ref refParamObject.Originator),
                                EnCId     = (CrypticInt32)dataByKey.dwMonsterID,
                                Difficuty = (byte)diffLevel,
                                SkinID    = refParamObject.Originator.handle.TheActorMeta.SkinID
                            };
                            VInt3 location = tarActor.handle.location;
                            VInt3 forward  = tarActor.handle.forward;
                            if (!PathfindingUtility.IsValidTarget(refParamObject.Originator.handle, location))
                            {
                                location = refParamObject.Originator.handle.location;
                                forward  = refParamObject.Originator.handle.forward;
                            }
                            PoolObjHandle <ActorRoot> monster = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, location, forward, false, true);

                            if (monster != 0)
                            {
                                monster.handle.InitActor();
                                this.ApplyMonsterAdditive(ref refParamObject.Originator, ref monster, ref dataByKey);
                                MonsterWrapper actorControl = monster.handle.ActorControl as MonsterWrapper;
                                if (actorControl != null)
                                {
                                    actorControl.SetHostActorInfo(ref refParamObject.Originator, refParamObject.SlotType, this.bCopyedHeroInfo);
                                    if (this.wayPoint != null)
                                    {
                                        actorControl.AttackAlongRoute(this.wayPoint.GetComponent <WaypointsHolder>());
                                    }
                                    if (this.LifeTime > 0)
                                    {
                                        actorControl.LifeTime = this.LifeTime;
                                    }
                                }
                                monster.handle.PrepareFight();
                                Singleton <GameObjMgr> .instance.AddActor(monster);

                                monster.handle.StartFight();
                                monster.handle.ObjLinker.Invincible = this.Invincible;
                                monster.handle.ObjLinker.CanMovable = this.Moveable;
                                monster.handle.Visible = refParamObject.Originator.handle.Visible;
                                monster.handle.ValueComponent.actorSoulLevel = refParamObject.Originator.handle.ValueComponent.actorSoulLevel;
                                refParamObject.Originator.handle.ValueComponent.AddSoulExp(0, false, AddSoulType.Other);
                            }
                        }
                    }
                }
            }
        }
示例#13
0
        private void SpawnMonster(Action _action, ref PoolObjHandle <ActorRoot> tarActor)
        {
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");

            if (refParamObject == null || !refParamObject.Originator || refParamObject.Originator.get_handle().ActorControl == null)
            {
                DebugHelper.Assert(false, "Failed find orignal actor of this skill. action:{0}", new object[]
                {
                    _action.name
                });
                return;
            }
            if (refParamObject.Originator.get_handle().ActorControl.IsDeadState)
            {
                return;
            }
            DebugHelper.Assert(refParamObject.Originator.get_handle().ValueComponent != null, "ValueComponent is null");
            ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey((long)this.ConfigID);

            DebugHelper.Assert(dataByKey != null, "Failed find call monster config id:{0} action:{1}", new object[]
            {
                this.ConfigID,
                _action.name
            });
            if (dataByKey == null)
            {
                return;
            }
            int num = Math.Min(CallMonsterTick.MaxLevel, this.SelectLevel(ref refParamObject.Originator, ref dataByKey, ref refParamObject));
            ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, num);

            DebugHelper.Assert(dataCfgInfo != null, "Failed find monster id={0} diff={1} action:{2}", new object[]
            {
                dataByKey.dwMonsterID,
                num,
                _action.name
            });
            if (dataCfgInfo == null)
            {
                return;
            }
            string     text   = StringHelper.UTF8BytesToString(ref dataCfgInfo.szCharacterInfo) + ".asset";
            CActorInfo exists = Singleton <CResourceManager> .GetInstance().GetResource(text, typeof(CActorInfo), 0, false, false).m_content as CActorInfo;

            if (exists)
            {
                ActorMeta actorMeta  = default(ActorMeta);
                ActorMeta actorMeta2 = actorMeta;
                actorMeta2.ConfigId  = (int)dataByKey.dwMonsterID;
                actorMeta2.ActorType = ActorTypeDef.Actor_Type_Monster;
                actorMeta2.ActorCamp = this.SelectCamp(ref refParamObject.Originator);
                actorMeta2.EnCId     = (int)dataByKey.dwMonsterID;
                actorMeta2.Difficuty = (byte)num;
                actorMeta2.SkinID    = refParamObject.Originator.get_handle().TheActorMeta.SkinID;
                actorMeta            = actorMeta2;
                VInt3 location = tarActor.get_handle().location;
                VInt3 forward  = tarActor.get_handle().forward;
                if (!PathfindingUtility.IsValidTarget(refParamObject.Originator.get_handle(), location))
                {
                    location = refParamObject.Originator.get_handle().location;
                    forward  = refParamObject.Originator.get_handle().forward;
                }
                PoolObjHandle <ActorRoot> poolObjHandle = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, location, forward, false, true);

                if (poolObjHandle)
                {
                    poolObjHandle.get_handle().InitActor();
                    this.ApplyMonsterAdditive(ref refParamObject.Originator, ref poolObjHandle, ref dataByKey);
                    MonsterWrapper monsterWrapper = poolObjHandle.get_handle().ActorControl as MonsterWrapper;
                    if (monsterWrapper != null)
                    {
                        monsterWrapper.SetHostActorInfo(ref refParamObject.Originator, refParamObject.SlotType, this.bCopyedHeroInfo);
                        if (this.wayPoint != null)
                        {
                            monsterWrapper.AttackAlongRoute(this.wayPoint.GetComponent <WaypointsHolder>());
                        }
                        if (this.LifeTime > 0)
                        {
                            monsterWrapper.LifeTime = this.LifeTime;
                        }
                    }
                    poolObjHandle.get_handle().PrepareFight();
                    Singleton <GameObjMgr> .get_instance().AddActor(poolObjHandle);

                    poolObjHandle.get_handle().StartFight();
                    poolObjHandle.get_handle().ObjLinker.Invincible = this.Invincible;
                    poolObjHandle.get_handle().ObjLinker.CanMovable = this.Moveable;
                    poolObjHandle.get_handle().Visible = refParamObject.Originator.get_handle().Visible;
                    poolObjHandle.get_handle().ValueComponent.actorSoulLevel = refParamObject.Originator.get_handle().ValueComponent.actorSoulLevel;
                    refParamObject.Originator.get_handle().ValueComponent.AddSoulExp(0, false, AddSoulType.Other);
                }
            }
        }
示例#14
0
 public void LateUpdate(int nDelta)
 {
     if (this.skillSlot == null || this.skillSlot.SkillObj == null || this.skillSlot.SkillObj.cfgData == null)
     {
         return;
     }
     if (this.effectHideFrameNum > 0 && Time.frameCount > this.effectHideFrameNum)
     {
         this.ForceSetGuildPrefabShow(false);
         this.effectHideFrameNum = 0;
     }
     this.pressTime += nDelta;
     if (this.effectPrefab != null)
     {
         if (this.bMoveFlag)
         {
             Vector3 b = this.deltaDirection * this.moveSpeed * (float)nDelta;
             this.deltaPosition += b;
             if (this.deltaPosition.sqrMagnitude >= this.movePosition.sqrMagnitude)
             {
                 this.bMoveFlag        = false;
                 this.useSkillPosition = this.skillSlot.Actor.handle.myTransform.position + this.useOffsetPosition;
                 this.effectPrefab.transform.position = this.useSkillPosition;
             }
             else
             {
                 this.useSkillPosition  = this.effectPrefab.transform.position + b;
                 this.useSkillPosition += this.skillSlot.Actor.handle.myTransform.position - this.rootRosition;
                 this.effectPrefab.transform.position = this.useSkillPosition;
                 this.rootRosition = this.skillSlot.Actor.handle.myTransform.position;
             }
         }
         else
         {
             this.useSkillPosition += this.skillSlot.Actor.handle.myTransform.position - this.rootRosition;
             this.effectPrefab.transform.position = this.useSkillPosition;
             this.rootRosition = this.skillSlot.Actor.handle.myTransform.position;
         }
         if (this.bRotateFlag)
         {
             float num = this.rotateSpeed * (float)nDelta;
             this.deltaAngle += num;
             if (this.deltaAngle >= this.rotateAngle)
             {
                 this.bRotateFlag       = false;
                 this.useSkillDirection = this.rotateDirection;
                 this.effectPrefab.transform.forward = this.useSkillDirection;
             }
             else
             {
                 Vector3 point = this.effectPrefab.transform.forward;
                 if (Vector3.Cross(this.useSkillDirection, this.rotateDirection).y < 0f)
                 {
                     point = Quaternion.Euler(0f, -num, 0f) * point;
                 }
                 else
                 {
                     point = Quaternion.Euler(0f, num, 0f) * point;
                 }
                 this.useSkillDirection = point;
                 this.effectPrefab.transform.forward = this.useSkillDirection;
             }
         }
         VInt ob = 0;
         if (PathfindingUtility.GetGroundY((VInt3)this.effectPrefab.transform.position, out ob))
         {
             Vector3 position = this.effectPrefab.transform.position;
             position.y = (float)ob + 0.3f;
             this.effectPrefab.transform.position = position;
         }
     }
     if (this.effectWarnPrefab != null && this.effectPrefab != null)
     {
         this.effectWarnPrefab.transform.position = this.effectPrefab.transform.position;
         this.effectWarnPrefab.transform.forward  = this.effectPrefab.transform.forward;
     }
     this.SetUseSkillTarget();
     if (this.bSelectEffectPrefab && this.IsPrefabVisible(this.effectPrefab) && FogOfWar.enable)
     {
         VInt3 vInt = (VInt3)this.effectPrefab.transform.position;
         if (!PathfindingUtility.IsValidTarget(this.skillSlot.Actor.handle, vInt))
         {
             this.PrefabSelecter = SkillControlIndicator.EEffectPrefabSelect.Block;
         }
         else if (Singleton <GameFowManager> .instance.QueryAttr(vInt) == FieldObj.EViewBlockType.Grass)
         {
             this.PrefabSelecter = SkillControlIndicator.EEffectPrefabSelect.Grass;
         }
         else if (SkillControlIndicator.CheckGrassAttaching(ref vInt))
         {
             this.PrefabSelecter = SkillControlIndicator.EEffectPrefabSelect.Grass;
         }
         else
         {
             this.PrefabSelecter = SkillControlIndicator.EEffectPrefabSelect.Normal;
         }
     }
 }
示例#15
0
 public override void Enter(Action _action, Track _track)
 {
     this.done_     = false;
     this.lastTime_ = 0;
     base.Enter(_action, _track);
     this.actor_ = _action.GetActorHandle(this.actorId);
     if ((this.actor_ != 0) && (this.teleport || (this.moveSpeed != 0)))
     {
         this.srcPos = this.actor_.handle.location;
         if (this.bUseRecordPosition && (this.actor_.handle.SkillControl != null))
         {
             this.destPos = this.actor_.handle.SkillControl.RecordPosition;
             this.dir     = this.destPos - this.srcPos;
             VInt3 num5      = this.destPos - this.srcPos;
             int   magnitude = num5.magnitude;
             this.moveDistance += magnitude;
         }
         else if (this.moveType == ActorMoveType.Target)
         {
             int num3;
             PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.destId);
             if ((this.actor_ == 0) || (actorHandle == 0))
             {
                 this.actor_.Release();
                 return;
             }
             if (actorHandle.handle.ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_MoveCity))
             {
                 num3 = 0;
             }
             else
             {
                 this.dir = actorHandle.handle.location - this.srcPos;
                 VInt3 num6 = actorHandle.handle.location - this.srcPos;
                 num3 = num6.magnitude;
             }
             this.moveDistance += num3;
         }
         else if (this.moveType == ActorMoveType.Position)
         {
             this.dir = this.destPos - this.srcPos;
             VInt3 num7            = this.destPos - this.srcPos;
             int   minMoveDistance = num7.magnitude;
             if (minMoveDistance < this.minMoveDistance)
             {
                 minMoveDistance = this.minMoveDistance;
             }
             this.moveDistance += minMoveDistance;
         }
         else if (this.moveType == ActorMoveType.Directional)
         {
             this.dir = this.actor_.handle.forward;
         }
         this.dir.y = 0;
         this.actor_.handle.ActorControl.TerminateMove();
         if (this.bRecordPosition && (this.actor_.handle.SkillControl != null))
         {
             this.actor_.handle.SkillControl.RecordPosition = this.actor_.handle.location;
         }
         if (!this.actor_.handle.isMovable || (this.dir.sqrMagnitudeLong <= 1L))
         {
             this.actor_.Release();
             this.done_ = true;
         }
         else
         {
             VInt3 dir = this.dir;
             this.finalPos = this.srcPos + dir.NormalizeTo(this.moveDistance);
             if (!PathfindingUtility.IsValidTarget((ActorRoot)this.actor_, this.finalPos))
             {
                 this.IgnoreCollision = false;
             }
             this.moveTick = (this.moveDistance * 0x3e8) / this.moveSpeed;
             this.actor_.handle.ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_Move);
             this.actor_.handle.ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp));
             this.fromRot = this.actor_.handle.rotation;
             this.actor_.handle.MovementComponent.SetRotate(this.dir, true);
             if (this.rotationTime > 0)
             {
                 this.toRot = Quaternion.LookRotation((Vector3)this.actor_.handle.forward);
             }
             else
             {
                 this.actor_.handle.rotation = Quaternion.LookRotation((Vector3)this.actor_.handle.forward);
             }
         }
     }
 }
示例#16
0
        private void EnterSpawnEye(AGE.Action _action, Track _track)
        {
            string prefabName;

            if (this.bUseSkin)
            {
                prefabName = SkinResourceHelper.GetResourceName(_action, this.prefabName, this.bUseSkinAdvance);
            }
            else
            {
                prefabName = this.prefabName;
            }
            VInt3                     zero           = VInt3.zero;
            VInt3                     forward        = VInt3.forward;
            SkillUseContext           refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            COM_PLAYERCAMP            com_playercamp = ((refParamObject == null) || (refParamObject.Originator == 0)) ? COM_PLAYERCAMP.COM_PLAYERCAMP_MID : refParamObject.Originator.handle.TheActorMeta.ActorCamp;
            GameObject                gameObject     = _action.GetGameObject(this.parentId);
            PoolObjHandle <ActorRoot> actorHandle    = _action.GetActorHandle(this.parentId);
            PoolObjHandle <ActorRoot> handle2        = _action.GetActorHandle(this.objectSpaceId);

            if (handle2 != 0)
            {
                ActorRoot handle = handle2.handle;
                if (this.superTranslation)
                {
                    VInt3 num3 = VInt3.zero;
                    _action.refParams.GetRefParam("_BulletPos", ref num3);
                    zero = IntMath.Transform(num3, handle.forward, handle.location);
                }
                else if (this.modifyTranslation)
                {
                    zero = IntMath.Transform(this.translation, handle.forward, handle.location);
                }
                if (this.modifyDirection)
                {
                    forward = handle2.handle.forward;
                }
            }
            else if (this.bTargetPosition)
            {
                zero = this.translation + this.targetPosition;
                if ((this.modifyDirection && (refParamObject != null)) && (refParamObject.Originator != 0))
                {
                    forward = refParamObject.Originator.handle.forward;
                }
            }
            else
            {
                if (this.modifyTranslation)
                {
                    zero = this.translation;
                }
                if ((this.modifyDirection && (this.direction.x != 0)) && (this.direction.y != 0))
                {
                    forward = this.direction;
                    forward.NormalizeTo(0x3e8);
                }
            }
            if (this.targetId >= 0)
            {
                _action.ExpandGameObject(this.targetId);
                GameObject obj3 = _action.GetGameObject(this.targetId);
                if (this.recreateExisting && (obj3 != null))
                {
                    if (this.applyActionSpeedToAnimation)
                    {
                        _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Anim, obj3);
                    }
                    if (this.applyActionSpeedToParticle)
                    {
                        _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, obj3);
                    }
                    ActorHelper.DetachActorRoot(obj3);
                    ActionManager.DestroyGameObject(obj3);
                    _action.SetGameObject(this.targetId, null);
                }
                GameObject obj4 = null;
                if (obj3 == null)
                {
                    ActorStaticData        actorData         = new ActorStaticData();
                    IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

                    ActorMeta actorMeta = new ActorMeta {
                        ActorType = ActorTypeDef.Actor_Type_EYE,
                        ActorCamp = com_playercamp,
                        ConfigId  = this.EyeCfgIdByMonster,
                        EnCId     = this.EyeCfgIdByMonster
                    };
                    actorDataProvider.GetActorStaticData(ref actorMeta, ref actorData);
                    CActorInfo info = null;
                    if (!string.IsNullOrEmpty(actorData.TheResInfo.ResPath))
                    {
                        CActorInfo actorInfo = CActorInfo.GetActorInfo(actorData.TheResInfo.ResPath, enResourceType.BattleScene);
                        if (actorInfo != null)
                        {
                            info = (CActorInfo)UnityEngine.Object.Instantiate(actorInfo);
                        }
                    }
                    PoolObjHandle <ActorRoot> handle3 = new PoolObjHandle <ActorRoot>();
                    if (info != null)
                    {
                        if ((refParamObject.Originator != 0) && !PathfindingUtility.IsValidTarget(refParamObject.Originator.handle, zero))
                        {
                            zero = refParamObject.Originator.handle.location;
                        }
                        handle3 = Singleton <GameObjMgr> .instance.SpawnActorEx(null, ref actorMeta, zero, forward, false, true);

                        if (handle3 != 0)
                        {
                            this.actorRoot = handle3;
                            obj4           = handle3.handle.gameObject;
                            handle3.handle.InitActor();
                            this.CreateEye();
                            handle3.handle.PrepareFight();
                            handle3.handle.StartFight();
                        }
                    }
                    if (handle3 != 0)
                    {
                        if (obj4 == null)
                        {
                            throw new Exception("Age:SpawnObjectDuration Spawn Exception");
                        }
                        obj4.transform.localScale = Vector3.one;
                        if (GameSettings.DynamicParticleLOD)
                        {
                            bool flag        = true;
                            int  particleLOD = GameSettings.ParticleLOD;
                            if (((refParamObject != null) && (refParamObject.Originator != 0)) && (refParamObject.Originator.handle.TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId))
                            {
                                flag = false;
                            }
                            if (!flag && (particleLOD > 1))
                            {
                                GameSettings.ParticleLOD = 1;
                            }
                            MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag;
                        }
                        this.actorRoot.handle.location = zero;
                        this.actorRoot.handle.forward  = forward;
                        if (this.actorRoot.handle.shape != null)
                        {
                            this.actorRoot.handle.shape.ConditionalUpdateShape();
                        }
                        if (this.actorRoot.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE)
                        {
                            this.actorRoot.handle.TheActorMeta.ConfigId = this.EyeCfgIdByMonster;
                        }
                        if (refParamObject != null)
                        {
                            refParamObject.EffectPos = this.actorRoot.handle.location;
                            if (this.actorRoot.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE)
                            {
                                DebugHelper.Assert(this.actorRoot.handle.TheActorMeta.ActorCamp == com_playercamp);
                                this.actorRoot.handle.TheActorMeta.ActorCamp = com_playercamp;
                            }
                        }
                    }
                }
            }
        }
        private void EnterSpawnEye(Action _action, Track _track)
        {
            if (this.bUseSkin)
            {
                string resourceName = SkinResourceHelper.GetResourceName(_action, this.prefabName, this.bUseSkinAdvance);
            }
            else
            {
                string resourceName = this.prefabName;
            }
            VInt3                     vInt           = VInt3.zero;
            VInt3                     forward        = VInt3.forward;
            SkillUseContext           refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            COM_PLAYERCAMP            cOM_PLAYERCAMP = (refParamObject == null || !refParamObject.Originator) ? 0 : refParamObject.Originator.get_handle().TheActorMeta.ActorCamp;
            GameObject                gameObject     = _action.GetGameObject(this.parentId);
            PoolObjHandle <ActorRoot> actorHandle    = _action.GetActorHandle(this.parentId);
            PoolObjHandle <ActorRoot> actorHandle2   = _action.GetActorHandle(this.objectSpaceId);

            if (actorHandle2)
            {
                ActorRoot handle = actorHandle2.get_handle();
                if (this.superTranslation)
                {
                    VInt3 zero = VInt3.zero;
                    _action.refParams.GetRefParam("_BulletPos", ref zero);
                    vInt = IntMath.Transform(zero, handle.forward, handle.location);
                }
                else if (this.modifyTranslation)
                {
                    vInt = IntMath.Transform(this.translation, handle.forward, handle.location);
                }
                if (this.modifyDirection)
                {
                    forward = actorHandle2.get_handle().forward;
                }
            }
            else if (this.bTargetPosition)
            {
                vInt = this.translation + this.targetPosition;
                if (this.modifyDirection && refParamObject != null && refParamObject.Originator)
                {
                    forward = refParamObject.Originator.get_handle().forward;
                }
            }
            else
            {
                if (this.modifyTranslation)
                {
                    vInt = this.translation;
                }
                if (this.modifyDirection && this.direction.x != 0 && this.direction.y != 0)
                {
                    forward = this.direction;
                    forward.NormalizeTo(1000);
                }
            }
            if (this.targetId >= 0)
            {
                _action.ExpandGameObject(this.targetId);
                GameObject gameObject2 = _action.GetGameObject(this.targetId);
                if (this.recreateExisting && gameObject2 != null)
                {
                    if (this.applyActionSpeedToAnimation)
                    {
                        _action.RemoveTempObject(Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject2);
                    }
                    if (this.applyActionSpeedToParticle)
                    {
                        _action.RemoveTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject2);
                    }
                    ActorHelper.DetachActorRoot(gameObject2);
                    ActionManager.DestroyGameObject(gameObject2);
                    _action.SetGameObject(this.targetId, null);
                }
                GameObject gameObject3 = null;
                if (!(gameObject2 == null))
                {
                    return;
                }
                ActorStaticData        actorStaticData   = default(ActorStaticData);
                IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .get_instance().GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

                ActorMeta actorMeta  = default(ActorMeta);
                ActorMeta actorMeta2 = actorMeta;
                actorMeta2.ActorType = ActorTypeDef.Actor_Type_EYE;
                actorMeta2.ActorCamp = cOM_PLAYERCAMP;
                actorMeta2.ConfigId  = this.EyeCfgIdByMonster;
                actorMeta2.EnCId     = this.EyeCfgIdByMonster;
                actorMeta            = actorMeta2;
                actorDataProvider.GetActorStaticData(ref actorMeta, ref actorStaticData);
                CActorInfo exists = null;
                if (!string.IsNullOrEmpty(actorStaticData.TheResInfo.ResPath))
                {
                    CActorInfo actorInfo = CActorInfo.GetActorInfo(actorStaticData.TheResInfo.ResPath, 0);
                    if (actorInfo != null)
                    {
                        exists = (CActorInfo)Object.Instantiate(actorInfo);
                    }
                }
                PoolObjHandle <ActorRoot> poolObjHandle = default(PoolObjHandle <ActorRoot>);
                if (exists)
                {
                    if (refParamObject.Originator && !PathfindingUtility.IsValidTarget(refParamObject.Originator.get_handle(), vInt) && !Singleton <GameFowManager> .get_instance().m_pFieldObj.FindNearestNotBrickFromWorldLocNonFow(ref vInt, refParamObject.Originator.get_handle()))
                    {
                        vInt = refParamObject.Originator.get_handle().location;
                    }
                    poolObjHandle = Singleton <GameObjMgr> .get_instance().SpawnActorEx(null, ref actorMeta, vInt, forward, false, true);

                    if (poolObjHandle)
                    {
                        this.actorRoot = poolObjHandle;
                        gameObject3    = poolObjHandle.get_handle().gameObject;
                        poolObjHandle.get_handle().InitActor();
                        this.CreateEye();
                        poolObjHandle.get_handle().PrepareFight();
                        poolObjHandle.get_handle().StartFight();
                    }
                }
                if (!poolObjHandle)
                {
                    return;
                }
                if (!gameObject3)
                {
                    throw new Exception("Age:SpawnObjectDuration Spawn Exception");
                }
                gameObject3.transform.localScale = Vector3.one;
                if (GameSettings.DynamicParticleLOD)
                {
                    bool flag        = true;
                    int  particleLOD = GameSettings.ParticleLOD;
                    if (refParamObject != null && refParamObject.Originator && refParamObject.Originator.get_handle().TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId)
                    {
                        flag = false;
                    }
                    if (!flag && particleLOD > 1)
                    {
                        GameSettings.ParticleLOD = 1;
                    }
                    MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag;
                }
                this.actorRoot.get_handle().location = vInt;
                this.actorRoot.get_handle().forward  = forward;
                if (this.actorRoot.get_handle().shape != null)
                {
                    this.actorRoot.get_handle().shape.ConditionalUpdateShape();
                }
                if (this.actorRoot.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE)
                {
                    this.actorRoot.get_handle().TheActorMeta.ConfigId = this.EyeCfgIdByMonster;
                }
                if (refParamObject != null)
                {
                    refParamObject.EffectPos = this.actorRoot.get_handle().location;
                    if (this.actorRoot.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE)
                    {
                        DebugHelper.Assert(this.actorRoot.get_handle().TheActorMeta.ActorCamp == cOM_PLAYERCAMP);
                        this.actorRoot.get_handle().TheActorMeta.ActorCamp = cOM_PLAYERCAMP;
                    }
                }
                SpawnEyeEventParam spawnEyeEventParam = new SpawnEyeEventParam(refParamObject.Originator, vInt);
                Singleton <GameSkillEventSys> .GetInstance().SendEvent <SpawnEyeEventParam>(GameSkillEventDef.Event_SpawnEye, refParamObject.Originator, ref spawnEyeEventParam, GameSkillEventChannel.Channel_HostCtrlActor);
            }
        }
        private void EnterSpawnBullet(Action _action, Track _track)
        {
            string resourceName;

            if (this.bUseSkin)
            {
                resourceName = SkinResourceHelper.GetResourceName(_action, this.prefabName, this.bUseSkinAdvance);
            }
            else
            {
                resourceName = this.prefabName;
            }
            VInt3                     vInt           = VInt3.zero;
            VInt3                     forward        = VInt3.forward;
            SkillUseContext           refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            COM_PLAYERCAMP            camp           = (refParamObject == null || !refParamObject.Originator) ? 0 : refParamObject.Originator.get_handle().TheActorMeta.ActorCamp;
            GameObject                gameObject     = _action.GetGameObject(this.parentId);
            PoolObjHandle <ActorRoot> actorHandle    = _action.GetActorHandle(this.parentId);
            PoolObjHandle <ActorRoot> actorHandle2   = _action.GetActorHandle(this.objectSpaceId);

            if (actorHandle2)
            {
                ActorRoot handle = actorHandle2.get_handle();
                if (this.superTranslation)
                {
                    VInt3 zero = VInt3.zero;
                    _action.refParams.GetRefParam("_BulletPos", ref zero);
                    vInt = IntMath.Transform(zero, handle.forward, handle.location);
                }
                else if (this.modifyTranslation)
                {
                    vInt = IntMath.Transform(this.translation, handle.forward, handle.location);
                }
                if (this.modifyDirection)
                {
                    forward = actorHandle2.get_handle().forward;
                }
            }
            else if (this.bTargetPosition)
            {
                vInt = this.translation + this.targetPosition;
                if (this.modifyDirection && refParamObject != null && refParamObject.Originator)
                {
                    forward = refParamObject.Originator.get_handle().forward;
                }
            }
            else
            {
                if (this.modifyTranslation)
                {
                    vInt = this.translation;
                }
                if (this.modifyDirection && this.direction.x != 0 && this.direction.y != 0)
                {
                    forward = this.direction;
                    forward.NormalizeTo(1000);
                }
            }
            if (this.targetId >= 0)
            {
                _action.ExpandGameObject(this.targetId);
                GameObject gameObject2 = _action.GetGameObject(this.targetId);
                if (this.recreateExisting && gameObject2 != null)
                {
                    if (this.applyActionSpeedToAnimation)
                    {
                        _action.RemoveTempObject(Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject2);
                    }
                    if (this.applyActionSpeedToParticle)
                    {
                        _action.RemoveTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject2);
                    }
                    ActorHelper.DetachActorRoot(gameObject2);
                    ActionManager.DestroyGameObject(gameObject2);
                    _action.SetGameObject(this.targetId, null);
                }
                bool flag = true;
                if (!(gameObject2 == null))
                {
                    return;
                }
                if (this.bForbidBulletInObstacle && !PathfindingUtility.IsValidTarget(refParamObject.Originator.get_handle(), vInt))
                {
                    bool  flag2 = false;
                    VInt3 vInt2 = PathfindingUtility.FindValidTarget(refParamObject.Originator.get_handle(), vInt, refParamObject.Originator.get_handle().location, 10000, out flag2);
                    if (flag2)
                    {
                        VInt vInt3 = 0;
                        PathfindingUtility.GetGroundY(vInt2, out vInt3);
                        vInt2.y = vInt3.i;
                        vInt    = vInt2;
                    }
                    else
                    {
                        vInt = refParamObject.Originator.get_handle().location;
                    }
                }
                GameObject gameObject3 = MonoSingleton <SceneMgr> .GetInstance().Spawn("TempObject", SceneObjType.Bullet, vInt, forward);

                if (!gameObject3)
                {
                    throw new Exception("Age:SpawnObjectDuration Spawn Exception");
                }
                gameObject3.transform.localScale = Vector3.one;
                bool flag3       = true;
                int  particleLOD = GameSettings.ParticleLOD;
                if (GameSettings.DynamicParticleLOD)
                {
                    if (refParamObject != null && refParamObject.Originator && refParamObject.Originator.get_handle().TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId)
                    {
                        flag3 = false;
                    }
                    if (!flag3 && particleLOD > 1)
                    {
                        GameSettings.ParticleLOD = 1;
                    }
                    MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag3;
                }
                this.m_particleObj = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(resourceName, true, SceneObjType.ActionRes, gameObject3.transform.position, gameObject3.transform.rotation, out flag);

                if (GameSettings.DynamicParticleLOD)
                {
                    MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false;
                }
                if (this.m_particleObj == null)
                {
                    if (GameSettings.DynamicParticleLOD)
                    {
                        MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag3;
                    }
                    this.m_particleObj = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.prefabName, true, SceneObjType.ActionRes, gameObject3.transform.position, gameObject3.transform.rotation, out flag);

                    if (GameSettings.DynamicParticleLOD)
                    {
                        MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false;
                    }
                }
                if (GameSettings.DynamicParticleLOD)
                {
                    GameSettings.ParticleLOD = particleLOD;
                }
                if (this.m_particleObj != null)
                {
                    this.m_particleObj.transform.SetParent(gameObject3.transform);
                    this.m_particleObj.transform.localPosition = Vector3.zero;
                    this.m_particleObj.transform.localRotation = Quaternion.identity;
                }
                this.actorRoot = ActorHelper.AttachActorRoot(gameObject3, ActorTypeDef.Actor_Type_Bullet, camp, null);
                _action.SetGameObject(this.targetId, gameObject3);
                this.actorRoot.get_handle().location = vInt;
                this.actorRoot.get_handle().forward  = forward;
                VCollisionShape.InitActorCollision(this.actorRoot, this.m_particleObj, _action.actionName);
                if (this.actorRoot.get_handle().shape != null)
                {
                    this.actorRoot.get_handle().shape.ConditionalUpdateShape();
                }
                if (this.bInvisibleBullet && this.actorRoot.get_handle().ActorControl != null)
                {
                    BulletWrapper bulletWrapper = this.actorRoot.get_handle().ActorControl as BulletWrapper;
                    if (bulletWrapper != null)
                    {
                        bulletWrapper.InitForInvisibleBullet();
                    }
                }
                this.actorRoot.get_handle().InitActor();
                if (refParamObject != null)
                {
                    refParamObject.EffectPos = this.actorRoot.get_handle().location;
                    if (this.actorRoot.get_handle().TheActorMeta.ActorType != ActorTypeDef.Actor_Type_EYE)
                    {
                        this.CreateBullet();
                    }
                }
                if (this.applyActionSpeedToAnimation)
                {
                    _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject3);
                }
                if (this.applyActionSpeedToParticle)
                {
                    _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject3);
                }
                this.actorRoot.get_handle().StartFight();
                if (this.enableLayer || this.enableTag)
                {
                    if (this.enableLayer)
                    {
                        gameObject3.layer = this.layer;
                    }
                    if (this.enableTag)
                    {
                        gameObject3.tag = this.tag;
                    }
                    Transform[] componentsInChildren = gameObject3.GetComponentsInChildren <Transform>();
                    for (int i = 0; i < componentsInChildren.Length; i++)
                    {
                        if (this.enableLayer)
                        {
                            componentsInChildren[i].gameObject.layer = this.layer;
                        }
                        if (this.enableTag)
                        {
                            componentsInChildren[i].gameObject.tag = this.tag;
                        }
                    }
                }
                if (flag)
                {
                    ParticleHelper.Init(gameObject3, this.scaling);
                }
                PoolObjHandle <ActorRoot> actorHandle3 = _action.GetActorHandle(this.targetId);
                this.SetParent(ref actorHandle, ref actorHandle3, this.translation);
                if (this.modifyScaling)
                {
                    gameObject3.transform.localScale = this.scaling;
                }
            }
            else
            {
                GameObject gameObject4;
                if (this.modifyDirection)
                {
                    gameObject4 = MonoSingleton <SceneMgr> .GetInstance().InstantiateLOD(this.prefabName, true, SceneObjType.ActionRes, (Vector3)vInt, Quaternion.LookRotation((Vector3)forward));
                }
                else
                {
                    gameObject4 = MonoSingleton <SceneMgr> .GetInstance().InstantiateLOD(this.prefabName, true, SceneObjType.ActionRes, (Vector3)vInt);
                }
                if (gameObject4 == null)
                {
                    return;
                }
                if (this.applyActionSpeedToAnimation)
                {
                    _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject4);
                }
                if (this.applyActionSpeedToParticle)
                {
                    _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject4);
                }
                if (this.enableLayer)
                {
                    gameObject4.layer = this.layer;
                    Transform[] componentsInChildren2 = gameObject4.GetComponentsInChildren <Transform>();
                    for (int j = 0; j < componentsInChildren2.Length; j++)
                    {
                        componentsInChildren2[j].gameObject.layer = this.layer;
                    }
                }
                if (this.enableTag)
                {
                    gameObject4.tag = this.tag;
                    Transform[] componentsInChildren3 = gameObject4.GetComponentsInChildren <Transform>();
                    for (int k = 0; k < componentsInChildren3.Length; k++)
                    {
                        componentsInChildren3[k].gameObject.tag = this.tag;
                    }
                }
                if (gameObject4.GetComponent <ParticleSystem>() && this.modifyScaling)
                {
                    ParticleSystem[] componentsInChildren4 = gameObject4.GetComponentsInChildren <ParticleSystem>();
                    for (int l = 0; l < componentsInChildren4.Length; l++)
                    {
                        componentsInChildren4[l].startSize            *= this.scaling.x;
                        componentsInChildren4[l].startLifetime        *= this.scaling.y;
                        componentsInChildren4[l].startSpeed           *= this.scaling.z;
                        componentsInChildren4[l].transform.localScale *= this.scaling.x;
                    }
                }
                PoolObjHandle <ActorRoot> poolObjHandle = ActorHelper.GetActorRoot(gameObject4);
                this.SetParent(ref actorHandle, ref poolObjHandle, this.translation);
                if (this.modifyScaling)
                {
                    gameObject4.transform.localScale = this.scaling;
                }
            }
        }