示例#1
0
        private List <Vector> GetCombinations(Bubble.BubbleType type, Vector pivotPosition)
        {
            List <Vector> final = new List <Vector>();

            for (int i = 0; i < DirectionCount; i++)
            {
                List <Vector> points = new List <Vector>();

                var cPosition = pivotPosition + seekDirections[i];

                var bubble = GetFromPosition(cPosition);
                if (bubble == null)
                {
                    continue;
                }

                if (bubble.Numberos == type)
                {
                    var newType = (Bubble.BubbleType)(int) type + 1;
                    points.Add(cPosition);

                    var go = GetCombinations(newType, cPosition);
                    points.AddRange(go);
                }

                if (final.Count < points.Count)
                {
                    final = points;
                }
            }

            return(final);
        }
示例#2
0
        public List <Vector> GetMixes(Bubble.BubbleType type, Vector pivotPosition, List <Vector> exceptThis)
        {
            List <Vector> mixes = new List <Vector>();

            for (int i = 0; i < DirectionCount; i++)
            {
                var cPosition = pivotPosition + seekDirections[i];

                if (exceptThis.Contains(cPosition))
                {
                    continue;
                }

                var bubble = GetFromPosition(cPosition);
                if (bubble == null)
                {
                    continue;
                }

                if (bubble.Numberos == type)
                {
                    mixes.Add(cPosition);
                    exceptThis.Add(cPosition);
                    mixes.AddRange(GetMixes(type, cPosition, exceptThis));
                }
            }

            return(mixes);
        }
示例#3
0
    public void AddBubble(string str, Vector3 pos, Bubble.BubbleType type, bool bSelf)
    {
        BubbleInfo info = new BubbleInfo();

        info.str   = str;
        info.pos   = pos;
        info.type  = type;
        info.bSelf = bSelf;
        lstBubbleInfo.Add(info);
    }
示例#4
0
 private void AddScore(Bubble.BubbleType type, float multiplier = 1)
 {
     userScore += (int)type + 1;
     userScore  = (int)Math.Round(userScore * multiplier);
     GameEvents.OnGameScoreUpdate?.Invoke(userScore);
 }
示例#5
0
    private List <BubbleSlot> CollectChainedBubbleSlots(int starting_col, int starting_row, Bubble.BubbleType chaining_type)
    {
        var chained_bubble_slots = new List <BubbleSlot>();

        FloodFill(starting_col, starting_row,
                  slot => slot.bubble != null && slot.bubble.type == chaining_type && !chained_bubble_slots.Contains(slot),
                  slot =>
        {
            chained_bubble_slots.Add(slot);
        });

        return(chained_bubble_slots);
    }
示例#6
0
    static Bubble Load(string str, Vector3 pos, Bubble.BubbleType type, bool bSelf)
    {
        if (BubbleSystem.system == null)
        {
            return(null);
        }
        if (BubbleManager.Instance.mOpenWndCount > 0)
        {
            return(null);
        }

        GameObject obj = GameObject.Instantiate(Resources.Load("Bubble/Bubble")) as GameObject;

        if (type == Bubble.BubbleType.eBT_AddSp)
        {
            obj.transform.parent = null;
            GameObject playerHead = GameObject.Find("Player");
            if (playerHead != null)
            {
                Vector3 playerPostion = playerHead.transform.position;
                float   offsetY       = 0.15f * playerHead.transform.localScale.y;
                float   offsetX       = 0.4f * playerHead.transform.localScale.x;
                obj.transform.localPosition = playerPostion + new Vector3(-1.0f * offsetX, offsetY, 0.0f);
            }
            obj.layer = 11;
        }
        else
        {
            obj.transform.parent = BubbleSystem.system.GetSelfTransform();//Transform();//
            Vector3 v = BubbleSystem.system.WorldToScreen(pos);
            v  *= 2.0f;
            v  -= new Vector3(1, 1, 1);      //new Vector3(0.5f,0.5f,0);
            v.z = 0;
            obj.transform.localPosition = v; //(pos);//
            obj.layer = 11;
        }
        if (!bSelf)
        {
            obj.transform.localPosition += new Vector3(Random.Range(-0.05f, 0.05f), 0, 0);
        }

        Bubble n = obj.GetComponent <Bubble>();

        if (n != null)
        {
            n.rule            = Bubble.NewRule(type);
            n.rule.bubbleType = type;
            n.bSelf           = bSelf;
            if (bSelf)
            {
                n.rule.SetSelf();
            }
            n.transform.localScale = Vector3.one * n.rule.CalcScale(0.0f);;
            Color c = Bubble.GetBubbleColor(type);
            switch (type)
            {
            case Bubble.BubbleType.eBT_Miss:
            case Bubble.BubbleType.eBT_Dodge:
            {
                n.SetOther(type, c);
            } break;

            default:
            {
                if (type == Bubble.BubbleType.eBT_CriticalBaseHurt || type == Bubble.BubbleType.eBT_CriticalSkillHurt)
                {
                    n.SetNumber(">?" + str, c);
                }
                else
                {
                    n.SetNumber(str, c);
                }
            } break;
            }
        }
        return(n);
    }