Esempio n. 1
0
        public void Execute()
        {
            //var deltaTime = ;
            //_contexts.Input.Unique.Get<DeltaTimeComponent>().Component.Value = _timeService.DeltaTime();

            //_contexts.Input.SetUnique<DeltaTimeComponent>(c => c.value = deltaTime);
            //var timeSinceStartup = ;
            //_contexts.Input.SetUnique<RealtimeSinceStartupComponent>(c => c.value = timeSinceStartup);

            _contexts.Input.Unique.Get <RealtimeSinceStartupComponent>().Apply(_timeService.RealtimeSinceStartup());
            _contexts.Input.Unique.Get <DeltaTimeComponent>().Apply(_timeService.DeltaTime());
        }
        public void Execute()
        {
            var time = _timeService.DeltaTime();

            for (var i = 0; i < _timeRemainings.Count; i++)
            {
                var obj = _timeRemainings[i];
                obj.CurrentTime -= time;
                if (obj.CurrentTime <= 0.0f)
                {
                    obj?.Method?.Invoke();
                    if (!obj.IsRepeating)
                    {
                        obj.RemoveTimeRemaining();
                    }
                    else
                    {
                        obj.CurrentTime = obj.Time;
                    }
                }
            }
        }
Esempio n. 3
0
        public void Move()
        {
            _timeService      = Services.Instance.TimeService;
            _bullet.position += _speed * _bullet.forward * _timeService.DeltaTime();
            Collider[] _collidedObjects = new Collider[30];
            var        tagCollider      = Physics.OverlapSphereNonAlloc(_bullet.transform.position, 3, _collidedObjects);

            for (int i = 0; i < tagCollider; i++)
            {
                if (_collidedObjects[i].CompareTag(TagManager.GetTag(TagType.Enemy)))
                {
                    for (int b = 0; b < Services.Instance.LevelService.ActiveEnemies.Count; b++)
                    {
                        if (Services.Instance.LevelService.ActiveEnemies[b].GetTransform() == _collidedObjects[i].transform)
                        {
                            if (Services.Instance.LevelService.ActiveEnemies[b] is IDamageAddressee ActiveEnemy)
                            {
                                ActiveEnemy.RegisterDamage(_damage, ArmorTypes.None);
                            }
                        }
                    }
                }
            }
        }
 public void Execute()
 {
     _contexts.input.ReplaceDeltaTime(_timeService.DeltaTime());
     _contexts.input.ReplaceRealtimeSinceStartup(_timeService.RealtimeSinceStartup());
 }
Esempio n. 5
0
 public float GetSpeed()
 {
     return(_speed * _timeService.DeltaTime());
 }
Esempio n. 6
0
 public void ConstantMove()//постоянное движение
 {
     transform.rotation  = _direction.ToQuaternion();
     transform.position += transform.forward * ((_speed - (_positions.Count * _slowSnake)) * _timeService.DeltaTime());
 }