Esempio n. 1
0
 protected override void Start(SystemRegistry registry)
 {
     _input = registry.GetSystem <InputSystem>();
     _gs    = registry.GetSystem <GraphicsSystem>();
     _sls   = registry.GetSystem <SceneLoaderSystem>();
     _as    = registry.GetSystem <AssetSystem>();
 }
Esempio n. 2
0
        protected override void Start(SystemRegistry registry)
        {
            _input       = registry.GetSystem <InputSystem>();
            _ballState   = GameObject.GetComponent <BallState>();
            _audioSource = new AudioSourceComponent();
            GameObject.AddComponent(_audioSource);
            _audioSource.AudioClip = new AssetRef <WaveFile>("Audio/BoostNoise.wav");
            _audioSource.Gain      = 4.0f;

            var shs = registry.GetSystem <SynchronizationHelperSystem>();

            Task.Run(() =>
            {
                var particleChildPrefab = registry.GetSystem <AssetSystem>().Database.LoadAsset <SerializedPrefab>("Prefabs/LinearBoostParticles.prefab", false);
                var particleChild       = particleChildPrefab.Instantiate(registry.GetSystem <GameObjectQuerySystem>());
                var transformFollow     = new TransformFollow()
                {
                    Target = Transform
                };
                particleChild.AddComponent(transformFollow);
                _childParticleSystem = particleChild.GetComponent <ParticleSystem>();
            });

            _currentAvailableBoosts = MaxBoosts;
        }
Esempio n. 3
0
 protected override void Start(SystemRegistry registry)
 {
     _physics = registry.GetSystem <PhysicsSystem>();
     _gs      = registry.GetSystem <GraphicsSystem>();
     _input   = registry.GetSystem <InputSystem>();
     _time    = (float)Math.PI / 2f;
 }
Esempio n. 4
0
 protected override void Start(SystemRegistry registry)
 {
     _levelLoadTrigger = GameObject.GetComponent <LevelLoadTrigger>();
     _levelLoadTrigger.LevelLoadTriggered += OnLevelLoadTriggered;
     _goqs = registry.GetSystem <GameObjectQuerySystem>();
     _sls  = registry.GetSystem <SceneLoaderSystem>();
 }
Esempio n. 5
0
 protected override void PostAttached(SystemRegistry registry)
 {
     _gs      = registry.GetSystem <GraphicsSystem>();
     _ad      = registry.GetSystem <AssetSystem>().Database;
     _texture = Texture.Get(_ad);
     _cameraDistanceComparer = new CameraDistanceComparer(_gs);
     _gs.ExecuteOnMainThread(() => InitializeContextObjects(_gs.Context, _gs.MaterialCache, _gs.BufferCache));
 }
Esempio n. 6
0
File: Skybox.cs Progetto: zhuowp/ge
        protected override void Attached(SystemRegistry registry)
        {
            _gs = registry.GetSystem <GraphicsSystem>();
            _as = registry.GetSystem <AssetSystem>();
            var ad = _as.Database;

            RecreateCubemapTexture();
            _gs.ExecuteOnMainThread(() => InitializeContextObjects(ad, _gs.Context));
        }
Esempio n. 7
0
        protected unsafe override void Start(SystemRegistry registry)
        {
            _assetSystem = registry.GetSystem <AssetSystem>();
            _sls         = registry.GetSystem <SceneLoaderSystem>();
            _gs          = registry.GetSystem <GraphicsSystem>();
            _audioSource = GameObject.GetComponent <AudioSourceComponent>();
            LoadFont();

            _gs.ImGuiRenderer.RecreateFontDeviceTexture(_gs.Context);

            _allScenes = _assetSystem.Database.GetAssetsOfType(typeof(SceneAsset));
        }
Esempio n. 8
0
 protected override void Attached(SystemRegistry registry)
 {
     _gs      = registry.GetSystem <GraphicsSystem>();
     _ad      = registry.GetSystem <AssetSystem>().Database;
     _texture = Texture.Get(_ad);
     _mesh    = Mesh.Get(_ad);
     _centeredBoundingSphere = _mesh.GetBoundingSphere();
     _centeredBoundingBox    = _mesh.GetBoundingBox();
     _gs.ExecuteOnMainThread(() =>
     {
         InitializeContextObjects(_gs.Context, _gs.MaterialCache, _gs.BufferCache);
     });
 }
Esempio n. 9
0
 protected override void Attached(SystemRegistry registry)
 {
     _assetSystem = registry.GetSystem <AssetSystem>();
     _audioSystem = registry.GetSystem <AudioSystem>();
     _source      = _audioSystem.Engine.ResourceFactory.CreateAudioSource();
     OnTransformChanged(Transform);
     _source.Gain    = _gain;
     _source.Looping = Looping;
     if (_clipRef != null && !_clipRef.ID.IsEmpty)
     {
         GetBufferForRef();
     }
 }
Esempio n. 10
0
        protected override void Start(SystemRegistry registry)
        {
            _input   = registry.GetSystem <InputSystem>();
            _goqs    = registry.GetSystem <GameObjectQuerySystem>();
            _gs      = registry.GetSystem <GraphicsSystem>();
            _physics = registry.GetSystem <PhysicsSystem>();
            _ball    = _goqs.FindByName(BallName);
            if (_ball == null)
            {
                throw new InvalidOperationException("No Ball found in scene with name " + BallName);
            }

            _ballCollider = _ball.GetComponent <Collider>();
            _ballState    = _ball.GetComponent <BallState>();
        }
Esempio n. 11
0
 protected override void Start(SystemRegistry registry)
 {
     GameObject.RemoveComponent(this);
     _ccs = registry.GetSystem <ConsoleCommandSystem>();
     if (_ccs != null)
     {
         _ccs.Print += AddLine;
         _gs         = registry.GetSystem <GraphicsSystem>();
         _input      = registry.GetSystem <InputSystem>();
     }
     else
     {
         Enabled = false;
     }
 }
Esempio n. 12
0
        protected override void Attached(SystemRegistry registry)
        {
            _as             = registry.GetSystem <AssetSystem>();
            _meshData       = _as.Database.LoadAsset <MeshData>(_meshAsset.ID);
            _textureData    = _as.Database.LoadAsset <ImageSharpTexture>(_textureAsset.ID);
            _transform      = GameObject.Transform;
            _centeredBounds = _meshData.GetBoundingBox();
            _objectCenter   = _centeredBounds.GetCenter();

            // _gs.ExecuteOnMainThread(() =>
            // {
            //     InitializeContextObjects(_gs.Context, _gs.MaterialCache, _gs.BufferCache);
            // });


            // _gs = registry.GetSystem<GraphicsSystem>();
            // _ad = registry.GetSystem<AssetSystem>().Database;
            // _texstture = Texture.Get(_ad);
            // _mesh = Mesh.Get(_ad);
            // _centeredBoundingSphere = _mesh.GetBoundingSphere();
            // _centeredBoundingBox = _mesh.GetBoundingBox();
            // _gs.ExecuteOnMainThread(() =>
            // {
            //     InitializeContextObjects(_gs.Context, _gs.MaterialCache, _gs.BufferCache);
            // });
        }
Esempio n. 13
0
 protected override void PostAttached(SystemRegistry registry)
 {
     _as = registry.GetSystem <AssetSystem>();
     if (_mesh.GetRef() != null)
     {
         SetEntity(CreateEntity());
     }
 }
Esempio n. 14
0
        public override void Execute(string args, SystemRegistry registry)
        {
            var topLevelGOs = registry.GetSystem <GameObjectQuerySystem>().GetUnparentedGameObjects();

            foreach (var go in topLevelGOs)
            {
                PrintGo(go, 0);
            }
        }
Esempio n. 15
0
 protected override void Attached(SystemRegistry registry)
 {
     _physics   = registry.GetSystem <PhysicsSystem>();
     Controller = new BEPUphysics.Character.CharacterController(
         Transform.Position,
         jumpSpeed: 8f,
         tractionForce: 1500
         );
 }
Esempio n. 16
0
        protected override void Start(SystemRegistry registry)
        {
            _input        = registry.GetSystem <InputSystem>();
            _ballCollider = GameObject.GetComponent <SphereCollider>();

            int magnetTrackerLayer = registry.GetSystem <PhysicsSystem>().GetLayerByName("MagnetDetector");

            _magnetTrackingZone = ObjectTrackingZone.Create(GameObject.Transform, Radius, "CrazyCore.Magnet", magnetTrackerLayer);
            _zoneSphereCollider = _magnetTrackingZone.GameObject.GetComponent <SphereCollider>();

            AssetSystem assetSystem = registry.GetSystem <AssetSystem>();

            _magnetParticleGo = assetSystem.Database.LoadAsset <SerializedPrefab>("Prefabs/MagnetParticles.prefab", false)
                                .Instantiate(registry.GetSystem <GameObjectQuerySystem>());
            _magnetParticles = _magnetParticleGo.GetComponent <ParticleSystem>();
            _magnetParticleGo.Transform.Parent        = Transform;
            _magnetParticleGo.Transform.LocalPosition = Vector3.Zero;
        }
Esempio n. 17
0
            public override void Execute(string args, SystemRegistry registry)
            {
                var options = registry.GetSystem <ConsoleCommandSystem>()._commandOptions;

                Print("Availiable commands:");
                foreach (var option in options)
                {
                    string name    = option.Names.Last();
                    var    aliases = option.Names.Take(option.Names.Length - 1);
                    Print($"    {name}, ({string.Join(", ", aliases)})");
                }
            }
Esempio n. 18
0
        protected override void Start(SystemRegistry registry)
        {
            _particleSystem = GameObject.GetComponent <ParticleSystem>();
            Collider collider = GameObject.GetComponent <Collider>();

            if (collider == null)
            {
                throw new InvalidOperationException("No collider on magnet " + GameObject.Name);
            }

            collider.Layer = registry.GetSystem <PhysicsSystem>().GetLayerByName("Magnet");
        }
Esempio n. 19
0
        public static Skybox LoadDefaultSkybox(SystemRegistry registry)
        {
            var           assetSystem = registry.GetSystem <AssetSystem>();
            AssetDatabase ad          = assetSystem.Database;

            AssetRef <ImageSharpTexture> front  = new AssetRef <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxFrontID);
            AssetRef <ImageSharpTexture> back   = new AssetRef <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxBackID);
            AssetRef <ImageSharpTexture> left   = new AssetRef <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxLeftID);
            AssetRef <ImageSharpTexture> right  = new AssetRef <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxRightID);
            AssetRef <ImageSharpTexture> top    = new AssetRef <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxTopID);
            AssetRef <ImageSharpTexture> bottom = new AssetRef <ImageSharpTexture>(EngineEmbeddedAssets.SkyboxBottomID);

            var skybox = new Skybox(front, back, left, right, top, bottom);

            skybox._as = assetSystem;
            return(skybox);
        }
Esempio n. 20
0
        protected override void Start(SystemRegistry registry)
        {
            _physics         = registry.GetSystem <PhysicsSystem>();
            _collider        = GameObject.GetComponent <Collider>();
            _entityMover     = new EntityMover(_collider.Entity);
            _spline          = new CardinalSpline3D();
            _spline.PreLoop  = MapBoundaryBehavior(_boundaryBehavior);
            _spline.PostLoop = MapBoundaryBehavior(_boundaryBehavior);

            Vector3 origin = Transform.Position;

            foreach (var offset in TargetOffsets.OrderBy(co => co.Time))
            {
                _spline.ControlPoints.Add(offset.Time, origin + offset.Offset);
            }

            _physics.AddObject(_entityMover);
            _elapsedPreActivationTime = PreActivateTime;
        }
Esempio n. 21
0
 protected override void Start(SystemRegistry registry)
 {
     _input       = registry.GetSystem <InputSystem>();
     _audioSource = GameObject.GetComponent <AudioSourceComponent>();
 }
Esempio n. 22
0
 protected override void Start(SystemRegistry registry)
 {
     _input = registry.GetSystem <InputSystem>();
     _shs   = registry.GetSystem <SynchronizationHelperSystem>();
 }
Esempio n. 23
0
 protected override void Start(SystemRegistry registry)
 {
     _input = registry.GetSystem <InputSystem>();
 }
Esempio n. 24
0
 protected sealed override void Attached(SystemRegistry registry)
 {
     _bus = registry.GetSystem <BehaviorUpdateSystem>();
     PostAttached(registry);
 }
Esempio n. 25
0
 protected override void Start(SystemRegistry registry)
 {
     _audioSystem   = registry.GetSystem <AudioSystem>();
     _lastSoundTime = DateTime.UtcNow;
 }
Esempio n. 26
0
 protected sealed override void Attached(SystemRegistry registry)
 {
     _es = registry.GetSystem <EditorSystem>();
     Start(registry);
 }
Esempio n. 27
0
 protected override void Start(SystemRegistry registry)
 {
     base.Start(registry);
     _gs    = registry.GetSystem <GraphicsSystem>();
     _input = registry.GetSystem <InputSystem>();
 }
Esempio n. 28
0
 protected override void Attached(SystemRegistry registry)
 {
     _collider = GameObject.GetComponent <Collider>();
     _goqs     = registry.GetSystem <GameObjectQuerySystem>();
 }
Esempio n. 29
0
File: Camera.cs Progetto: zhuowp/ge
 protected override void Attached(SystemRegistry registry)
 {
     _gs = registry.GetSystem <GraphicsSystem>();
 }
Esempio n. 30
0
 internal override void Start(SystemRegistry registry)
 {
     _input = registry.GetSystem <InputSystem>();
 }