示例#1
0
        private void ShootBall(List <Vector3> trajectory, GameEntity ghostBubble)
        {
            var shotBubble = _contexts.game.GetGroup(GameMatcher.Shot).GetSingleEntity();

            if (shotBubble != null)
            {
                return;
            }

            var finalAxialPos = ghostBubble.axialCoord.Value;
            var finalPos      = HexHelperService.HexToPoint(finalAxialPos);

            trajectory[trajectory.Count - 1] = finalPos;

            var shooterBubble = _contexts.game.GetGroup(GameMatcher.WillBeShotNext).GetSingleEntity();
            var bubbleId      = shooterBubble.id.Value;

            shooterBubble.AddShot(trajectory.ToArray(), () =>
            {
                var bubble = _contexts.game.GetEntityWithId(bubbleId);
                if (bubble == null)
                {
                    return;
                }

                bubble.RemoveShot();
                bubble.isWillBeShotNext = false;
                bubble.RemovePosition();
                bubble.AddAxialCoord(finalAxialPos);
                bubble.isMergeDirty = true;
            });

            ghostBubble.isDestroyed = true;
            _contexts.game.RemoveShootingTrajectory();
        }
示例#2
0
        public void OnAxialCoord(GameEntity entity, AxialCoord hex)
        {
            transform.position = HexHelperService.HexToPoint(hex);

            if (entity.isGhost)
            {
                GhostBubbleAppear();
            }
        }
示例#3
0
        public void OnNudged(GameEntity entity, AxialCoord from, Action callback)
        {
            var pos            = (Vector2)transform.position;
            var nudgePos       = HexHelperService.HexToPoint(from);
            var nudgeDirection = pos - nudgePos;

            nudgeDirection = nudgeDirection.normalized;

            transform.DOMove(pos + nudgeDirection * 0.2f, 0.2f).SetEase(Ease.OutSine).SetLoops(2, LoopType.Yoyo)
            .onComplete += () => callback();
        }
示例#4
0
        public void OnMergeTo(GameEntity entity, AxialCoord spot, Action callback)
        {
            var movement = transform.DOMove(HexHelperService.HexToPoint(spot), MergeDuration);

            DoWait.WaitSeconds(0.05f, () =>
                               CreateBubbleParticle(transform.position, spriteRenderer.color, mergeParticle));
            var seq = DOTween.Sequence();

            seq.AppendInterval(0.05f);
            seq.Append(movement);
            seq.onComplete += () => callback();
        }
 private void ShiftBubbles(int direction)
 {
     foreach (var bubble in _bubbleGroup)
     {
         var bubblePos = HexHelperService.HexToPoint(bubble.axialCoord.Value);
         bubblePos.y += ShiftAmount * direction;
         bubble.AddShiftTo(bubblePos, () =>
         {
             bubble.RemoveShiftTo();
             bubble.AddPosition(bubblePos);
             _contexts.game.isBubbleShiftDirty = true;
         });
     }
 }
        protected override void Execute(List <GameEntity> entities)
        {
            _contexts.input.isInputDisabled = false;
            var shouldShiftDown = true;

            foreach (var bubble in _bubbleGroup)
            {
                var point = HexHelperService.HexToPoint(bubble.axialCoord.Value);
                if (point.y <= UpShitLimit)
                {
                    shouldShiftDown = false;
                }
                if (point.y <= DownShiftLimit)
                {
                    ShiftUp();
                    return;
                }
            }

            if (shouldShiftDown)
            {
                ShiftDown();
            }
        }
示例#7
0
 public void OnAxialCoord(GameEntity entity, AxialCoord hex)
 {
     transform.position = HexHelperService.HexToPoint(hex);
 }