Example #1
0
        private void SetNextColor()
        {
            foreach (var i in _filterComponent)
            {
                ref var blocks = ref _filterComponent.Get1(i);

                var newColor = Additive.GetRandomColor(_gameConfiguration, out ushort numberNewColor);

                blocks.CurrentBlock.Color       = Additive.SetColor(_gameConfiguration, blocks.PreviewBlock.NumberColor);
                blocks.CurrentBlock.NumberColor = blocks.PreviewBlock.NumberColor;

                blocks.PreviewBlock.Color       = newColor;
                blocks.PreviewBlock.NumberColor = numberNewColor;
            }
        void IEcsInitSystem.Init()
        {
            var entity = _world.NewEntity();

            var color1 = Additive.GetRandomColor(_gameConfiguration, out ushort numberColor1);
            var color2 = Additive.GetRandomColor(_gameConfiguration, out ushort numberColor2);

            entity.Get <MainBlockComponent>().CurrentBlock = new Blockube(_sceneData.CurrentBlock, color1, numberColor1);
            entity.Get <MainBlockComponent>().PreviewBlock = new Blockube(_sceneData.PreviewBlock, color2, numberColor2);

            entity.Get <RotateComponent>().CurrentBlockRotate = new Blockube(_sceneData.CurrentBlockRotate, color1, numberColor1);
            entity.Get <RotateComponent>().PreviewBlockRotate = new Blockube(_sceneData.PreviewBlockRotate, color2, numberColor2);
            entity.Get <RotateComponent>().MainPlace          = _sceneData.MainBlocksPlace;
            entity.Get <RotateComponent>().RotationPlace      = _sceneData.RotatePlace;

            //entity.Get<ColorChargeComponent>().Current = _sceneData.CurrentBlock.transform.position;
            //entity.Get<ColorChargeComponent>().Preview = _sceneData.PreviewBlock.transform.position;
            entity.Get <MoveComponent>();
            entity.Get <IsCanFallComponent>();
            entity.Get <TimerFallingSetupComponent>().FallTimeSec      = _gameConfiguration.DelayFall;
            entity.Get <TimerFallingSetupComponent>().FallUnit         = _gameConfiguration.SpeedFall;
            entity.Get <TimerMergingSetupComponent>().MergeTimeSec     = _gameConfiguration.DelayMerge;
            entity.Get <TimerRemoveLineSetupComponent>().RemoveTimeSec = _gameConfiguration.DelayMerge * 2;
        }