Ejemplo n.º 1
0
 private void OnBubbleFired(object sender, MessageEventArgs.ReadOnlyEventArgs <BubbleObject> e)
 {
     //BubbleObject bubble = e.Parameter;
     fireCount++;
     if (fireCount % _mapFalldownCycle == 0)
     {
         bubbleManager.FallDownMap();
         CheckGameOver();
     }
 }
Ejemplo n.º 2
0
    private void OnBubbleHit(object sender, MessageEventArgs.ReadOnlyEventArgs <BubbleObject> e)
    {
        _shooterController.Reload();

        var thisBo  = sender as BubbleObject;
        var otherBo = e.Parameter;

        Vector2Int gridPos = FindNearestNeighborPos(thisBo, otherBo);

        bubbleManager.AddBubble(thisBo, gridPos);

        #region chain destory
        chainFinder.Reset();

        HashSet <BubbleObject.BubbleTypes> bubbleTypes = new HashSet <BubbleObject.BubbleTypes>();
        bubbleTypes.Add(thisBo.BubbleType);

        chainFinder.FindBloomBubbles(thisBo, bubbleTypes);

        //Debug.Log(chainFinder.BloomList.Count);

        if (chainFinder.BloomList.Count >= 3)
        {
            foreach (var b in chainFinder.BloomList)
            {
                bubbleManager.RemoveBubble(b);
                BubblePool.Instance.ReleaseBubble(b);
            }
        }
        #endregion

        #region fall down isolated
        chainFinder.Reset();

        var IsoBubbles = chainFinder.FindIsolatedBubble();
        foreach (var b in IsoBubbles)
        {
            if (b.BubbleState == BubbleObject.BubbleStates.State_Bullet)
            {
                Debug.Log("!");
            }
            b.BubbleState = BubbleObject.BubbleStates.State_Fall;
            bubbleManager.RemoveBubble(b);
        }
        #endregion
        CheckWin();
        CheckGameOver();
    }
Ejemplo n.º 3
0
    private void OnBubbleCreated(object sender, MessageEventArgs.ReadOnlyEventArgs <BubbleObject> e)
    {
        var bo = e.Parameter;

        bo.BubbleHit += OnBubbleHit;
    }