Exemplo n.º 1
0
        public PoolObjHandle <ActorRoot> AttachActorRoot(GameObject rootObj, ref ActorMeta theActorMeta, CActorInfo actorInfo = null)
        {
            VInt num;

            DebugHelper.Assert(this.ActorObj == null);
            this.ActorObj = ClassObjPool <ActorRoot> .Get();

            this.ActorPtr              = new PoolObjHandle <ActorRoot>(this.ActorObj);
            this.ActorObj.ObjLinker    = this;
            this.ActorObj.location     = (VInt3)rootObj.transform.position;
            this.ActorObj.forward      = (VInt3)rootObj.transform.forward;
            this.ActorObj.rotation     = rootObj.transform.rotation;
            this.oldLocation           = this.ActorObj.location;
            this.tarRotation           = this.ActorObj.rotation;
            this.ActorObj.TheActorMeta = theActorMeta;
            if (theActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster)
            {
                this.ActorObj.TheActorMeta.EnCId = theActorMeta.ConfigId;
            }
            this.ActorObj.CharInfo = actorInfo;
            if (((this.ActorObj.TheActorMeta.ActorType < ActorTypeDef.Actor_Type_Bullet) && (this.ActorObj.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Organ)) && PathfindingUtility.GetGroundY(this.ActorObj, out num))
            {
                this.ActorObj.groundY = num;
                VInt3 location = this.ActorObj.location;
                location.y             = num.i;
                this.ActorObj.location = location;
            }
            return(this.ActorPtr);
        }
Exemplo n.º 2
0
 public override void OnRelease()
 {
     this.CharInfo           = null;
     this.ObjLinker          = null;
     this.ActorMesh          = null;
     this.ActorMeshAnimation = null;
     this.isRecycled         = true;
     base.OnRelease();
 }
Exemplo n.º 3
0
 public override void OnRelease()
 {
     this.CharInfo           = null;
     this.ObjLinker          = null;
     this.myTransform        = null;
     this.ActorMesh          = null;
     this.ActorMeshAnimation = null;
     this.isRecycled         = true;
     this.ShadowEffect       = null;
     base.OnRelease();
 }
Exemplo n.º 4
0
 public override void OnUse()
 {
     base.OnUse();
     this.name               = string.Empty;
     this.isMovable          = true;
     this.isRotatable        = true;
     this.myTransform        = null;
     this.ActorMesh          = null;
     this.ActorMeshAnimation = null;
     this._bVisible          = true;
     this._bInitVisibleDelay = 0;
     this._bInCamera         = false;
     this.ObjID              = 0u;
     this.TheActorMeta       = default(ActorMeta);
     this.TheStaticData      = default(ActorStaticData);
     this.SelfPtr.Release();
     this.ObjLinker                   = null;
     this.ActorControl                = null;
     this.ActorAgent                  = null;
     this.MovementComponent           = null;
     this.SkillControl                = null;
     this.ValueComponent              = null;
     this.HurtControl                 = null;
     this.HudControl                  = null;
     this.AnimControl                 = null;
     this.BuffHolderComp              = null;
     this.MatHurtEffect               = null;
     this.ShadowEffect                = null;
     this.EquipComponent              = null;
     this.DefaultAttackModeControl    = null;
     this.LockTargetAttackModeControl = null;
     this.PetControl                  = null;
     this.OriginalActorMesh           = null;
     this.OriginalMeshAnim            = null;
     this.shape = null;
     this.slotList.Clear();
     this.bChildUpdate             = false;
     this.SMNode                   = null;
     this._location                = VInt3.zero;
     this._forward                 = VInt3.forward;
     this._rotation                = Quaternion.identity;
     this.groundY                  = 0;
     this.hasReachedNavEdge        = false;
     this.pickFlyY                 = 0;
     this.AttackOrderReady         = true;
     this.bOneKiller               = false;
     this.CharInfo                 = null;
     this.HorizonMarker            = null;
     this.BornPos                  = VInt3.zero;
     this.isRecycled               = false;
     this.BornPos                  = VInt3.zero;
     this.PositionRecords          = null;
     this.PositionRecordsLastStamp = 0f;
 }
Exemplo n.º 5
0
 public void OnGet()
 {
     this.CanMovable = true;
     this.isStatic   = false;
     this.CharInfo   = null;
     this.ActorObj   = null;
     this.ActorPtr.Release();
     this.myRenderer      = null;
     this.bNeedLerp       = false;
     this.GroundSpeed     = 0;
     this.nPreMoveSeq     = -1;
     this.RepairFramesMin = 1;
     this.FrameBlockIndex = 0;
     this.CustomMoveLerp  = null;
     this.ActorControl    = null;
     this.ActorMovement   = null;
 }
Exemplo n.º 6
0
        private void SpawnSoldier(uint SoldierID)
        {
            ResMonsterCfgInfo dataCfgInfoByCurLevelDiff = MonsterDataHelper.GetDataCfgInfoByCurLevelDiff((int)SoldierID);

            if (dataCfgInfoByCurLevelDiff == null)
            {
                return;
            }
            string     path      = StringHelper.UTF8BytesToString(ref dataCfgInfoByCurLevelDiff.szCharacterInfo);
            CActorInfo actorInfo = CActorInfo.GetActorInfo(path, enResourceType.BattleScene);

            if (actorInfo)
            {
                Transform      transform  = this.Region.transform;
                COM_PLAYERCAMP campType   = this.Region.CampType;
                ActorMeta      actorMeta  = default(ActorMeta);
                ActorMeta      actorMeta2 = actorMeta;
                actorMeta2.ConfigId  = (int)SoldierID;
                actorMeta2.ActorType = ActorTypeDef.Actor_Type_Monster;
                actorMeta2.ActorCamp = campType;
                actorMeta            = actorMeta2;
                VInt3 vInt  = (VInt3)transform.position;
                VInt3 vInt2 = (VInt3)transform.forward;
                PoolObjHandle <ActorRoot> poolObjHandle = default(PoolObjHandle <ActorRoot>);
                if (!Singleton <GameObjMgr> .GetInstance().TryGetFromCache(ref poolObjHandle, ref actorMeta))
                {
                    poolObjHandle = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, vInt, vInt2, false, true);

                    if (poolObjHandle)
                    {
                        poolObjHandle.handle.InitActor();
                        poolObjHandle.handle.PrepareFight();
                        Singleton <GameObjMgr> .instance.AddActor(poolObjHandle);

                        poolObjHandle.handle.StartFight();
                    }
                }
                else
                {
                    ActorRoot handle = poolObjHandle.handle;
                    handle.TheActorMeta.ActorCamp = actorMeta.ActorCamp;
                    handle.ReactiveActor(vInt, vInt2);
                }
                if (poolObjHandle)
                {
                    if (this.Region.AttackRoute != null)
                    {
                        poolObjHandle.handle.ActorControl.AttackAlongRoute(this.Region.AttackRoute.GetComponent <WaypointsHolder>());
                    }
                    else if (this.Region.finalTarget != null)
                    {
                        FrameCommand <AttackPositionCommand> frameCommand = FrameCommandFactory.CreateFrameCommand <AttackPositionCommand>();
                        frameCommand.cmdId            = 1u;
                        frameCommand.cmdData.WorldPos = new VInt3(this.Region.finalTarget.transform.position);
                        poolObjHandle.handle.ActorControl.CmdAttackMoveToDest(frameCommand, frameCommand.cmdData.WorldPos);
                    }
                    if (!this.isCannonNotified && this.WaveInfo.bType == 1 && this.Region != null && (this.Region.RouteType == RES_SOLDIER_ROUTE_TYPE.RES_SOLDIER_ROUTE_MID || this.Region.RouteType == RES_SOLDIER_ROUTE_TYPE.RES_SOLDIER_ROUTE_NONE))
                    {
                        KillNotify theKillNotify = Singleton <CBattleSystem> .GetInstance().TheKillNotify;

                        Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                        if (theKillNotify != null && hostPlayer != null)
                        {
                            bool flag = hostPlayer.PlayerCamp == poolObjHandle.handle.TheActorMeta.ActorCamp;
                            if (flag)
                            {
                                KillInfo killInfo = new KillInfo((hostPlayer.PlayerCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? KillNotify.blue_cannon_icon : KillNotify.red_cannon_icon, null, KillDetailInfoType.Info_Type_Cannon_Spawned, flag, false, ActorTypeDef.Invalid, false);
                                theKillNotify.AddKillInfo(ref killInfo);
                                this.isCannonNotified = true;
                            }
                        }
                    }
                    if (this.WaveInfo.bType == 2)
                    {
                        if (!this.isNotifiedBigDragonSoldier && this.Region != null && (this.Region.RouteType == RES_SOLDIER_ROUTE_TYPE.RES_SOLDIER_ROUTE_MID || this.Region.RouteType == RES_SOLDIER_ROUTE_TYPE.RES_SOLDIER_ROUTE_NONE))
                        {
                            KillNotify theKillNotify2 = Singleton <CBattleSystem> .GetInstance().TheKillNotify;

                            Player hostPlayer2 = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                            if (theKillNotify2 != null && hostPlayer2 != null)
                            {
                                bool     bSrcAllies = hostPlayer2.PlayerCamp == poolObjHandle.handle.TheActorMeta.ActorCamp;
                                KillInfo killInfo2  = new KillInfo(KillNotify.soldier_bigdragon_icon, null, KillDetailInfoType.Info_Type_Soldier_BigDragon, bSrcAllies, false, ActorTypeDef.Invalid, false);
                                theKillNotify2.AddKillInfo(ref killInfo2);
                                this.isNotifiedBigDragonSoldier = true;
                            }
                        }
                    }
                    else if (this.isNotifiedBigDragonSoldier)
                    {
                        this.isNotifiedBigDragonSoldier = false;
                    }
                }
            }
            SoldierWaveParam soldierWaveParam = new SoldierWaveParam(this.Index, this.repeatCount, this.Region.GetNextRepeatTime(false), this);

            Singleton <GameEventSys> .instance.SendEvent <SoldierWaveParam>(GameEventDef.Event_SoldierWaveNextRepeat, ref soldierWaveParam);
        }
Exemplo n.º 7
0
        public static PoolObjHandle <ActorRoot> AttachActorRoot(GameObject go, ActorTypeDef actorType, COM_PLAYERCAMP camp, CActorInfo actorInfo)
        {
            DebugHelper.Assert(!Singleton <BattleLogic> .get_instance().isFighting || Singleton <GameLogic> .get_instance().bInLogicTick || Singleton <FrameSynchr> .get_instance().isCmdExecuting);
            ActorConfig actorConfig = go.GetComponent <ActorConfig>();

            if (null == actorConfig)
            {
                actorConfig = go.AddComponent <ActorConfig>();
            }
            ActorMeta actorMeta  = default(ActorMeta);
            ActorMeta actorMeta2 = actorMeta;

            actorMeta2.ActorType = actorType;
            actorMeta2.ActorCamp = camp;
            actorMeta            = actorMeta2;
            PoolObjHandle <ActorRoot> result = actorConfig.AttachActorRoot(go, ref actorMeta, actorInfo);

            result.get_handle().Spawned();
            return(result);
        }
Exemplo n.º 8
0
        private void SpawnSoldier(uint SoldierID)
        {
            ResMonsterCfgInfo dataCfgInfoByCurLevelDiff = MonsterDataHelper.GetDataCfgInfoByCurLevelDiff((int)SoldierID);

            if (dataCfgInfoByCurLevelDiff != null)
            {
                if (CActorInfo.GetActorInfo(StringHelper.UTF8BytesToString(ref dataCfgInfoByCurLevelDiff.szCharacterInfo), enResourceType.BattleScene) != null)
                {
                    Transform      transform = this.Region.transform;
                    COM_PLAYERCAMP campType  = this.Region.CampType;
                    ActorMeta      actorMeta = new ActorMeta {
                        ConfigId  = (int)SoldierID,
                        ActorType = ActorTypeDef.Actor_Type_Monster,
                        ActorCamp = campType
                    };
                    VInt3 position = (VInt3)transform.position;
                    VInt3 forward  = (VInt3)transform.forward;
                    PoolObjHandle <ActorRoot> actor = new PoolObjHandle <ActorRoot>();
                    if (!Singleton <GameObjMgr> .GetInstance().TryGetFromCache(ref actor, ref actorMeta))
                    {
                        actor = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, position, forward, false, true);

                        if (actor != 0)
                        {
                            actor.handle.InitActor();
                            actor.handle.PrepareFight();
                            Singleton <GameObjMgr> .instance.AddActor(actor);

                            actor.handle.StartFight();
                        }
                    }
                    else
                    {
                        ActorRoot handle = actor.handle;
                        handle.TheActorMeta.ActorCamp = actorMeta.ActorCamp;
                        handle.ReactiveActor(position, forward);
                    }
                    if (actor != 0)
                    {
                        if (this.Region.AttackRoute != null)
                        {
                            actor.handle.ActorControl.AttackAlongRoute(this.Region.AttackRoute.GetComponent <WaypointsHolder>());
                        }
                        else if (this.Region.finalTarget != null)
                        {
                            FrameCommand <AttackPositionCommand> cmd = FrameCommandFactory.CreateFrameCommand <AttackPositionCommand>();
                            cmd.cmdId            = 1;
                            cmd.cmdData.WorldPos = new VInt3(this.Region.finalTarget.transform.position);
                            actor.handle.ActorControl.CmdAttackMoveToDest(cmd, cmd.cmdData.WorldPos);
                        }
                        if (!this.isCannonNotified && (this.WaveInfo.bType == 1))
                        {
                            KillNotify killNotifation = Singleton <CBattleSystem> .GetInstance().GetKillNotifation();

                            Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                            if ((killNotifation != null) && (hostPlayer != null))
                            {
                                bool bSrcAllies = hostPlayer.PlayerCamp == actor.handle.TheActorMeta.ActorCamp;
                                if (bSrcAllies)
                                {
                                    KillInfo killInfo = new KillInfo((hostPlayer.PlayerCamp != COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? KillNotify.red_cannon_icon : KillNotify.blue_cannon_icon, null, KillDetailInfoType.Info_Type_Cannon_Spawned, bSrcAllies, false, ActorTypeDef.Invalid);
                                    killNotifation.AddKillInfo(killInfo);
                                    this.isCannonNotified = true;
                                }
                            }
                        }
                    }
                }
                if (this.Region.bTriggerEvent)
                {
                    SoldierWaveParam prm = new SoldierWaveParam(this.Index, this.repeatCount, this.Region.GetNextRepeatTime(false));
                    Singleton <GameEventSys> .instance.SendEvent <SoldierWaveParam>(GameEventDef.Event_SoldierWaveNextRepeat, ref prm);
                }
            }
        }
Exemplo n.º 9
0
        public PoolObjHandle <ActorRoot> SpawnActorEx(GameObject rootObj, ref ActorMeta actorMeta, VInt3 pos, VInt3 dir, bool useLobbyModel, bool addComponent)
        {
            if (actorMeta.Difficuty == 0)
            {
                actorMeta.Difficuty = (byte)Singleton <BattleLogic> .get_instance().GetCurLvelContext().m_levelDifficulty;
            }
            ActorStaticData        theStaticData     = default(ActorStaticData);
            IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .get_instance().GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

            actorDataProvider.GetActorStaticData(ref actorMeta, ref theStaticData);
            ActorServerData        actorServerData    = default(ActorServerData);
            IGameActorDataProvider actorDataProvider2 = Singleton <ActorDataCenter> .get_instance().GetActorDataProvider(GameActorDataProviderType.ServerDataProvider);

            actorDataProvider2.GetActorServerData(ref actorMeta, ref actorServerData);
            if (actorMeta.SkinID == 0u)
            {
                actorMeta.SkinID = actorServerData.SkinId;
            }
            GameObject  gameObject = null;
            ActorConfig component;

            if (rootObj == null)
            {
                rootObj = MonoSingleton <SceneMgr> .GetInstance().Spawn(typeof(ActorRoot).get_Name(), (SceneObjType)theStaticData.TheActorMeta.ActorType, pos, dir);

                component = rootObj.GetComponent <ActorConfig>();
            }
            else
            {
                component = rootObj.GetComponent <ActorConfig>();
                Animation componentInChildren = rootObj.GetComponentInChildren <Animation>();
                if (componentInChildren != null)
                {
                    gameObject = componentInChildren.gameObject;
                }
                rootObj.transform.parent = MonoSingleton <SceneMgr> .GetInstance().GetRoot((SceneObjType)theStaticData.TheActorMeta.ActorType).transform;
            }
            component.ConfigID = actorMeta.ConfigId;
            CActorInfo cActorInfo = null;

            if (!string.IsNullOrEmpty(theStaticData.TheResInfo.ResPath))
            {
                CActorInfo actorInfo = CActorInfo.GetActorInfo(theStaticData.TheResInfo.ResPath, 0);
                if (actorInfo != null)
                {
                    cActorInfo = (CActorInfo)Object.Instantiate(actorInfo);
                    string text = (!useLobbyModel) ? cActorInfo.GetArtPrefabName((int)actorMeta.SkinID, -1) : cActorInfo.GetArtPrefabNameLobby((int)actorMeta.SkinID);
                    if (gameObject == null && !string.IsNullOrEmpty(text))
                    {
                        bool flag = false;
                        gameObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(text, false, SceneObjType.ActionRes, Vector3.zero, Quaternion.identity, out flag);

                        if (gameObject != null)
                        {
                            Transform component2 = gameObject.GetComponent <Transform>();
                            component2.SetParent(rootObj.transform);
                            component2.localPosition = Vector3.zero;
                            component2.localRotation = Quaternion.identity;
                            TransformConfig transformConfigIfHaveOne = cActorInfo.GetTransformConfigIfHaveOne(ETransformConfigUsage.CharacterInGame);
                            if (transformConfigIfHaveOne != null)
                            {
                                component2.localPosition += transformConfigIfHaveOne.Offset;
                                component2.localScale    *= transformConfigIfHaveOne.Scale;
                            }
                        }
                    }
                }
            }
            PoolObjHandle <ActorRoot> result = component.AttachActorRoot(rootObj, ref actorMeta, cActorInfo);

            result.get_handle().TheStaticData = theStaticData;
            if (addComponent)
            {
                result.get_handle().Spawned();
            }
            return(result);
        }
Exemplo n.º 10
0
        public static PoolObjHandle <ActorRoot> AttachActorRoot(GameObject go, ActorTypeDef actorType, COM_PLAYERCAMP camp, CActorInfo actorInfo)
        {
            DebugHelper.Assert((!Singleton <BattleLogic> .instance.isFighting || Singleton <GameLogic> .instance.bInLogicTick) || Singleton <FrameSynchr> .instance.isCmdExecuting);
            ActorConfig component = go.GetComponent <ActorConfig>();

            if (null == component)
            {
                component = go.AddComponent <ActorConfig>();
            }
            ActorMeta theActorMeta = new ActorMeta {
                ActorType = actorType,
                ActorCamp = camp
            };
            PoolObjHandle <ActorRoot> handle = component.AttachActorRoot(go, ref theActorMeta, actorInfo);

            handle.handle.Spawned();
            return(handle);
        }