/// <summary>
        /// Resolves the dependencies needed for this instance to work.
        /// </summary>
        protected override void ResolveDependencies()
        {
            // Register Noesis service
            NoesisService svc = WaveServices.GetService <NoesisService>();

            if (svc == null)
            {
                WaveServices.RegisterService(new NoesisService());
            }

            base.ResolveDependencies();

            this.camera = this.Owner.FindComponent <Camera>(false);

#if OPENGL
            if (this.usingOpenGL)
            {
                GL.GetInteger(GetPName.MaxTextureImageUnits, out this.maxTextureUnits);
            }
#endif

#if ANDROID
            var activityManager = (ActivityManager)(Game.Current.Application as Activity).GetSystemService(Android.Content.Context.ActivityService);
            var version         = activityManager.DeviceConfigurationInfo.GlEsVersion;

            this.disableSamplers = !version.StartsWith("2");
#elif OPENGL
            this.disableSamplers = true;
#endif
        }
Exemplo n.º 2
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            WaveServices.RegisterService(new SpatialInputService());
            WaveServices.RegisterService(new KeywordRecognizerService());
        }
Exemplo n.º 3
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            // Load storage game data
            GameStorage gameStorage;

            if (WaveServices.Storage.Exists <GameStorage>())
            {
                gameStorage = WaveServices.Storage.Read <GameStorage>();
            }
            else
            {
                gameStorage = new GameStorage();
            }

            Catalog.RegisterItem <GameStorage>(gameStorage);

            // Register the SoundManager service
            WaveServices.RegisterService <SoundManager>(new SoundManager());

            // Play background music
            WaveServices.MusicPlayer.Play(new MusicInfo(WaveContent.Assets.Audio.bg_music_mp3));
            WaveServices.MusicPlayer.IsRepeat = true;

            // GameBackContext is visible always at the background.
            // For this reason the behavior is set to Draw and Update when the scene is in background.
            var backContext = new ScreenContext("GameBackContext", new GameScene());

            backContext.Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground;

            //On init show the Main menu
            WaveServices.ScreenContextManager.Push(backContext);
            WaveServices.ScreenContextManager.Push(new ScreenContext("MenuContext", new MenuScene()));
        }
Exemplo n.º 4
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

#if DEBUG
            if (WaveServices.Storage.Exists <GameStorage>())
            {
                WaveServices.Storage.Delete <GameStorage>();
            }
#endif

            // Load storage game data
            if (WaveServices.Storage.Exists <GameStorage>())
            {
                _gameStorage = WaveServices.Storage.Read <GameStorage>();
            }
            else
            {
                _gameStorage = new GameStorage
                {
                    IsMusicEnabled   = true,
                    AreSoundsEnabled = true,
                    Record           = 0
                };
            }
            Catalog.RegisterItem(_gameStorage);

            WaveServices.RegisterService(new SimpleSoundService());

            StartMusic();

            var screenContext = new ScreenContext(new MainMenuScene(), new PlayersPopupScene(), new RulesScene());
            var transition    = new ColorFadeTransition(Color.White, TimeSpan.FromSeconds(1));
            WaveServices.ScreenContextManager.To(screenContext, transition);
        }
Exemplo n.º 5
0
        private void InitializeAndRegisterSocialService()
        {
            var socialService = new SocialService();

            socialService.Initialize(null);

            WaveServices.RegisterService(socialService);
        }
Exemplo n.º 6
0
        private void InitializeSocialService()
        {
            _socialService = new WaveEngine.Framework.Services.SocialService
            {
                ////SimulationMode = true
            };

            WaveServices.RegisterService(_socialService);
        }
Exemplo n.º 7
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            ScreenContext screenContext = new ScreenContext(new MyScene());

            WaveServices.ScreenContextManager.To(screenContext);

            WaveServices.RegisterService <SteamVR_Service>(new SteamVR_Service());
        }
Exemplo n.º 8
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            WaveServices.RegisterService(new SpatialMappingService()
            {
                TrianglesPerCubicMeter = 500, ObtainNormals = false
            });
            WaveServices.RegisterService(new SpatialInputService());
            WaveServices.RegisterService(new KeywordRecognizerService());
        }
Exemplo n.º 9
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            ScreenContext screenContext = new ScreenContext(new MyScene());

            WaveServices.ScreenContextManager.To(screenContext);

            string liscenseKey = "Afv3YtH/////AAAAAd6O5swHskO5iA9kEPTrLhUfL0+AXF0Kmbc37H865djR8OyOWZxNgHLluSS1NML85StoInIgPw/UPEmcMfjV6KNwSn/enTSseboJxd8zrYfPY8v4iuhuZlyJ7K918/xnwDUS17Qx3o/6Fx2eVqU4puzoZNsLoMhpFTZbBgrpbZ5aCsLhz0jxsVZO729c6EXPZvMgLDaseU3DRgbSbk4cnn8LiQNhpeYVo5sxl3eqZKnu4HyDLhdCuGdtKEOChFKQShd7QcXnlxijV7+q6j1yI8GP8H75YFg5kYXf5nDquvbOGX7tXU17E/x62mRW+U0rJJ9ZYCQ857eo+PPKL4ZsEpAvGURGYpeSxtFgH0L8uyQ0";

            WaveServices.RegisterService(new VuforiaService(WaveContent.Assets.AR.TestVuforia_xml, liscenseKey));
        }
Exemplo n.º 10
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            WaveServices.RegisterService(new ScoreService());
            WaveServices.RegisterService(new AnimationService());
            WaveServices.RegisterService(new AudioService());

            ScreenContext screenContext = new ScreenContext(new InitialScene());

            WaveServices.ScreenContextManager.To(screenContext);
        }
Exemplo n.º 11
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            var navigationService = new NavigationService();

            WaveServices.RegisterService(navigationService);

            WaveServices.ScreenContextManager.SetDiagnosticsActive(true);

            navigationService.StartNavigation();
        }
Exemplo n.º 12
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            LeapMotionService leapMotionService = new LeapMotionService();

            WaveServices.RegisterService(leapMotionService);
            leapMotionService.StartSensor(LeapFeatures.Hands | LeapFeatures.CameraImages);

            ScreenContext screenContext = new ScreenContext(new MyScene());

            WaveServices.ScreenContextManager.To(screenContext);
        }
Exemplo n.º 13
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

#if WINDOWS
            //Register oculus rift service
            WaveServices.RegisterService <WaveEngine.OculusRift.OVRService>(new WaveEngine.OculusRift.OVRService(application));
#endif
            WaveServices.RegisterService <HeadTrackSensor>(new HeadTrackSensor());

            ScreenContext screenContext = new ScreenContext(new MyScene());
            WaveServices.ScreenContextManager.To(screenContext);
        }
Exemplo n.º 14
0
        private void Disconnect()
        {
            networkService.Disconnect();
            WaveServices.SoundPlayer.StopAllSounds();
            //We create a new scene of the same class (myscene, playablescene, test, etc.) of the current scene
            WaveServices.UnregisterService <NetworkService>();
            WaveServices.RegisterService(new NetworkService());

            Scene         newScene      = Activator.CreateInstance(this.GetType()) as Scene;
            ScreenContext screenContext = new ScreenContext(newScene);

            WaveServices.ScreenContextManager.To(screenContext);
        }
Exemplo n.º 15
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            // Register KinectServices
            var kinectService = new KinectService();

            WaveServices.RegisterService(kinectService);
            kinectService.StartSensor(KinectSources.Color | KinectSources.Body | KinectSources.Face);

            ScreenContext screenContext = new ScreenContext(new MyScene());

            WaveServices.ScreenContextManager.To(screenContext);
        }
Exemplo n.º 16
0
        public override void Initialize(IApplication application)
        {
            SerializerFactory.DefaultSerializationType = SerializationType.DATACONTRACT;
            base.Initialize(application);

            var navigationManager = new NavigationManager();

            WaveServices.RegisterService(new StorageService());
            WaveServices.RegisterService(new AnimationService());
            WaveServices.RegisterService(new AudioService());
            WaveServices.RegisterService(new GamePlayManager());
            WaveServices.RegisterService(navigationManager);

            navigationManager.InitialNavigation();
        }
Exemplo n.º 17
0
        /// <summary>
        /// Initializes the game according to the passed application (thus adapter).
        ///             The adapter implementation depends on the while-running platform.
        ///             Such method acts as the bridge between the game and the final hardware.
        /// </summary>
        /// <param name="application">The application (adapter).</param>
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            // ViewportManager is used to automatically adapt resolution to fit screen size
            ViewportManager vm = WaveServices.ViewportManager;

            vm.Activate(1280, 720, ViewportManager.StretchMode.Uniform);

            WaveServices.RegisterService(new KinectService());

            ScreenContext screenContext = new ScreenContext(new MyScene());

            WaveServices.ScreenContextManager.To(screenContext);
        }
Exemplo n.º 18
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);
            Models.Obstacles.Load();
            WaveServices.RegisterService(new KeyPress());

            var screenContext = new ScreenContext(new WaveEngineScene());

            WaveServices.ScreenContextManager.To(screenContext);

            MusicPlayer musicPlayer = WaveServices.MusicPlayer;

            musicPlayer.Play(new MusicInfo(WaveContent.Assets.Music.music_mp3));
            musicPlayer.IsRepeat = true;
        }
Exemplo n.º 19
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            application.Adapter.DefaultOrientation    = DisplayOrientation.Portrait;
            application.Adapter.SupportedOrientations = DisplayOrientation.Portrait;

#if ANDROID
            InitializeAndRegisterSocialService();
#endif

            // Load storage game data
            GameStorage gameStorage;
            if (WaveServices.Storage.Exists <GameStorage>())
            {
                gameStorage = WaveServices.Storage.Read <GameStorage>();
            }
            else
            {
                gameStorage = new GameStorage();
            }

            Catalog.RegisterItem(gameStorage);

            // Register the SoundManager service
            WaveServices.RegisterService <SoundManager>(new SoundManager());

            // Use ViewportManager to ensure scaling in all devices
            ViewportManager vm = WaveServices.ViewportManager;
            vm.Activate(768, 1024, ViewportManager.StretchMode.Uniform);

            var backContext = new ScreenContext("BackContext", new BackgroundScene())
            {
                Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground
            };

            var mainContext = new ScreenContext(new MainMenuScene());


            WaveServices.ScreenContextManager.Push(backContext);
            WaveServices.ScreenContextManager.Push(mainContext);

            // Play music
            WaveServices.MusicPlayer.Play(new MusicInfo(WaveContent.Assets.Sounds.bg_music_mp3));
            WaveServices.MusicPlayer.Volume   = 1.0f;
            WaveServices.MusicPlayer.IsRepeat = true;
        }
Exemplo n.º 20
0
        /// <summary>
        /// Gets the platform specific AR service
        /// </summary>
        /// <param name="service">The found service if defined</param>
        /// <returns><c>true</c> if the service has been found; otherwise, <c>false</c>.</returns>
        internal static bool GetService(out ARMobileService service)
        {
            service = WaveServices.GetService <ARMobileService>(false);

            if (service == null)
            {
#if IOS
                service = new ARKitService();
                WaveServices.RegisterService(service);
#elif ANDROID
                service = new ARCoreService();
                WaveServices.RegisterService(service);
#endif
            }

            return(service != null);
        }
Exemplo n.º 21
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            // Load storage game data
            GameStorage gameStorage;

            if (WaveServices.Storage.Exists <GameStorage>())
            {
                gameStorage = WaveServices.Storage.Read <GameStorage>();
            }
            else
            {
                gameStorage = new GameStorage();
            }

            Catalog.RegisterItem(gameStorage);

            // Register the SoundManager service
            WaveServices.RegisterService <SoundManager>(new SoundManager());

            // Set portrait orientation in WP
            if (WaveServices.Platform.PlatformType == PlatformType.WindowsPhone)
            {
                application.Adapter.DefaultOrientation    = DisplayOrientation.Portrait;
                application.Adapter.SupportedOrientations = DisplayOrientation.Portrait;
            }

            // Use ViewportManager to ensure scaling in all devices
            ViewportManager vm = WaveServices.ViewportManager;

            vm.Activate(768, 1024, ViewportManager.StretchMode.Uniform);

            // Load heavy assets to avoid breaks during gameplay
            this.LoadHeavyAssets();

            var backContext = new ScreenContext("BackContext", new BackgroundScene())
            {
                Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground
            };
            var mainContext = new ScreenContext(new MainMenuScene());

            WaveServices.ScreenContextManager.Push(backContext);
            WaveServices.ScreenContextManager.Push(mainContext);
        }
Exemplo n.º 22
0
        public NetworkedScene()
        {
            WaveServices.SoundPlayer.StopAllSounds();

            networkService = WaveServices.GetService <NetworkService>();
            if (networkService == null)
            {
                WaveServices.RegisterService(new NetworkService());
                networkService = WaveServices.GetService <NetworkService>();
            }

            serverDispatcher = new ServerDispatcher(this);
            clientDispatcher = new ClientDispatcher(this);

            networkService.HostMessageReceived   += serverDispatcher.HostMessageDispatcher;
            networkService.ClientMessageReceived += clientDispatcher.ClientMessageDispatcher;
            networkService.HostDisconnected      += Disconnect;
        }
Exemplo n.º 23
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            WaveServices.RegisterService(new TextureMapService());
            WaveServices.RegisterService(new LevelInformationService());
            WaveServices.RegisterService(new AnalyticsService(application));
            WaveServices.RegisterService(new HighscoreServices());
            WaveServices.RegisterService(new StatisticsService());
            WaveServices.RegisterService(new AchievementService());
            WaveServices.RegisterService(new SoundService());
            WaveServices.RegisterService(new AchievementDispatcher());

            WaveServices.GetService <HighscoreServices>().RegisterDefaultServices();

            BackgroundMusicPlayer.Instance.Start();
            SceneManager.Instance.To <MainMenuScene>();
        }
Exemplo n.º 24
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            ViewportManager vm = WaveServices.GetService <ViewportManager>();

            vm.Activate(800, 480, ViewportManager.StretchMode.Uniform);

            this.analyticsManager = new AnalyticsManager(application.Adapter);
            WaveServices.RegisterService <AnalyticsManager>(analyticsManager);

            this.analyticsManager.SetAnalyticsSystem(new LocalyticsInfo("492098e861d94597fd5f0cf-e9b821a6-7d17-11e3-9836-009c5fda0a25"));
            this.analyticsManager.Open();
            this.analyticsManager.Upload();

            ScreenContext screenContext = new ScreenContext(new MyScene());

            WaveServices.ScreenContextManager.To(screenContext);
        }
Exemplo n.º 25
0
        private void OnCreateServerClicked(object sender, EventArgs args)
        {
            var serverButton = (Button)sender;

            try
            {
                this.CleanErrorMessage();
                this.DisableServersDiscoveryAndCleanButtons();

                WaveServices.RegisterService(new NetworkServerService());
                serverButton.IsVisible = false;

                this.DiscoverServers();
            }
            catch (Exception exception)
            {
                this.ShowErrorMenssage(exception);
            }
        }
Exemplo n.º 26
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            // Load storage game data
            GameStorage gameStorage;

            if (WaveServices.Storage.Exists <GameStorage>())
            {
                gameStorage = WaveServices.Storage.Read <GameStorage>();
            }
            else
            {
                gameStorage = new GameStorage();
            }

            Catalog.RegisterItem <GameStorage>(gameStorage);

            // Register the SoundManager service
            WaveServices.RegisterService <SoundManager>(new SoundManager());

            // Use ViewportManager to ensure scaling in all devices
            WaveServices.ViewportManager.Activate(
                1024,
                768,
                ViewportManager.StretchMode.Uniform);

            // Play background music
            WaveServices.MusicPlayer.Play(new MusicInfo(Sounds.BG_MUSIC));
            WaveServices.MusicPlayer.IsRepeat = true;

            // GameBackContext is visible always at the background.
            // For this reason the behavior is set to Draw and Update when the scene is in background.
            var backContext = new ScreenContext("GameBackContext", new GameScene());

            backContext.Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground;

            //On init show the Main menu
            WaveServices.ScreenContextManager.Push(backContext);
            WaveServices.ScreenContextManager.Push(new ScreenContext("MenuContext", new MenuScene()));
        }
Exemplo n.º 27
0
        /// <summary>
        /// Initializes the game according to the passed application (thus adapter).
        ///             The adapter implementation depends on the while-running platform.
        ///             Such method acts as the bridge between the game and the final hardware.
        /// </summary>
        /// <param name="application">The application (adapter).</param>
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            // ViewportManager is used to automatically adapt resolution to fit screen size
            ViewportManager vm = WaveServices.ViewportManager;

            vm.Activate(1920, 1080, ViewportManager.StretchMode.Uniform);

            // Register Kinect Service Wave Engine Extension
            WaveServices.RegisterService(new KinectService());

            ScreenContext screenContext = new ScreenContext(new KinectScene())
            {
                Behavior = ScreenContextBehaviors.DrawInBackground
                           | ScreenContextBehaviors.UpdateInBackground
            };

            WaveServices.ScreenContextManager.Push(screenContext);
            WaveServices.ScreenContextManager.Push(new ScreenContext(new StartScene()), new CrossFadeTransition(TimeSpan.FromSeconds(3.0f)));
        }
Exemplo n.º 28
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            if (Program.Arguments.IsServerMode)
            {
                if (Program.Arguments.Is3D)
                {
                    WaveServices.RegisterService(new Lunar3DNetworkService(Program.Arguments.Port));
                }
                else
                {
                    WaveServices.RegisterService(new LunarNetworkService(Program.Arguments.Port));
                }

                ScreenContext screenContext = new ScreenContext(new WaitingScene("localhost", Program.Arguments.Port));
                WaveServices.ScreenContextManager.To(screenContext);
            }
            else
            {
                Scene scene;

                if (Program.Arguments.Is3D)
                {
                    scene = new MyScene3D();
                    ////WaveServices.RegisterService(new Lunar3DNetworkService(Program.Arguments.Port));
                }
                else
                {
                    scene = new MyScene();
                    WaveServices.RegisterService(new KeyboardActionsService());
                }

                ScreenContext screenContext = new ScreenContext(scene);
                WaveServices.ScreenContextManager.To(screenContext);
            }

            this.Load(WaveContent.GameInfo);
        }
Exemplo n.º 29
0
        private void CreateCamera()
        {
#if IOS
            WaveServices.RegisterService(new VuforiaService("TestVuforia.xml"));

            ARCamera camera = new ARCamera("vrCamera")
            {
                NearPlane = 0.01f
            };


            this.EntityManager.Add(camera);
#else
            //Create a 3D camera
            var camera = new FreeCamera("Camera3D", new Vector3(0, 15, 20), Vector3.Zero)
            {
                NearPlane       = 0.01f,
                BackgroundColor = Color.CornflowerBlue
            };
            EntityManager.Add(camera);
#endif
            camera.Entity.AddComponent(new FireBehavior(this.ballGroup));

            var cameraCollision = new Entity()
                                  .AddComponent(new Transform3D()
            {
                LocalScale = new Vector3(3)
            })
                                  .AddComponent(Model.CreateSphere())
                                  .AddComponent(new SphereCollider())
                                  .AddComponent(new BodyFollowCameraBehavior())
                                  .AddComponent(new RigidBody3D()
            {
                IsKinematic    = true,
                CollisionGroup = this.cameraGroup
            });

            this.EntityManager.Add(cameraCollision);
        }
Exemplo n.º 30
0
        public override void Initialize(IApplication application)
        {
            base.Initialize(application);

            // Load storage game data
            GameStorage gameStorage;

            if (WaveServices.Storage.Exists <GameStorage>())
            {
                gameStorage = WaveServices.Storage.Read <GameStorage>();
            }
            else
            {
                gameStorage = new GameStorage();
            }

            Catalog.RegisterItem(gameStorage);

            // Register the SoundManager service
            WaveServices.RegisterService <SoundManager>(new SoundManager());

            WaveServices.ViewportManager.Activate(768, 1280, ViewportManager.StretchMode.Uniform);

            var gameContext = new ScreenContext("GamePlayContext", new GamePlayScene())
            {
                Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground
            };
            var introContext = new ScreenContext(new IntroScene());

            WaveServices.ScreenContextManager.Push(gameContext);
            WaveServices.ScreenContextManager.Push(introContext);

            // Play background music
            WaveServices.MusicPlayer.Play(new MusicInfo("Content/music.mp3"));
            WaveServices.MusicPlayer.Volume   = 0.3f;
            WaveServices.MusicPlayer.IsRepeat = true;
        }