示例#1
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>();
        }
示例#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/Sproing.wav");
            _audioSource.Gain      = 4.0f;

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

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