private void HandleEntitiesUpdate() { for (var i = 0; i < _activeEntities.Count; i++) { if (_activeEntities[i] is IPlayable) { _cachedPlayable = (IPlayable)_activeEntities[i]; _cachedPlayable.SetInput(_camera.ScreenToWorldPoint(_input.MousePosition), _input.LeftClick, _input.RightClick); } if (_activeEntities[i] is IPerishable) { _cachedPerishable = (IPerishable)_activeEntities[i]; _cachedPerishable.UpdateLife(Time.deltaTime); if (_cachedPerishable.Life <= 0f) { _entitiesManager.Despawn(_cachedPerishable as Entity); } } } }