示例#1
0
        public override void reset()
        {
            base.reset();
            Game     game = Game.GAME_INSTANCE;
            Location l    = this.getLocation();

            l.addYaw(-game.getGamePad().AnalogRightX);
            l.addPitch(game.getGamePad().AnalogRightY);

            if (game.getGamePad().AnalogLeftX != 0)
            {
                Location clone = l.clone();
                clone.addYaw(90);
                double p = clone.getPitch();
                clone.setPitch(0);
                clone = clone.getRelativeInFacingDirection(-game.getGamePad().AnalogLeftX / 10.0);
                clone.addYaw(-90);
                clone.setPitch(p);
                l.set(clone);
            }

            if (game.getGamePad().AnalogLeftY != 0)
            {
                Location clone = l.clone();
                clone = clone.getRelativeInFacingDirection(-game.getGamePad().AnalogLeftY / 10.0);
                l.set(clone);
            }

            Location newTarget = l.getRelativeInFacingDirection(1);

            this.getTarget().set(newTarget);
            newTarget.Dispose();
        }
示例#2
0
        //Main Thread Method
        public void updateTexture()
        {
            if (Chat.getFrameBuffer(false) == null)
            {
                return;
            }
            if (Chat.getFrameBuffer(false).getFrameBuffer() == null)
            {
                return;
            }
            List <Model> models = new List <Model>();

            Camera talkerCamera = new Camera();

            ChatMessage cm;

            if ((cm = getCurrentMessage()) != null)
            {
                lock (cm) {
                    Talkable talker = cm.getTalker();
                    Model    m      = talker.getModel();
                    talkerCamera.getTarget().set(m.getLocation());
                    talkerCamera.getTarget().addY(1.75);

                    Location j = talkerCamera.getTarget().getAbsoluteLocation();
                    j.addYaw(-23);
                    Location q = j.getRelativeInFacingDirection(3);
                    j.Dispose();
                    //j.addX(-1.25).addY(0).addZ(2.8);
                    talkerCamera.getLocation().set(q);
                    q.Dispose();
                    lock (m) {
                        models.Add(talker.getModel());
                    }
                }
            }

            Color oldSky = DisplayManager.getDisplayManager().getClearColor();

            lock (talkerCamera) {
                DisplayManager.getDisplayManager().setClearColor(Color.RED.clone().setAlpha(0));
                DisplayManager.getDisplayManager().renderToBuffer(Chat.getFrameBuffer().getFrameBuffer(), models, talkerCamera);
                DisplayManager.getDisplayManager().setClearColor(oldSky);
            }
            talkerCamera.Dispose();
        }