Exemplo n.º 1
0
Arquivo: Player.cs Projeto: LMY/yuPong
        public Player(GameStateMatch g, Character c, Pad p, Input i, Appearance app)
        {
            game = g;

            character            = c;
            thePad               = p;
            input                = i;
            thePad.theAppearance = app;
            cooldowns            = new int[character.SpecialMovesN];

            healthbar = null;
        }
Exemplo n.º 2
0
        public Pad(Level level, int playerNumber, Appearance app)
            : base(app)
        {
            const float rear_spacing = 1.0f;

            friction_constant = Pad.friction_constant_default;

            Size = new Vector3(0.2f, 2.0f, 0.6f);

            playn = playerNumber;
            if (playerNumber == 0)
            {
                Center = new Vector3(level.SizeX / 2 - rear_spacing - Size.X / 2, 0, 0);
            }
            else if (playerNumber == 1)
            {
                Center = new Vector3(-level.SizeX / 2 + rear_spacing + Size.X / 2, 0, 0);
            }

            setLight();

            Mass = 500;
        }
Exemplo n.º 3
0
 public Box(Appearance app, Vector3 c) : base(c)
 {
     size       = new Vector3(1, 1, 1);
     appearance = app; // Color4.DarkSlateBlue;
 }
Exemplo n.º 4
0
 public Box(Appearance app) : this(app, Vector3.Zero)
 {
 }
Exemplo n.º 5
0
        public GameStateMatch(Character char1, Character char2, bool human1, bool human2, MatchType type)
        {
            matchtype = type;
            won_p1    = won_p2 = 0;

            pause = true;

            GL.Enable(EnableCap.Texture2D);
            GL.ShadeModel(ShadingModel.Smooth);
            GL.ClearDepth(1.0f);

            GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);

            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);
            GL.ColorMaterial(MaterialFace.FrontAndBack, ColorMaterialParameter.AmbientAndDiffuse);
            GL.Enable(EnableCap.ColorMaterial);
            GL.Enable(EnableCap.Blend);

//            GL.DepthFunc(DepthFunction.Lequal);
            GL.Enable(EnableCap.DepthTest);
//            human2 = true;


            Appearance.init();

            lvl = new Level();

            pads    = new Pad[2];
            pads[0] = new Pad(lvl, 0, Appearance.PongGenericAppearance);
            pads[1] = new Pad(lvl, 1, Appearance.PongGenericAppearance);

            balls          = new Ball[1];
            balls[0]       = new Ball();
            balls[0].Speed = Vector3.UnitX * 7;

            if (human1)
            {
                player1 = new Player(this, char1, pads[0], InputHuman.input1, char1.DefaultAppearance);
            }
            else
            {
                player1 = new Player(this, char1, pads[0], new InputAI(), char1.DefaultAppearance);
            }

            if (human2)
            {
                player2 = new Player(this, char2, pads[1], InputHuman.input2, char2.DefaultAppearance);
            }
            else
            {
                player2 = new Player(this, char2, pads[1], new InputAI(), char2.DefaultAppearance);
            }


            theEvents    = new GameEventList();
            theFieldlist = new FieldList();

            const float hbarsize = 0.85f;

            player1.Healthbar = new Healthbar(new Vector3(lvl.SizeX / 2 - hbarsize / 2 * lvl.SizeX / 2, lvl.SizeY / 2 * 1.2f, 0), false, new Vector3(lvl.SizeX / 2 * hbarsize, 0.4f, 1));
            player2.Healthbar = new Healthbar(new Vector3(-lvl.SizeX / 2 + hbarsize / 2 * lvl.SizeX / 2, lvl.SizeY / 2 * 1.2f, 0), true, new Vector3(lvl.SizeX / 2 * hbarsize, 0.4f, 1));



            GL.Enable(EnableCap.Lighting);      // Let there Be Light

            float R0 = pads[0].theAppearance.Color.R;
            float G0 = pads[0].theAppearance.Color.G;
            float B0 = pads[0].theAppearance.Color.B;

            float R1 = pads[1].theAppearance.Color.R;
            float G1 = pads[1].theAppearance.Color.G;
            float B1 = pads[1].theAppearance.Color.B;

            const float light_height = 12.5f;

            light5_ambient  = new Color4(0.6f, 0.6f, 0.6f, 1);
            light5_diffuse  = new Color4(0.6f, 0.6f, 0.6f, 1);
            light5_specular = new Color4(1.0f, 1.0f, 1.0f, 1);
            light5_pos      = new Vector4(lvl.SizeX / 4, 0, light_height, 1);
            light5_dir      = new Vector4(0, 0, -1, 0);

            light6_ambient  = new Color4(0.6f, 0.6f, 0.6f, 1);
            light6_diffuse  = new Color4(0.6f, 0.6f, 0.6f, 1);
            light6_specular = new Color4(1.0f, 1.0f, 1.0f, 1);

            light6_pos = new Vector4(-lvl.SizeX / 4, 0, light_height, 1);
            light6_dir = new Vector4(0, 0, -1, 0);

            SetAmbientLight();
            GL.Enable(EnableCap.Light5);
            GL.Enable(EnableCap.Light6);

            ResetRound();

            pause = false;
        }