示例#1
0
 private void Start()
 {
     FuncRegion[] componentsInChildren = base.GetComponentsInChildren <FuncRegion>(true);
     for (int i = 0; i < componentsInChildren.Length; i++)
     {
         FuncRegion funcRegion = componentsInChildren[i];
         if (!(funcRegion == null))
         {
             if (funcRegion.enabled && funcRegion.gameObject.activeInHierarchy && funcRegion.gameObject.activeSelf)
             {
                 if (funcRegion is ReviveRegion)
                 {
                     this.reviveAreas.Add(funcRegion as ReviveRegion);
                 }
                 else if (funcRegion is SoldierRegion)
                 {
                     this.soldierAreas.Add(funcRegion as SoldierRegion);
                 }
                 else if (funcRegion is CommonSpawnGroup)
                 {
                     this.commonSpawnGroups.Add(funcRegion as CommonSpawnGroup);
                 }
                 else if (funcRegion is SpawnGroup)
                 {
                     this.spawnGroups.Add(funcRegion as SpawnGroup);
                 }
                 else if (funcRegion is WaypointsHolder)
                 {
                     this.waypointsList.Add(funcRegion as WaypointsHolder);
                 }
                 else if (funcRegion is AreaEventTrigger)
                 {
                     AreaEventTrigger areaEventTrigger = funcRegion as AreaEventTrigger;
                     this.triggerList.Add(areaEventTrigger);
                     GameObject gameObject = funcRegion.gameObject;
                     ListView <AreaEventTrigger> listView = null;
                     for (int j = this.objTriggerMultiMap.get_Count() - 1; j >= 0; j--)
                     {
                         MapWrapper.ObjTriggerKeyValuePair objTriggerKeyValuePair = this.objTriggerMultiMap.get_Item(j);
                         if (objTriggerKeyValuePair.obj == gameObject)
                         {
                             listView = objTriggerKeyValuePair.triggers;
                             break;
                         }
                     }
                     if (listView == null)
                     {
                         listView = new ListView <AreaEventTrigger>();
                         this.objTriggerMultiMap.Add(new MapWrapper.ObjTriggerKeyValuePair
                         {
                             obj      = gameObject,
                             triggers = listView
                         });
                     }
                     listView.Add(areaEventTrigger);
                 }
                 else if (funcRegion is DynamicChannel)
                 {
                     this.channelList.Add(funcRegion as DynamicChannel);
                 }
             }
         }
     }
     this.TrueMen = new List <PoolObjHandle <ActorRoot> >(Singleton <GameObjMgr> .GetInstance().SoldierActors);
 }
示例#2
0
        public void UpdateLogic(int delta)
        {
            Singleton <SceneManagement> .GetInstance().UpdateDirtyNodes();

            if (!this.m_bSoldierOverNum)
            {
                bool flag  = true;
                int  count = this.soldierAreas.get_Count();
                for (int i = 0; i < count; i++)
                {
                    SoldierRegion soldierRegion = this.soldierAreas.get_Item(i);
                    if (soldierRegion.isStartup)
                    {
                        SoldierSpawnResult soldierSpawnResult = soldierRegion.UpdateLogicSpec(delta);
                        flag &= (soldierSpawnResult != SoldierSpawnResult.ShouldWaitSoldierInterval);
                    }
                }
                if (flag)
                {
                    this.CheckSoldierOverNumUpper();
                }
            }
            else
            {
                this.CheckSoldierOverNumLower();
            }
            int count2 = this.commonSpawnGroups.get_Count();

            for (int j = 0; j < count2; j++)
            {
                CommonSpawnGroup commonSpawnGroup = this.commonSpawnGroups.get_Item(j);
                if (commonSpawnGroup.isStartup)
                {
                    commonSpawnGroup.UpdateLogic(delta);
                }
            }
            for (int k = 0; k < this.spawnGroups.get_Count(); k++)
            {
                SpawnGroup spawnGroup = this.spawnGroups.get_Item(k);
                if (spawnGroup.isStartup)
                {
                    spawnGroup.UpdateLogic(delta);
                }
            }
            int count3 = this.objTriggerMultiMap.get_Count();

            for (int l = 0; l < count3; l++)
            {
                MapWrapper.ObjTriggerKeyValuePair objTriggerKeyValuePair = this.objTriggerMultiMap.get_Item(l);
                GameObject obj = objTriggerKeyValuePair.obj;
                ListView <AreaEventTrigger> triggers = objTriggerKeyValuePair.triggers;
                if (obj != null && obj.activeSelf && (ulong)(Singleton <FrameSynchr> .get_instance().CurFrameNum % 4u) == (ulong)((long)(l % 4)))
                {
                    bool flag2  = false;
                    int  count4 = triggers.get_Count();
                    for (int m = 0; m < count4; m++)
                    {
                        AreaEventTrigger areaEventTrigger = triggers.get_Item(m);
                        if (areaEventTrigger != null && areaEventTrigger.isStartup)
                        {
                            areaEventTrigger.UpdateLogic(delta * 4);
                            flag2 |= areaEventTrigger.bDoDeactivating;
                        }
                    }
                    if (flag2)
                    {
                        for (int n = 0; n < count4; n++)
                        {
                            AreaEventTrigger areaEventTrigger2 = triggers.get_Item(n);
                            if (areaEventTrigger2 != null)
                            {
                                areaEventTrigger2.DoSelfDeactivating();
                            }
                        }
                    }
                }
            }
        }