Exemple #1
0
        public void Draw(Camera camera, Viewport view, SpriteBatch spriteBatch)
        {
            if (preMatch)
            {
                if (camera == One.Camera)
                {
                    rpsOne.Draw(view);
                }
                else
                {
                    rpsTwo.Draw(view);
                }
            }
            else
            {
                if (meadowField != null)
                {
                    meadowField.DrawField(camera);
                }

                if (iceField != null)
                {
                    iceField.Draw(camera);

                    if (!isFinished)
                    {
                        Ball.Instance.Draw(camera);
                    }
                }

                if (waterField != null)
                {
                    waterField.Draw(camera);

                    if (!isFinished)
                    {
                        Ball.Instance.Draw(camera);
                    }
                }

                if (meadowField != null)
                {
                    if (!isFinished)
                    {
                        Ball.Instance.Draw(camera);
                    }

                    meadowField.Draw(camera);
                }

                if (pinguinOne != null && pinguinTwo != null)
                {
                    pinguinOne.Draw(camera);
                    pinguinTwo.Draw(camera);
                }

                if (bumblebeeOne != null && bumblebeeTwo != null)
                {
                    bumblebeeOne.Draw(camera);
                    bumblebeeTwo.Draw(camera);
                }

                if (dolphinOne != null && dolphinTwo != null)
                {
                    dolphinOne.Draw(camera);
                    dolphinTwo.Draw(camera);
                }

                if (camera == One.Camera)
                {
                    if (!isFinished)
                    {
                        if (pinguinOne != null)
                        {
                            pinguinOne.DrawArrow(camera);
                        }

                        if (bumblebeeOne != null)
                        {
                            bumblebeeOne.DrawArrow(camera);
                        }

                        if (dolphinOne != null)
                        {
                            dolphinOne.DrawArrow(camera);
                        }

                        Vector2 temp = new Vector2(view.X + pointsImage.Width / 4 + ((view.Width - pointsImage.Width) / 2), 0);

                        GameStateManager.Instance.SpriteBatch.Draw(pointsImage, temp, null, Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0);

                        Vector2 text = One.Font2.MeasureString(One.Points.ToString());
                        GameStateManager.Instance.SpriteBatch.DrawString(One.Font2, One.Points.ToString(), temp + new Vector2((pointsImage.Width / 2 - text.X) / 2, (pointsImage.Height / 2 - text.Y) / 2), Color.White);

                        if (Two.Points == maxPoints - 1 || One.Points == maxPoints - 1 && ((Two.Points != maxPoints - 1) || (One.Points != maxPoints)))
                        {
                            Vector2 temp2 = new Vector2(temp.X + (pointsImage.Width / 2) + 12, 0);
                            float   scale = (float)(((float)(GameStateManager.Instance.GraphicsDeviceManager.PreferredBackBufferWidth / 2 - pointsImage.Width / 2 - 24)) / matchball.Width);
                            GameStateManager.Instance.SpriteBatch.Draw(matchball, temp2, null, Color.White, 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0);
                        }

                        if (One.Points == maxPoints - 1)
                        {
                            GameStateManager.Instance.SpriteBatch.DrawString(One.Font2, One.Points.ToString(), temp + new Vector2((pointsImage.Width / 2 - text.X) / 2, (pointsImage.Height / 2 - text.Y) / 2), Color.Yellow);
                        }
                    }
                    else
                    {
                        if (winner == One)
                        {
                            winnerImage.Position = new Vector2(view.X + (view.Width - winnerImage.SourceRect.Width) / 2, 100);
                            winnerImage.Draw(GameStateManager.Instance.SpriteBatch);
                        }
                        else
                        {
                            looserImage.Position = new Vector2(view.X + (view.Width - looserImage.SourceRect.Width) / 2, 100);
                            looserImage.Draw(GameStateManager.Instance.SpriteBatch);
                        }
                    }
                }
                else
                {
                    if (camera == Two.Camera)
                    {
                        if (!isFinished)
                        {
                            if (pinguinTwo != null)
                            {
                                pinguinTwo.DrawArrow(camera);
                            }

                            if (bumblebeeTwo != null)
                            {
                                bumblebeeTwo.DrawArrow(camera);
                            }

                            if (dolphinTwo != null)
                            {
                                dolphinTwo.DrawArrow(camera);
                            }

                            Vector2 temp = new Vector2(view.X + pointsImage.Width / 4 + ((view.Width - pointsImage.Width) / 2), 0);

                            GameStateManager.Instance.SpriteBatch.Draw(pointsImage, temp, null, Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0);

                            Vector2 text = Two.Font2.MeasureString(Two.Points.ToString());
                            GameStateManager.Instance.SpriteBatch.DrawString(Two.Font2, Two.Points.ToString(), temp + new Vector2((pointsImage.Width / 2 - text.X) / 2, (pointsImage.Height / 2 - text.Y) / 2), Color.White);


                            if (Two.Points == maxPoints - 1)
                            {
                                GameStateManager.Instance.SpriteBatch.DrawString(Two.Font2, Two.Points.ToString(), temp + new Vector2((pointsImage.Width / 2 - text.X) / 2, (pointsImage.Height / 2 - text.Y) / 2), Color.Yellow);
                            }
                        }
                        else
                        {
                            if (winner == Two)
                            {
                                winnerImage.Position = new Vector2(view.X + (view.Width - winnerImage.SourceRect.Width) / 2, 100);
                                winnerImage.Draw(GameStateManager.Instance.SpriteBatch);
                            }
                            else
                            {
                                looserImage.Position = new Vector2(view.X + (view.Width - looserImage.SourceRect.Width) / 2, 100);
                                looserImage.Draw(GameStateManager.Instance.SpriteBatch);
                            }
                        }
                    }
                }

                if (change_size)
                {
                    changeSizePlus.Draw(camera);
                    changeSizeMinus.Draw(camera);
                }

                if (change_velocity)
                {
                    changeVelocityPlus.Draw(camera);
                    changeVelocityMinus.Draw(camera);
                }

                if (isFinished)
                {
                    if (GameScreen.Instance.Timer > 200)
                    {
                        text.Draw(spriteBatch);
                    }
                }
            }
        }