コード例 #1
0
ファイル: Scenery.cs プロジェクト: idafi/heng
        Scenery(Gamestate oldState, GamestateBuilder newState)
        {
            Assert.Ref(oldState, newState);

            Scenery oldScenery = oldState.Scenery;

            sound = oldScenery.sound;

            InputDevice  device = oldState.Input.Devices[oldScenery.inputDevice];
            StaticBody   body   = (StaticBody)(oldState.Physics.PhysicsBodies[oldScenery.staticBody]);
            RectDrawable drw    = (RectDrawable)(oldState.Video.Drawables[oldScenery.rectDrawable]);
            SoundSource  src    = oldState.Audio.SoundSources[oldScenery.soundSource];

            if (device.GetButtonPressed("SoundTest"))
            {
                src = src.PlaySound(sound);
            }

            inputDevice  = newState.Input.AddDevice(device);
            staticBody   = newState.Physics.AddPhysicsObject(body);
            rectDrawable = newState.Video.AddDrawable(drw);
            soundSource  = newState.Audio.AddSoundSource(src);
        }