public void Run() { foreach (var index in _filter) { if (_gameState.State == State.Game) { ref var timeSinceLastSpawnComponent = ref _filter.Get2(index); timeSinceLastSpawnComponent.Value += Time.deltaTime; ref var coinCooldown = ref _filter.Get4(index); var coinsSpeedCoef = Mathf.Clamp01(_gameState.CoinsCount * _configuration.SpeedUpPerCoin / _configuration.MaxSpeedUp); coinCooldown.Value = (coinCooldown.Value - (coinCooldown.Value * coinsSpeedCoef)) - Time.deltaTime; var timeTillNextSpawn = _filter.Get3(index).Value; ref var entity = ref _filter.GetEntity(index);
public void Run() { foreach (int index in _filter) { EcsEntity entity = _filter.GetEntity(index); entity.Set <ChangeFieldAnimating>(); float zPosition = _filter.Get3(index).MainCell ? -1 : 0; Vector2Int cellPosition = _filter.Get2(index); Vector2Int targetPosition = _filter.Get4(index).TargetPosition; Vector3 targetMovePosition = new Vector3(targetPosition.x, targetPosition.y, zPosition); Vector3 startPosition = new Vector3(cellPosition.x, cellPosition.y, zPosition); Transform view = _filter.Get1(index).View.transform; view.position += new Vector3(0, 0, zPosition - view.position.z); view.DOMove(targetMovePosition, _configuration.Animation.SwapDuration) .OnComplete(() => view.DOMove(startPosition, _configuration.Animation.SwapDuration) .OnComplete(() => OnSwapBackCompleate(entity, view))); } }