Пример #1
0
 public void DoSelfDeactivating()
 {
     this.bDoDeactivating = false;
     int num = 0;
     Dictionary<uint, STriggerContext>.Enumerator enumerator = this._inActors.GetEnumerator();
     while (enumerator.MoveNext())
     {
         KeyValuePair<uint, STriggerContext> current = enumerator.Current;
         this._actorTormvCache[num++] = current.Key;
     }
     for (int i = 0; i < num; i++)
     {
         uint key = this._actorTormvCache[i];
         STriggerContext context = this._inActors[key];
         PoolObjHandle<ActorRoot> actor = context.actor;
         this.DoActorLeave(ref actor);
         this._inActors.Remove(key);
     }
     this.DeactivateSelf();
     this.ActivateNext();
 }
Пример #2
0
        private void UpdateLogicEnterLeave(int delta)
        {
            this._testToken++;
            int collidingActors = this.GetCollidingActors();

            for (int i = 0; (i < collidingActors) && (i < this.Capacity); i++)
            {
                PoolObjHandle <ActorRoot> inActor = this._actorTestCache[i];
                uint objID = inActor.handle.ObjID;
                if (this._inActors.ContainsKey(objID))
                {
                    STriggerContext context = this._inActors[objID];
                    context.token = this._testToken;
                    if (this.UpdateInterval > 0)
                    {
                        context.updateTimer -= delta;
                        if (context.updateTimer <= 0)
                        {
                            context.updateTimer = this.UpdateInterval;
                            this.DoActorUpdate(ref inActor);
                        }
                    }
                    this._inActors[objID] = context;
                    continue;
                }
                if ((this.TriggerTimes <= 0) || (this.m_triggeredCount < this.TriggerTimes))
                {
                    if (((this.InActorCount + 1) >= this.Capacity) && (this.actionWhenFull == ActionWhenFull.Destroy))
                    {
                        this.DoSelfDeactivating();
                        return;
                    }
                    bool flag = false;
                    if (this.bTriggerByTeam)
                    {
                        if (this._inActorsCache == null)
                        {
                            this._inActorsCache = new Dictionary <uint, int>();
                        }
                        if (this._inActorsCache.ContainsKey(objID))
                        {
                            this._inActorsCache[objID] = this._testToken;
                        }
                        else
                        {
                            this._inActorsCache.Add(objID, this._testToken);
                            ReadonlyContext <PoolObjHandle <ActorRoot> > allHeroes = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().GetAllHeroes();

                            bool flag2 = true;
                            for (int k = 0; k < allHeroes.Count; k++)
                            {
                                PoolObjHandle <ActorRoot> handle3 = allHeroes[k];
                                if (!this._inActorsCache.ContainsKey(handle3.handle.ObjID))
                                {
                                    PoolObjHandle <ActorRoot> handle4 = allHeroes[k];
                                    if (!handle4.handle.ActorControl.IsDeadState)
                                    {
                                        flag2 = false;
                                        break;
                                    }
                                }
                            }
                            if (flag2)
                            {
                                flag = true;
                            }
                        }
                    }
                    else
                    {
                        flag = true;
                    }
                    if (flag)
                    {
                        DictionaryView <TriggerActionBase, RefParamOperator> inRefParams = this.DoActorEnter(ref inActor);
                        this._inActors.Add(inActor.handle.ObjID, new STriggerContext(inActor, this._testToken, inRefParams, this.UpdateInterval));
                        if (this.UpdateInterval > 0)
                        {
                            this.DoActorUpdate(ref inActor);
                        }
                        if ((++this.m_triggeredCount >= this.TriggerTimes) && (this.TriggerTimes > 0))
                        {
                            this.bDoDeactivating = this.bDeactivateSelf;
                        }
                    }
                }
            }
            int num5 = 0;

            Dictionary <uint, STriggerContext> .Enumerator enumerator = this._inActors.GetEnumerator();
            while (enumerator.MoveNext())
            {
                KeyValuePair <uint, STriggerContext> current = enumerator.Current;
                if (current.Value.token != this._testToken)
                {
                    KeyValuePair <uint, STriggerContext> pair2 = enumerator.Current;
                    this._actorTormvCache[num5++] = pair2.Key;
                }
            }
            for (int j = 0; j < num5; j++)
            {
                uint                      key      = this._actorTormvCache[j];
                STriggerContext           context4 = this._inActors[key];
                PoolObjHandle <ActorRoot> actor    = context4.actor;
                this.DoActorLeave(ref actor);
                this._inActors.Remove(key);
            }
            if (this._inActorsCache != null)
            {
                num5 = 0;
                Dictionary <uint, int> .Enumerator enumerator2 = this._inActorsCache.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    KeyValuePair <uint, int> pair3 = enumerator2.Current;
                    if (pair3.Value != this._testToken)
                    {
                        KeyValuePair <uint, int> pair4 = enumerator2.Current;
                        this._actorTormvCache[num5++] = pair4.Key;
                    }
                }
                for (int m = 0; m < num5; m++)
                {
                    this._inActorsCache.Remove(this._actorTormvCache[m]);
                }
            }
        }