コード例 #1
0
        public void OnShenfuStart(uint shenFuId, AreaEventTrigger trigger, TriggerActionShenFu shenFu)
        {
            if (trigger == null || shenFu == null)
            {
                return;
            }
            ShenFuObjects shenFuObjects = default(ShenFuObjects);
            ShenFuInfo    dataByKey     = GameDataMgr.shenfuBin.GetDataByKey(shenFuId);

            if (dataByKey == null)
            {
                return;
            }
            trigger.Radius = (int)dataByKey.dwGetRadius;
            string prefabName = StringHelper.UTF8BytesToString(ref dataByKey.szShenFuResPath);

            shenFuObjects.ShenFu = MonoSingleton <SceneMgr> .get_instance().InstantiateLOD(prefabName, false, SceneObjType.ActionRes, trigger.gameObject.transform.position);

            this._shenFuTriggerPool.Add(trigger.ID, shenFuObjects);
            if (FogOfWar.enable)
            {
                COM_PLAYERCAMP playerCamp = Singleton <GamePlayerCenter> .get_instance().GetHostPlayer().PlayerCamp;

                GameFowCollector.SetObjVisibleByFow(shenFuObjects.ShenFu, Singleton <GameFowManager> .get_instance(), playerCamp);
            }
        }
コード例 #2
0
        public static bool SetObjWithColVisibleByFow(PoolObjHandle <ActorRoot> inActor, GameFowManager fowMgr, COM_PLAYERCAMP inHostCamp)
        {
            if (!inActor)
            {
                return(false);
            }
            ActorRoot       handle = inActor.handle;
            VCollisionShape shape  = handle.shape;

            if (shape == null)
            {
                return(GameFowCollector.SetObjVisibleByFow(inActor, handle.gameObject, fowMgr, inHostCamp));
            }
            VInt3 location = handle.location;

            location = new VInt3(location.x, location.z, 0);
            bool flag = fowMgr.IsVisible(location, inHostCamp);

            if (flag)
            {
                handle.Visible = true;
            }
            else
            {
                flag           = shape.AcceptFowVisibilityCheck(inHostCamp, fowMgr);
                handle.Visible = flag;
            }
            return(flag);
        }
コード例 #3
0
        public static bool SetObjWithColVisibleByFowAttached(GameObject inObj, GameFowManager fowMgr, COM_PLAYERCAMP inHostCamp, PoolObjHandle <ActorRoot> inAttachActor)
        {
            if (inObj == null)
            {
                return(false);
            }
            if (!inAttachActor || inAttachActor.get_handle().shape == null)
            {
                return(GameFowCollector.SetObjVisibleByFow(inObj, fowMgr, inHostCamp));
            }
            VCollisionShape shape    = inAttachActor.get_handle().shape;
            VInt3           location = inAttachActor.get_handle().location;

            location = new VInt3(location.x, location.z, 0);
            bool flag = fowMgr.IsSurfaceCellVisible(location, inHostCamp);

            if (flag)
            {
                MMGame_Math.SetLayer(inObj, "Actor", "Particles", true);
            }
            else
            {
                flag = shape.AcceptFowVisibilityCheck(inHostCamp, fowMgr);
                if (flag)
                {
                    MMGame_Math.SetLayer(inObj, "Actor", "Particles", true);
                }
                else
                {
                    MMGame_Math.SetLayer(inObj, "Hide", true);
                }
            }
            return(flag);
        }
コード例 #4
0
        public static bool SetObjVisibleByFowAttached(GameObject obj, GameFowManager fowMgr, COM_PLAYERCAMP inHostCamp, PoolObjHandle <ActorRoot> inAttachActor)
        {
            if (obj == null)
            {
                return(false);
            }
            bool flag;

            if (inAttachActor)
            {
                VInt3 location = inAttachActor.get_handle().location;
                location = new VInt3(location.x, location.z, 0);
                flag     = fowMgr.IsSurfaceCellVisible(location, inHostCamp);
                if (flag)
                {
                    MMGame_Math.SetLayer(obj, "Actor", "Particles", true);
                }
                else
                {
                    MMGame_Math.SetLayer(obj, "Hide", true);
                }
            }
            else
            {
                flag = GameFowCollector.SetObjVisibleByFow(obj, fowMgr, inHostCamp);
            }
            return(flag);
        }
コード例 #5
0
        public static bool VisitFowVisibilityCheck(VCollisionCylinderSector cylinder, PoolObjHandle <ActorRoot> inActor, COM_PLAYERCAMP inHostCamp, GameFowManager fowMgr)
        {
            VInt2 zero = VInt2.zero;

            fowMgr.WorldPosToGrid(new VInt3(cylinder.WorldPos.x, cylinder.WorldPos.z, 0), out zero.x, out zero.y);
            float num = (float)cylinder.Radius;

            num *= 0.001f;
            num *= num;
            Vector3 vector = (Vector3)cylinder.WorldPos;
            float   num2   = (float)cylinder.Degree;

            num2 *= 0.5f;
            num2  = Mathf.Cos(num2);
            Vector3  vector2   = (Vector3)cylinder.WorldPos;
            Vector3  vector3   = (Vector3)inActor.handle.forward;
            FieldObj pFieldObj = fowMgr.m_pFieldObj;
            int      num3      = 0;

            pFieldObj.UnrealToGridX(cylinder.Radius, out num3);
            int num4 = zero.x - num3;

            num4 = Math.Max(0, num4);
            int num5 = zero.x + num3;

            num5 = Math.Min(num5, pFieldObj.NumX - 1);
            int num6 = zero.y - num3;

            num6 = Math.Max(0, num6);
            int num7 = zero.y + num3;

            num7 = Math.Min(num7, pFieldObj.NumY - 1);
            for (int i = num4; i <= num5; i++)
            {
                for (int j = num6; j <= num7; j++)
                {
                    bool flag = Singleton <GameFowManager> .instance.IsVisible(i, j, inHostCamp);

                    if (flag && GameFowCollector.IsPointInCircularSector2(vector.x, vector.z, vector3.x, vector3.z, num, num2, vector2.x, vector2.z))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
コード例 #6
0
        public bool CreateShenFu(uint shenFuId, Vector3 createPosition, ref ShenFuObjects shenFuObj, int pickTick = 0)
        {
            ShenFuInfo dataByKey = GameDataMgr.shenfuBin.GetDataByKey(shenFuId);

            if (dataByKey == null)
            {
                return(false);
            }
            string prefabName = StringHelper.UTF8BytesToString(ref dataByKey.szShenFuResPath);

            shenFuObj.ShenFuId = shenFuId;
            shenFuObj.ShenFu   = MonoSingleton <SceneMgr> .instance.InstantiateLOD(prefabName, false, SceneObjType.ActionRes, createPosition);

            shenFuObj.PickUpRange = dataByKey.dwGetRadius;
            shenFuObj.PickTick    = pickTick;
            if (FogOfWar.enable)
            {
                COM_PLAYERCAMP horizonCamp = Singleton <WatchController> .instance.HorizonCamp;
                GameFowCollector.SetObjVisibleByFow(new PoolObjHandle <ActorRoot>(null), shenFuObj.ShenFu, Singleton <GameFowManager> .instance, horizonCamp);
            }
            return(true);
        }
コード例 #7
0
        public void UpdateFowVisibility(bool bForce)
        {
            GameObjMgr     instance    = Singleton <GameObjMgr> .instance;
            GameFowManager instance2   = Singleton <GameFowManager> .instance;
            COM_PLAYERCAMP horizonCamp = Singleton <WatchController> .instance.HorizonCamp;
            uint           num         = Singleton <FrameSynchr> .instance.CurFrameNum % instance2.InterpolateFrameInterval;
            uint           num2        = Singleton <FrameSynchr> .instance.CurFrameNum % instance2.InterpolateFrameIntervalBullet(true);
            uint           num3        = Singleton <FrameSynchr> .instance.CurFrameNum % instance2.InterpolateFrameIntervalBullet(false);
            uint           num4        = Singleton <FrameSynchr> .instance.CurFrameNum % instance2.InterpolateFrameIntervalHero;
            List <PoolObjHandle <ActorRoot> > gameActors = instance.GameActors;
            int count = gameActors.get_Count();

            for (int i = 0; i < count; i++)
            {
                if (gameActors.get_Item(i))
                {
                    ActorRoot    handle    = gameActors.get_Item(i).handle;
                    ActorTypeDef actorType = handle.TheActorMeta.ActorType;
                    if (actorType == ActorTypeDef.Actor_Type_Hero)
                    {
                        if (handle.ObjID % instance2.InterpolateFrameIntervalHero != num4 && !bForce)
                        {
                            goto IL_219;
                        }
                    }
                    else
                    {
                        if (handle.ObjID % instance2.InterpolateFrameInterval != num && !bForce)
                        {
                            goto IL_219;
                        }
                        if (handle.ActorControl.IsDeadState && !handle.TheStaticData.TheBaseAttribute.DeadControl)
                        {
                            goto IL_219;
                        }
                    }
                    if (actorType != ActorTypeDef.Actor_Type_Organ)
                    {
                        VInt3 worldLoc = new VInt3(handle.location.x, handle.location.z, 0);
                        if (actorType == ActorTypeDef.Actor_Type_Hero || actorType == ActorTypeDef.Actor_Type_Monster)
                        {
                            bool flag = instance2.QueryAttr(handle.location) == FieldObj.EViewBlockType.Grass;
                            handle.HorizonMarker.SetTranslucentMark(HorizonConfig.HideMark.Jungle, flag, false);
                            if (handle.HudControl != null && handle.HudControl.HasStatus(StatusHudType.InJungle) != flag)
                            {
                                if (flag)
                                {
                                    handle.HudControl.ShowStatus(StatusHudType.InJungle);
                                }
                                else
                                {
                                    handle.HudControl.HideStatus(StatusHudType.InJungle);
                                }
                            }
                        }
                        for (int j = 1; j < 3; j++)
                        {
                            COM_PLAYERCAMP cOM_PLAYERCAMP = (COM_PLAYERCAMP)j;
                            if (cOM_PLAYERCAMP != handle.TheActorMeta.ActorCamp)
                            {
                                handle.HorizonMarker.SetHideMark(cOM_PLAYERCAMP, HorizonConfig.HideMark.Jungle, !instance2.IsSurfaceCellVisibleConsiderNeighbor(worldLoc, cOM_PLAYERCAMP));
                            }
                        }
                    }
                }
                IL_219 :;
            }
            Dictionary <int, ShenFuObjects> .Enumerator enumerator = Singleton <ShenFuSystem> .instance._shenFuTriggerPool.GetEnumerator();

            while (enumerator.MoveNext())
            {
                KeyValuePair <int, ShenFuObjects> current = enumerator.get_Current();
                int key = current.get_Key();
                if ((long)key % (long)((ulong)instance2.InterpolateFrameInterval) == (long)((ulong)num))
                {
                    KeyValuePair <int, ShenFuObjects> current2 = enumerator.get_Current();
                    GameObject shenFu = current2.get_Value().ShenFu;
                    GameFowCollector.SetObjVisibleByFow(new PoolObjHandle <ActorRoot>(null), shenFu, instance2, horizonCamp);
                }
            }
            for (int k = 0; k < 3; k++)
            {
                if (Singleton <WatchController> .instance.IsWatching || k != (int)horizonCamp)
                {
                    List <PoolObjHandle <ActorRoot> > campBullet = instance.GetCampBullet((COM_PLAYERCAMP)k);
                    int count2 = campBullet.get_Count();
                    for (int l = 0; l < count2; l++)
                    {
                        PoolObjHandle <ActorRoot> poolObjHandle = campBullet.get_Item(l);
                        if (poolObjHandle)
                        {
                            ActorRoot     handle2       = poolObjHandle.handle;
                            BulletWrapper bulletWrapper = handle2.ActorControl as BulletWrapper;
                            if (bulletWrapper.m_bVisibleByFow)
                            {
                                bool flag2;
                                if (bulletWrapper.GetMoveDelta() > 0)
                                {
                                    flag2 = (handle2.ObjID % instance2.InterpolateFrameIntervalBullet(true) != num2);
                                }
                                else
                                {
                                    flag2 = (handle2.ObjID % instance2.InterpolateFrameIntervalBullet(false) != num3);
                                }
                                if (!flag2)
                                {
                                    if (Singleton <WatchController> .instance.IsWatching && Singleton <WatchController> .instance.CoversCamp(bulletWrapper.actor.TheActorMeta.ActorCamp))
                                    {
                                        bulletWrapper.UpdateSubParObjVisibility(true);
                                    }
                                    else if (bulletWrapper.m_bVisibleByShape)
                                    {
                                        bulletWrapper.UpdateSubParObjVisibility(GameFowCollector.SetObjWithColVisibleByFow(poolObjHandle, instance2, horizonCamp));
                                    }
                                    else
                                    {
                                        bulletWrapper.UpdateSubParObjVisibility(GameFowCollector.SetObjVisibleByFow(poolObjHandle, handle2.gameObject, instance2, horizonCamp));
                                    }
                                }
                            }
                        }
                    }
                }
            }
            int count3 = this.VirtualParentParticles_.get_Count();

            for (int m = 0; m < count3; m++)
            {
                GameFowCollector.VirtualParticleAttachContext virtualParticleAttachContext = this.VirtualParentParticles_.get_Item(m);
                GameObject virtualParticle = this.VirtualParentParticles_.get_Item(m).VirtualParticle;
                if (!(virtualParticle == null) && this.VirtualParentParticles_.get_Item(m).AttachActor)
                {
                    if (this.VirtualParentParticles_.get_Item(m).AttachActor.handle.Visible)
                    {
                        virtualParticle.SetLayer("Actor", "Particles", true);
                    }
                    else
                    {
                        virtualParticle.SetLayer("Hide", true);
                    }
                }
            }
        }
コード例 #8
0
        public void UpdateFowVisibility(bool bForce)
        {
            GameObjMgr instance = Singleton <GameObjMgr> .get_instance();

            GameFowManager instance2 = Singleton <GameFowManager> .get_instance();

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

            COM_PLAYERCAMP playerCamp = hostPlayer.PlayerCamp;
            uint           num        = Singleton <FrameSynchr> .get_instance().CurFrameNum % instance2.InterpolateFrameInterval;

            uint num2 = Singleton <FrameSynchr> .get_instance().CurFrameNum % instance2.InterpolateFrameIntervalBullet;

            uint num3 = Singleton <FrameSynchr> .get_instance().CurFrameNum % instance2.InterpolateFrameIntervalHero;

            List <PoolObjHandle <ActorRoot> > gameActors = instance.GameActors;
            int count = gameActors.get_Count();

            for (int i = 0; i < count; i++)
            {
                if (gameActors.get_Item(i))
                {
                    ActorRoot    handle    = gameActors.get_Item(i).get_handle();
                    ActorTypeDef actorType = handle.TheActorMeta.ActorType;
                    if (actorType == ActorTypeDef.Actor_Type_Hero)
                    {
                        if (handle.ObjID % instance2.InterpolateFrameIntervalHero != num3 && !bForce)
                        {
                            goto IL_212;
                        }
                    }
                    else if (handle.ObjID % instance2.InterpolateFrameInterval != num && !bForce)
                    {
                        goto IL_212;
                    }
                    if (actorType != ActorTypeDef.Actor_Type_Organ && (!handle.ActorControl.IsDeadState || handle.TheStaticData.TheBaseAttribute.DeadControl))
                    {
                        VInt3 worldLoc = new VInt3(handle.location.x, handle.location.z, 0);
                        if (actorType == ActorTypeDef.Actor_Type_Hero || actorType == ActorTypeDef.Actor_Type_Monster)
                        {
                            bool flag = instance2.QueryAttr(handle.location) == FieldObj.EViewBlockType.Grass;
                            handle.HorizonMarker.SetTranslucentMark(HorizonConfig.HideMark.Jungle, flag, false);
                            if (handle.HudControl != null && handle.HudControl.HasStatus(StatusHudType.InJungle) != flag)
                            {
                                if (flag)
                                {
                                    handle.HudControl.ShowStatus(StatusHudType.InJungle);
                                }
                                else
                                {
                                    handle.HudControl.HideStatus(StatusHudType.InJungle);
                                }
                            }
                        }
                        for (int j = 1; j < 3; j++)
                        {
                            COM_PLAYERCAMP cOM_PLAYERCAMP = j;
                            if (cOM_PLAYERCAMP != handle.TheActorMeta.ActorCamp)
                            {
                                handle.HorizonMarker.SetHideMark(cOM_PLAYERCAMP, HorizonConfig.HideMark.Jungle, !instance2.IsSurfaceCellVisibleConsiderNeighbor(worldLoc, cOM_PLAYERCAMP));
                            }
                        }
                    }
                }
                IL_212 :;
            }
            Dictionary <int, ShenFuObjects> .Enumerator enumerator = Singleton <ShenFuSystem> .get_instance()._shenFuTriggerPool.GetEnumerator();

            while (enumerator.MoveNext())
            {
                KeyValuePair <int, ShenFuObjects> current = enumerator.get_Current();
                int key = current.get_Key();
                if ((long)key % (long)((ulong)instance2.InterpolateFrameInterval) == (long)((ulong)num))
                {
                    KeyValuePair <int, ShenFuObjects> current2 = enumerator.get_Current();
                    GameObject shenFu = current2.get_Value().ShenFu;
                    GameFowCollector.SetObjVisibleByFow(shenFu, instance2, playerCamp);
                }
            }
            for (int k = 0; k < 3; k++)
            {
                if (k != playerCamp)
                {
                    List <PoolObjHandle <ActorRoot> > campBullet = instance.GetCampBullet(k);
                    int count2 = campBullet.get_Count();
                    for (int l = 0; l < count2; l++)
                    {
                        PoolObjHandle <ActorRoot> poolObjHandle = campBullet.get_Item(l);
                        if (poolObjHandle)
                        {
                            ActorRoot     handle2       = poolObjHandle.get_handle();
                            BulletWrapper bulletWrapper = handle2.ActorControl as BulletWrapper;
                            if (bulletWrapper.m_bVisibleByFow)
                            {
                                if (handle2.ObjID % instance2.InterpolateFrameIntervalBullet == num2)
                                {
                                    if (bulletWrapper.m_bVisibleByShape)
                                    {
                                        bulletWrapper.UpdateSubParObjVisibility(GameFowCollector.SetObjWithColVisibleByFow(poolObjHandle, instance2, playerCamp));
                                    }
                                    else
                                    {
                                        bulletWrapper.UpdateSubParObjVisibility(GameFowCollector.SetObjVisibleByFow(handle2.gameObject, instance2, playerCamp));
                                    }
                                }
                            }
                        }
                    }
                }
            }
            int count3 = this.VirtualParentParticles_.get_Count();

            for (int m = 0; m < count3; m++)
            {
                GameFowCollector.VirtualParticleAttachContext virtualParticleAttachContext = this.VirtualParentParticles_.get_Item(m);
                GameObject virtualParticle = this.VirtualParentParticles_.get_Item(m).VirtualParticle;
                if (!(virtualParticle == null))
                {
                    int num4 = virtualParticle.GetInstanceID();
                    if (num4 < 0)
                    {
                        num4 = -num4;
                    }
                    if ((long)num4 % (long)((ulong)instance2.InterpolateFrameIntervalBullet) == (long)((ulong)num))
                    {
                        if (virtualParticleAttachContext.bUseShape)
                        {
                            GameFowCollector.SetObjWithColVisibleByFowAttached(virtualParticle, instance2, playerCamp, this.VirtualParentParticles_.get_Item(m).AttachActor);
                        }
                        else
                        {
                            GameFowCollector.SetObjVisibleByFowAttached(virtualParticle, instance2, playerCamp, this.VirtualParentParticles_.get_Item(m).AttachActor);
                        }
                    }
                }
            }
        }