示例#1
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.InitialScene);

            var animationService = WaveServices.GetService<AnimationService>();

            var gui = this.EntityManager.Find<Entity>("GUI");
            this.maxScore = gui.FindChild("maxscore").FindComponent<TextComponent>();
            this.currentScore = gui.FindChild("currentscore").FindComponent<TextComponent>();
            this.loadingEntity = gui.FindChild("loading");

            var tapToPlayEntity = gui.FindChild("taptoplay");
            var tapToPlay = tapToPlayEntity.FindComponent<TouchGestures>();
            tapToPlay.TouchTap += this.TapToPlayTouchTap;

            animationService.CreatePulseAnimation(tapToPlayEntity, 350).Run();

            var player = this.EntityManager.Find("sceneEntity.player");
            animationService.CreateIdleAnimation(player, 175).Run();

            WaveServices.GetService<AudioService>().Play(Audio.Music.MrJellyRolls_mp3, 0.3f);
        }
        protected override void ResolveDependencies()
        {
            base.ResolveDependencies();
            this.firstUpdate = true;

            this.animationService = WaveServices.GetService<AnimationService>();
            this.audioService = WaveServices.GetService<AudioService>();

            var gui = this.EntityManager.Find<Entity>("GUI");
            this.scoreControl = gui.FindChild("currentscore").FindComponent<TextComponent>();

            var gameController = this.EntityManager.Find("GameController");
            this.terrainGeneratorBehavior = gameController.FindComponent<TerrainGeneratorBehavior>();

            this.leftOrientation = Quaternion.CreateFromYawPitchRoll(MathHelper.PiOver2, 0f, 0f);
            this.rightOrientation = Quaternion.CreateFromYawPitchRoll(-MathHelper.PiOver2, 0f, 0f);
            this.upOrientation = Quaternion.CreateFromYawPitchRoll(0f, 0f, 0f);
            this.downOrientation = Quaternion.CreateFromYawPitchRoll(MathHelper.Pi, 0f, 0f);

            this.desiredOrientation = upOrientation;
            this.currentOrientation = this.desiredOrientation;

            this.desiredScale = Vector3.One;
            this.currentScale = this.desiredScale;

            this.jumpSounds = new Audio.Sfx[] { Audio.Sfx.jump1_wav, Audio.Sfx.jump2_wav, Audio.Sfx.jump3_wav };
        }