Пример #1
0
        private bool stageUpdateFight()
        {
            List <Character> Team1, Team2;

            (Team1, Team2) = IsHost ? (TeamBlue, TeamRed) : (TeamRed, TeamBlue);
            (Team1, Team2) = (stageManager.CurrentRound & 1) == 0 ? (Team1, Team2) : (Team2, Team1);


            if (Team1.Count(e => !e.IsDead) == 0 || Team2.Count(e => !e.IsDead) == 0)
            {
                stageTimer.endTimer();
                return(true);
            }

            bool updateCanvas = false;

            foreach (Character character in Team1.Where(e => !e.IsDead))
            {
                updateCanvas = character.update() || updateCanvas;
            }

            foreach (Character character in Team2.Where(e => !e.IsDead))
            {
                updateCanvas = character.update() || updateCanvas;
            }


            if (nextTickTime < ElapsedTime)
            {
                nextTickTime = ((ElapsedTime / TICK_INTERVAL) + 1) * TICK_INTERVAL;
                foreach (Character character in Team1.Where(e => !e.IsDead))
                {
                    updateCanvas = character.tick() || updateCanvas;
                }
                foreach (Character character in Team2.Where(e => !e.IsDead))
                {
                    updateCanvas = character.tick() || updateCanvas;
                }
            }

            return(updateCanvas);
        }