Пример #1
0
        protected override void OnInitialize()
        {
            Debug.WriteLine($"{nameof(TitleScreenSceneHandler)} Initialize");

            _networkService       = GameManager.Services.GetSafeServiceAs <IGameNetworkService>();
            _networkAssetDatabase = GameManager.Services.GetSafeServiceAs <NetworkAssetDatabase>();
        }
Пример #2
0
        public GameEngineServer(ContentManager contentManager, IServiceRegistry services)
            : base(contentManager, services)
        {
            // Note that IGame already part of Services in the client engine because Stride specific systems depends
            // on IGame's existence, however be aware this is NOT included in GameEngineServer, so you must be careful
            // not to get IGame in server side systems.

            Services.AddOrOverwriteService(new GameEngineContext(isClient: false));

            _networkSystem = CreateKeyValue(new NetworkSystem(Services));
            //_scriptSystem = CreateKeyValue(new ScriptSystem(Services));
            _physicsSystem         = CreateKeyValue(new Bullet2PhysicsSystem(Services));
            _sceneSystem           = CreateKeyValue(new HeadlessSceneSystem(Services) as SceneSystem);
            _scenePreUpdateSystem  = CreateKeyValue(new ScenePreUpdateSystem(Services, _sceneSystem.System));
            _scenePostUpdateSystem = CreateKeyValue(new ScenePostUpdateSystem(Services, _sceneSystem.System));
            _streamingManager      = CreateKeyValue(() => new StreamingManager(Services));
            //_dynamicNavigationMeshSystem = CreateKeyValue(new DynamicNavigationMeshSystem(Services));

            Services.AddOrOverwriteService(_streamingManager.System);
            Services.AddOrOverwriteService <IStreamingManager>(_streamingManager.System);
            Services.AddOrOverwriteService <ITexturesStreamingProvider>(_streamingManager.System);

            Services.AddOrOverwriteService(DefaultGraphicsDeviceService);

            _networkService = _networkSystem.System;
        }
Пример #3
0
        protected override void OnSystemAdd()
        {
            _sceneSystem = Services.GetSafeServiceAs <SceneSystem>();

            _gameClockManager  = Services.GetSafeServiceAs <GameClockManager>();
            _gameEngineContext = Services.GetService <GameEngineContext>();
            _networkService    = Services.GetService <IGameNetworkService>();
        }
Пример #4
0
        protected override void OnSystemAdd()
        {
            var gameEngineContext = Services.GetService <GameEngineContext>();

            Enabled = gameEngineContext.IsClient;

            _gameClockManager = Services.GetService <GameClockManager>();
            _networkService   = Services.GetService <IGameNetworkService>();
        }
Пример #5
0
        protected override void OnSystemAdd()
        {
            _gameClockManager = Services.GetService <GameClockManager>();

            _networkService = Services.GetSafeServiceAs <IGameNetworkService>();

            _content = Services.GetSafeServiceAs <ContentManager>();
            _networkAssetDatabase = Services.GetSafeServiceAs <NetworkAssetDatabase>();

            var sceneSystem = Services.GetSafeServiceAs <SceneSystem>();

            _lazyLoadedScene = new LazyLoadedSceneData(sceneSystem);
        }
Пример #6
0
        private ClientPredictionSnapshotsComponent _clientPredictionSnapshotsComponent;     // Optional component

        public override void Start()
        {
            base.Start();

            var parentEntity = Entity.GetParent();

            Debug.Assert(parentEntity != null);

            var networkEntityViewComp = parentEntity.Get <NetworkEntityViewComponent>();
            var networkedEntity       = networkEntityViewComp.NetworkedEntity;

            _networkEntityComponent = networkedEntity.Get <NetworkEntityComponent>();
            Debug.Assert(_networkEntityComponent != null);
            _movementSnapshotsComponent = networkedEntity.Get <MovementSnapshotsComponent>();
            Debug.Assert(_movementSnapshotsComponent != null);
            _clientPredictionSnapshotsComponent = networkedEntity.Get <ClientPredictionSnapshotsComponent>();

            _gameClockManager = Services.GetSafeServiceAs <GameClockManager>();
            _networkService   = Services.GetService <IGameNetworkService>();

            if (AnimationComponent == null)
            {
                throw new InvalidOperationException("The animation component is not set");
            }

            if (AnimationIdle == null)
            {
                throw new InvalidOperationException("Idle animation is not set");
            }

            if (AnimationWalk == null)
            {
                throw new InvalidOperationException("Walking animation is not set");
            }

            if (AnimationRun == null)
            {
                throw new InvalidOperationException("Running animation is not set");
            }

            if (AnimationJumpStart == null)
            {
                throw new InvalidOperationException("Jumping animation is not set");
            }

            if (AnimationJumpMid == null)
            {
                throw new InvalidOperationException("Airborne animation is not set");
            }

            if (AnimationJumpEnd == null)
            {
                throw new InvalidOperationException("Landing animation is not set");
            }

            // By setting a custom blend tree builder we can override the default behavior of the animation system
            //  Instead, BuildBlendTree(FastList<AnimationOperation> blendStack) will be called each frame
            AnimationComponent.BlendTreeBuilder = this;

            animEvaluatorIdle      = AnimationComponent.Blender.CreateEvaluator(AnimationIdle);
            animEvaluatorWalk      = AnimationComponent.Blender.CreateEvaluator(AnimationWalk);
            animEvaluatorRun       = AnimationComponent.Blender.CreateEvaluator(AnimationRun);
            animEvaluatorJumpStart = AnimationComponent.Blender.CreateEvaluator(AnimationJumpStart);
            animEvaluatorJumpMid   = AnimationComponent.Blender.CreateEvaluator(AnimationJumpMid);
            animEvaluatorJumpEnd   = AnimationComponent.Blender.CreateEvaluator(AnimationJumpEnd);

            // Initial walk lerp
            walkLerpFactor         = 0;
            animEvaluatorWalkLerp1 = animEvaluatorIdle;
            animEvaluatorWalkLerp2 = animEvaluatorWalk;
            animationClipWalkLerp1 = AnimationIdle;
            animationClipWalkLerp2 = AnimationWalk;
        }
Пример #7
0
 protected override void OnSystemAdd()
 {
     _gameClockManager = Services.GetService <GameClockManager>();
     _networkService   = Services.GetService <IGameNetworkService>();
 }