Exemple #1
0
        private static bool TransmitDiseases(Player p1, Player p2)
        {
            if (p1.IsInfectedSame(p2))
            {
                return(false);
            }

            bool transmitted = false;

            int totalCount = (int)Diseases.Count;

            for (int diseaseIndex = 0; diseaseIndex < totalCount; ++diseaseIndex)
            {
                if (p1.IsInfected(diseaseIndex))
                {
                    transmitted |= p2.TryInfect(diseaseIndex);
                }
                else if (p2.IsInfected(diseaseIndex))
                {
                    transmitted |= p1.TryInfect(diseaseIndex);
                }
            }

            return(transmitted);
        }
        private static bool TransmitDiseases(Player p1, Player p2)
        {
            if (p1.IsInfectedSame(p2))
            {
                return false;
            }

            bool transmitted = false;

            int totalCount = (int)Diseases.Count;
            for (int diseaseIndex = 0; diseaseIndex < totalCount; ++diseaseIndex)
            {
                if (p1.IsInfected(diseaseIndex))
                {
                    transmitted |= p2.TryInfect(diseaseIndex);
                }
                else if (p2.IsInfected(diseaseIndex))
                {
                    transmitted |= p1.TryInfect(diseaseIndex);
                }
            }

            return transmitted;
        }
        private void DrawPlayer(Context context, Player player)
        {
            TextureImage image = TempFindPlayerImage(player);
            float drawX = player.GetPx() - 0.5f * cellWidth;
            float drawY = player.GetPy() - 0.5f * cellHeight;

            if (CVars.g_drawPlayerCell.boolValue)
            {
                context.DrawRect(player.GetCx() * cellWidth, player.GetCy() * cellHeight, cellWidth, cellHeight, Color.White);
            }

            if (CVars.g_drawPlayerMovable.boolValue)
            {
                context.DrawRect(drawX, drawY, cellWidth, cellHeight, Color.Yellow);
            }

            if (player.IsInfected())
            {
                if (blink)
                {
                    AnimationInstance anim = player.currentAnimation;
                    anim.Draw(context, drawX + 0.5f * cellWidth, drawY + cellHeight);
                }
            }
            else
            {
                AnimationInstance anim = player.currentAnimation;
                anim.Draw(context, drawX + 0.5f * cellWidth, drawY + cellHeight);
            }

            if (CVars.g_drawPlayerStepRect.boolValue)
            {
                int stepX = Math.Sign(player.px - player.CellCenterPx());
                int stepY = Math.Sign(player.py - player.CellCenterPy());

                bool hasStepX = stepX != 0;
                bool hasStepY = stepY != 0;

                int cx = player.GetCx();
                int cy = player.GetCy();

                if (hasStepX && hasStepY)
                {
                    DrawCellRect(context, cx + stepX, cy, Color.Yellow);
                    DrawCellRect(context, cx, cy + stepY, Color.Yellow);
                    DrawCellRect(context, cx + stepX, cy + stepY, Color.Yellow);
                }
                else if (hasStepX)
                {
                    DrawCellRect(context, cx + stepX, cy, Color.Yellow);
                }
                else if (hasStepY)
                {
                    DrawCellRect(context, cx, cy + stepY, Color.Yellow);
                }
            }
        }