Пример #1
0
        public void Update(float deltaTime)
        {
            if (NextSyncTime >= 10 * 1000)
            {
                Send(new GameTimerMessage(0, GameTime / 1000f));
                NextSyncTime = 0;
            }

            BlueTeam.Update(deltaTime);
            PurpleTeam.Update(deltaTime);
            NeutralTeam.Update(deltaTime);
            Map.Update(deltaTime);


            DelayedActions.RemoveAll(x => x.Finalized);

            foreach (var action in DelayedActions)
            {
                action.Update(deltaTime);
            }

            foreach (var unit in UnitsToRemove)
            {
                Map.RemoveUnit(unit);
                unit.Team.RemoveUnit(unit);
                unit.DefineTeam(null);
                unit.DefineGame(null);
                unit.Disposed       = true;
                unit.PendingDispose = false;
            }

            UnitsToRemove.Clear();
        }
Пример #2
0
 public void DestroyUnit(Unit unit)
 {
     if (unit.Disposed || unit.PendingDispose)
     {
         logger.Write("Attempt to dispose " + unit + " failed. Already disposed", MessageState.ERROR);
         return;
     }
     unit.PendingDispose = true;
     UnitsToRemove.Add(unit);
 }
Пример #3
0
        public void Update(float deltaTime)
        {
            if (NextSyncTime >= 10 * 1000)
            {
                Send(new GameTimerMessage(0, GameTime / 1000f));
                NextSyncTime = 0;
            }


            BlueTeam.Update(deltaTime);
            PurpleTeam.Update(deltaTime);
            NeutralTeam.Update(deltaTime);
            Map.Update(deltaTime);

            foreach (var unit in UnitsToRemove)
            {
                Map.RemoveUnit(unit);
                unit.Team.RemoveUnit(unit);
                unit.DefineTeam(null);
                unit.DefineGame(null);
            }

            UnitsToRemove.Clear();
        }
Пример #4
0
 public void DestroyUnit(Unit unit)
 {
     UnitsToRemove.Add(unit);
 }