示例#1
0
        public SpriteEffect(JesterEntity owner, JesterSpriteEffectsConfig config, ParticleService particleService)
            : base(owner)
        {
            _config          = config;
            _particleService = particleService;

            Observable.EveryFixedUpdate()
            .Where(_ => !IsPaused.Value)
            .Subscribe(_ => OnUpdate())
            .AddTo(owner);

            owner.OnKicked
            .Subscribe(_ => OnKicked())
            .AddTo(owner);

            Owner.OnShot
            .Subscribe(_ => OnShot())
            .AddTo(Owner);

            Owner.Collisions.OnGround
            .Where(_ => _listenForImpacts)
            .Subscribe(_ => OnGround())
            .AddTo(Owner);

            Owner.Collisions.OnBoost
            .Subscribe(_ => OnBoost())
            .AddTo(Owner);

            IsPaused
            .Subscribe(OnPause)
            .AddTo(owner);

            owner.OnLanded
            .Subscribe(_ => OnLanded())
            .AddTo(owner);
        }
示例#2
0
 public override void Initialize()
 {
     IsPaused.Subscribe(isPaused => { GoBody.simulated = !isPaused; })
     .AddTo(this);
 }