Exemplo n.º 1
0
        public void UpdateLogic(int delta)
        {
            Singleton <SceneManagement> .GetInstance().UpdateDirtyNodes();

            if (!this.m_bSoldierOverNum)
            {
                bool flag = true;
                for (int m = 0; m < this.soldierAreas.Count; m++)
                {
                    SoldierRegion region = this.soldierAreas[m];
                    if (region.isStartup)
                    {
                        SoldierSpawnResult result = region.UpdateLogicSpec(delta);
                        flag &= result != SoldierSpawnResult.ShouldWaitSoldierInterval;
                    }
                }
                if (flag)
                {
                    this.CheckSoldierOverNumUpper();
                }
            }
            else
            {
                this.CheckSoldierOverNumLower();
            }
            for (int i = 0; i < this.commonSpawnGroups.Count; i++)
            {
                CommonSpawnGroup group = this.commonSpawnGroups[i];
                if (group.isStartup)
                {
                    group.UpdateLogic(delta);
                }
            }
            for (int j = 0; j < this.spawnGroups.Count; j++)
            {
                SpawnGroup group2 = this.spawnGroups[j];
                if (group2.isStartup)
                {
                    group2.UpdateLogic(delta);
                }
            }
            int count = this.objTriggerMultiMap.Count;

            for (int k = 0; k < count; k++)
            {
                ObjTriggerKeyValuePair      pair     = this.objTriggerMultiMap[k];
                GameObject                  obj2     = pair.obj;
                ListView <AreaEventTrigger> triggers = pair.triggers;
                if (((obj2 != null) && obj2.activeSelf) && ((Singleton <FrameSynchr> .instance.CurFrameNum % 4) == (k % 4)))
                {
                    bool flag2 = false;
                    for (int n = 0; n < triggers.Count; n++)
                    {
                        AreaEventTrigger trigger = triggers[n];
                        if ((trigger != null) && trigger.isStartup)
                        {
                            trigger.UpdateLogic(delta * 4);
                            flag2 |= trigger.bDoDeactivating;
                        }
                    }
                    if (flag2)
                    {
                        for (int num7 = 0; num7 < triggers.Count; num7++)
                        {
                            AreaEventTrigger trigger2 = triggers[num7];
                            if (trigger2 != null)
                            {
                                trigger2.DoSelfDeactivating();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void Start()
 {
     foreach (FuncRegion region in base.GetComponentsInChildren <FuncRegion>(true))
     {
         if (((region == null) || (!region.enabled || !region.gameObject.activeInHierarchy)) || !region.gameObject.activeSelf)
         {
             continue;
         }
         if (region is ReviveRegion)
         {
             this.reviveAreas.Add(region as ReviveRegion);
             continue;
         }
         if (region is SoldierRegion)
         {
             this.soldierAreas.Add(region as SoldierRegion);
             continue;
         }
         if (region is CommonSpawnGroup)
         {
             this.commonSpawnGroups.Add(region as CommonSpawnGroup);
             continue;
         }
         if (region is SpawnGroup)
         {
             this.spawnGroups.Add(region as SpawnGroup);
             continue;
         }
         if (region is WaypointsHolder)
         {
             this.waypointsList.Add(region as WaypointsHolder);
             continue;
         }
         if (region is AreaEventTrigger)
         {
             AreaEventTrigger item = region as AreaEventTrigger;
             this.triggerList.Add(item);
             GameObject gameObject = region.gameObject;
             ListView <AreaEventTrigger> triggers = null;
             for (int i = this.objTriggerMultiMap.Count - 1; i >= 0; i--)
             {
                 ObjTriggerKeyValuePair pair = this.objTriggerMultiMap[i];
                 if (pair.obj == gameObject)
                 {
                     triggers = pair.triggers;
                     break;
                 }
             }
             if (triggers == null)
             {
                 triggers = new ListView <AreaEventTrigger>();
                 ObjTriggerKeyValuePair pair2 = new ObjTriggerKeyValuePair {
                     obj      = gameObject,
                     triggers = triggers
                 };
                 this.objTriggerMultiMap.Add(pair2);
             }
             triggers.Add(item);
             continue;
         }
         if (region is DynamicChannel)
         {
             this.channelList.Add(region as DynamicChannel);
         }
     }
     this.TrueMen = new List <PoolObjHandle <ActorRoot> >(Singleton <GameObjMgr> .GetInstance().SoldierActors);
 }