Пример #1
0
        public GameState(
            GameRoundEntity owner,
            GameStateModel model,
            UserInputModel userInputModel,
            JesterEntity jesterEntity,
            AudioService audioService,
            ParticleService particleService)
            : base(owner)
        {
            _model           = model;
            _userInputModel  = userInputModel;
            _jesterEntity    = jesterEntity;
            _audioService    = audioService;
            _particleService = particleService;

            _audioService.ResetPausedSlots();
            _particleService.ResetPausedSlots();

            _userInputModel.OnPause
            .Subscribe(_ => model.IsPaused.Value = !model.IsPaused.Value)
            .AddTo(owner);

            _jesterEntity.OnKicked
            .Subscribe(_ => model.OnRoundStart.Execute())
            .AddTo(owner);

            _jesterEntity.OnLanded
            .Subscribe(_ => model.OnRoundEnd.Execute())
            .AddTo(owner);

            _model.IsPaused
            .Subscribe(OnPauseChanged)
            .AddTo(owner);
        }
Пример #2
0
 private void Inject(JesterEntity jesterEntity, AudioService audioService, ParticleService particleService, UserInputModel userInputModel)
 {
     _jesterEntity    = jesterEntity;
     _audioService    = audioService;
     _particleService = particleService;
     _userInputModel  = userInputModel;
 }
Пример #3
0
        private void Inject(CameraConfig config, JesterEntity jester, FlightStatsModel flighStatsModel)
        {
            _config          = config;
            _jester          = jester;
            _flighStatsModel = flighStatsModel;

            _minFollowY = Position.y;
        }
Пример #4
0
 protected override void Execute(JesterEntity jester)
 {
     // ToDo Find a better solution for Currency pickup
     MessageBroker.Default.Publish(new CurrencyGainEvent()
     {
         Amount = CurrencyAmount
     });
 }
Пример #5
0
 private void Inject(
     JesterEntity jesterEntity,
     FlightStatsModel flightStatsModel,
     AudioService audioService,
     ParticleService particleService,
     MainCamera mainCamera)
 {
     _jesterEntity     = jesterEntity;
     _flightStatsModel = flightStatsModel;
     _audioService     = audioService;
     _particleService  = particleService;
     _mainCamera       = mainCamera;
 }
Пример #6
0
        protected override void Execute(JesterEntity jester)
        {
            Rigidbody2D body = jester.GoBody;

            float velocityReductionAmount = body.velocity.magnitude - (body.velocity.magnitude * StoppingPowerPercent);

            body.velocity = body.velocity.normalized * velocityReductionAmount;

            // Remove bouncy material, so Jester will not bounce on land
            if (StoppingPowerPercent >= 1)
            {
                jester.GetComponent <Collider2D>().sharedMaterial = null;
            }
        }
        public BestDistanceMarkerController(BestDistanceMarkerView view, ProfileModel profileModel, JesterEntity jesterEntity)
            : base(view)
        {
            _view = view;
            _view.Initialize();

            _profileModel = profileModel;
            _jesterEntity = jesterEntity;

            _view.JesterOrigin = _jesterEntity.Position;
            _view.UpdateBestDistanceInstant(_profileModel.BestDistance.Value);

            _profileModel.BestDistance
            .Subscribe(value => _view.UpdateBestDistance(value))
            .AddTo(Disposer);
        }
Пример #8
0
        // COLLISION TRIGGER
        public void OnTriggerEnter2D(Collider2D collision)
        {
            // Safety Check: Only execute if we collided with the Jester
            JesterEntity jester = collision.gameObject.GetComponent <JesterEntity>();

            if (jester == null)
            {
                return;
            }

            TryPlaySound();
            TryPlayParticleEffect();
            Execute(jester);

            // Disable this trigger
            gameObject.GetComponent <Collider2D>().enabled = false;

            // Self Destroy if set
            if (isDestructible)
            {
                SelfDestruct();
            }
        }
Пример #9
0
 private void Inject(JesterEntity jesterEntity)
 {
     _jesterEntity = jesterEntity;
 }
Пример #10
0
 private void Inject(JesterEntity target, MainCamera camera)
 {
     _target = target.transform;
 }
Пример #11
0
 protected abstract void Execute(JesterEntity jester);
Пример #12
0
        protected override void Execute(JesterEntity jester)
        {
            Vector2 force = Direction * Strength;

            jester.GoBody.AddForce(ApplyForceMode(force, forceMode, jester.GoBody.mass));
        }