Exemplo n.º 1
0
        public void Update()
        {
            if (this._active && !this._ready && this._set.IsReady())
            {
                this._ready = true;
                this._set.Activate();
                foreach (string key in this._players.Keys)
                {
                    this._combatAIs.Add(key, new CombatAI(this._app, this._players[key], false, this._starsystem, (Dictionary <int, DiplomacyState>)null, true));
                }
            }
            if (!this._ready)
            {
                return;
            }
            List <IGameObject> gameObjectList = new List <IGameObject>();

            foreach (IGameObject postLoadedObject in this._postLoadedObjects)
            {
                if (postLoadedObject.ObjectStatus == GameObjectStatus.Ready)
                {
                    if (postLoadedObject is IActive)
                    {
                        (postLoadedObject as IActive).Active = true;
                    }
                    this._set.Add(postLoadedObject);
                    gameObjectList.Add(postLoadedObject);
                }
            }
            foreach (IGameObject gameObject in gameObjectList)
            {
                this._postLoadedObjects.Remove(gameObject);
            }
            DateTime now = DateTime.Now;

            if (now >= this._nextSwitchTime)
            {
                this._nextSwitchTime = now + TimeSpan.FromSeconds(5.0);
            }
            List <IGameObject> combatGameObjects = CombatAI.GetCombatGameObjects((IEnumerable <IGameObject>) this._set);

            foreach (CombatAI combatAi in this._combatAIs.Values)
            {
                combatAi.Update(combatGameObjects);
            }
        }