예제 #1
0
        protected override void Update(GameTime gameTime)
        {
            KeyboardState kbs = Keyboard.GetState();

            //initialize all logic
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            base.Update(gameTime);

            float elapsedSeconds = (float)gameTime.ElapsedGameTime.TotalSeconds;

            testTex.Update(elapsedSeconds);
            left.Update(GamePad.GetState(PlayerIndex.One));
            right.Update(GamePad.GetState(PlayerIndex.One));
            Vector2 index = Vector2.Zero;

            if (left.isPressesd())
            {
                index.X = -1;
            }
            else if (right.isPressesd())
            {
                index.X = 1;
            }
            player.Move(index, (float)gameTime.ElapsedGameTime.TotalSeconds);
            player.MultMov((float)gameTime.ElapsedGameTime.TotalSeconds);
            player.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
            onlineHelper.Update((float)gameTime.ElapsedGameTime.TotalSeconds);

            n***a.Update(kbs);
            spaceConnect.Update(kbs);
            enterkey.Update(kbs);
            if (enterkey.justPressed())
            {
                onlineHelper.SendMessage(new int[] { 0 }, "0 " + n***a.getString());
                n***a.Reset();
            }
            if (spaceConnect.justPressed())
            {
                onlineHelper.StartConnection(n***a.getString());
                n***a.Reset();
            }
            u.Update(kbs);
            r.Update(kbs);
            l.Update(kbs);
            d.Update(kbs);
            Vector2 input = new Vector2();

            if (u.isPressesd())
            {
                input.Y -= 3;
            }
            if (d.isPressesd())
            {
                input.Y += 3;
            }
            if (l.isPressesd())
            {
                input.X -= 3;
            }
            if (r.isPressesd())
            {
                input.X += 3;
            }
            player.Input(input);
            gaydude.Input(onlineHelper.input);
            //send input here, louis (wink)
            onlineHelper.SendMessage(new int[] { 0 }, "1 " + input.X + " " + input.Y);
        }
예제 #2
0
 public virtual void Update(float es_)
 {
     tex.Update(es_);
 }