Example #1
0
    void OnDragStart()
    {
        PaturuControy.ColorUpadateCtr = true;
        lineSize              = 1;
        linePosCount          = 0;
        Tag_ColorControlName2 = null;
        CLine.Nodes_list.Clear();
        var Ball = GetCurrentHitCollider();

        if (Ball != null)
        {
            var ball   = Ball.gameObject;
            var hitTga = Ball.tag;
            currentTga           = Ball.tag;
            FirstNameTag         = Ball.tag;
            Tag_ColorControlName = Ball.tag;
            if (hitTga == Paturu.TagName0)
            {
                Skill6(ball, ball, FirstNameTag);
                PaturuControy.SetColorAllBlack(Paturu.TagName0, Paturu.TagName1, Paturu.TagName2);
                ball.GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                PaturuControy.ImagesControy(ball, Tag_ColorControlName);
                First_Paturu = ball;
                ball.tag     = Paturu.FinishTagName;
                AddDeleteObj(ball);
                CLine.CLineRender(ball, linePosCount, lineSize);
                Bigger(ball);
                //Skill6(ball, First_Paturu, FirstNameTag);
            }
            else if (hitTga == Paturu.TagName1)
            {
                Skill6(ball, ball, FirstNameTag);
                PaturuControy.SetColorAllBlack(Paturu.TagName0, Paturu.TagName1, Paturu.TagName2);
                ball.GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                PaturuControy.ImagesControy(ball, Tag_ColorControlName);
                First_Paturu = ball;
                //ball.tag = "typeX";
                ball.tag = Paturu.FinishTagName;
                AddDeleteObj(ball);
                CLine.CLineRender(ball, linePosCount, lineSize);
                Bigger(ball);
            }
            else if (hitTga == Paturu.TagName2)
            {
                Skill6(ball, ball, FirstNameTag);
                PaturuControy.SetColorAllBlack(Paturu.TagName0, Paturu.TagName1, Paturu.TagName2);
                ball.GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                PaturuControy.ImagesControy(ball, Tag_ColorControlName);
                First_Paturu = ball;
                ball.tag     = Paturu.FinishTagName;
                AddDeleteObj(ball);
                CLine.CLineRender(ball, linePosCount, lineSize);
                Bigger(ball);
            }
            else if (hitTga == Paturu.RinkuName)
            {
                First_Paturu = ball;
                ball.tag     = Paturu.FinishTagName;
                AddDeleteObj(ball);
                CLine.CLineRender(ball, linePosCount, lineSize);
                Bigger(ball);
                SwichType = true;
            }
        }
    }
Example #2
0
    void OnDragging()
    {
        var hitcol = GetCurrentHitCollider();

        if (hitcol != null)
        {
            var hitObj = hitcol.gameObject;
            HitObj_ = hitcol.gameObject;
            string nameRk = null;
            nameRk = hitObj.tag;
            //if (Last_Paturu != hitObj&&hitObj!=First_Paturu)
            //WaterSkill6(hitObj);
            if (nameRk == Paturu.RinkuName && !SwichType)
            {
                var dist = Vector2.Distance(Last_Paturu.transform.position, hitObj.transform.position);
                if (dist <= distance)
                {
                    currentTga = Paturu.RinkuName;
                }
            }
            if (!SwichType && !Back)
            {
                switch (currentTga)
                {
                case "ListType0":
                    if (Last_Paturu != hitObj && hitObj.name == NPaturu.Name0 && hitObj.tag != Paturu.FinishTagName || Last_Paturu != hitObj && hitObj.name == NPaturu.NameRoleWater && hitObj.tag != Paturu.FinishTagName)
                    {
                        var dist = Vector2.Distance(Last_Paturu.transform.position, hitObj.transform.position);
                        if (dist <= distance)
                        {
                            if (SkillCostManager.Skill_Control.Water6Swich && SkillCostManager.GetSkill6Code() != null &&
                                PaturuControy.waterskill_six.StartCountDown > 0)
                            {
                                SkillCostManager.GetSkill6Code().CountDownControl(hitObj);
                            }
                            if (PaturuControy.waterskill_six.StartCountDown > 0)
                            {
                                DraggingSKill6(hitObj, First_Paturu, FirstNameTag);
                            }
                            //Debug.Log ("asdadsadasdsssssssssssssssssssssssssssss");
                            //  SkillCostManager.GetSkill6Code().CountBackControl(DeleteList);
                            hitObj.tag = Paturu.FinishTagName;
                            AddDeleteObj(hitObj);
                            linePosCount += 1;
                            lineSize     += 1;
                            CLine.CLineRender(hitObj, linePosCount, lineSize);
                            Bigger(hitObj);
                            m_SoundManager.PlaySE((int)GameSoundManager.SoundInfo.se_puzzle_link, 1.0f, startTime);
                        }
                    }
                    break;

                case "type1":
                    if (Last_Paturu != hitObj && hitObj.name == NPaturu.Name1 && hitObj.tag != Paturu.FinishTagName || Last_Paturu != hitObj && hitObj.name == NPaturu.NameRoleWind && hitObj.tag != Paturu.FinishTagName)
                    {
                        var dist = Vector2.Distance(Last_Paturu.transform.position, hitObj.transform.position);
                        if (dist <= distance)
                        {
                            if (SkillCostManager.Skill_Control.Water6Swich && SkillCostManager.GetSkill6Code() != null &&
                                PaturuControy.waterskill_six.StartCountDown > 0)
                            {
                                SkillCostManager.GetSkill6Code().CountDownControl(hitObj);
                            }
                            if (PaturuControy.waterskill_six.StartCountDown > 0)
                            {
                                DraggingSKill6(hitObj, First_Paturu, FirstNameTag);
                            }
                            hitObj.tag = Paturu.FinishTagName;
                            AddDeleteObj(hitObj);
                            //test(hitObj);
                            linePosCount += 1;
                            lineSize     += 1;
                            CLine.CLineRender(hitObj, linePosCount, lineSize);
                            Bigger(hitObj);
                            m_SoundManager.PlaySE((int)GameSoundManager.SoundInfo.se_puzzle_link, 1.0f, startTime);
                        }
                    }

                    break;

                case "type2":
                    if (Last_Paturu != hitObj && hitObj.name == NPaturu.Name2 && hitObj.tag != Paturu.FinishTagName || Last_Paturu != hitObj && hitObj.name == NPaturu.NameRoleFire && hitObj.tag != Paturu.FinishTagName)
                    {
                        var dist = Vector2.Distance(Last_Paturu.transform.position, hitObj.transform.position);
                        if (dist <= distance)
                        {
                            if (SkillCostManager.Skill_Control.Water6Swich && SkillCostManager.GetSkill6Code() != null &&
                                PaturuControy.waterskill_six.StartCountDown > 0)
                            {
                                SkillCostManager.GetSkill6Code().CountDownControl(hitObj);
                            }
                            if (PaturuControy.waterskill_six.StartCountDown > 0)
                            {
                                DraggingSKill6(hitObj, First_Paturu, FirstNameTag);
                            }
                            hitObj.tag = Paturu.FinishTagName;
                            AddDeleteObj(hitObj);
                            linePosCount += 1;
                            lineSize     += 1;
                            CLine.CLineRender(hitObj, linePosCount, lineSize);
                            Bigger(hitObj);
                            m_SoundManager.PlaySE((int)GameSoundManager.SoundInfo.se_puzzle_link, 1.0f, startTime);
                        }
                    }
                    break;

                case "RK":
                    if (Last_Paturu != hitObj && hitObj.tag != Paturu.FinishTagName)
                    {
                        var dist = Vector2.Distance(Last_Paturu.transform.position, hitObj.transform.position);
                        if (dist <= distance)
                        {
                            hitObj.tag = Paturu.FinishTagName;
                            AddDeleteObj(hitObj);
                            linePosCount += 1;
                            lineSize     += 1;
                            CLine.CLineRender(hitObj, linePosCount, lineSize);
                            Bigger(hitObj);
                            SwichType = true;
                            m_SoundManager.PlaySE((int)GameSoundManager.SoundInfo.se_puzzle_link, 1.0f, startTime);
                        }
                    }
                    break;
                }
            }
            if (SwichType && !Back)
            {
                switch (nameRk)
                {
                case "ListType0":
                    if (Last_Paturu != hitObj && hitObj.name == NPaturu.Name0 && hitObj.tag != Paturu.FinishTagName || Last_Paturu != hitObj && hitObj.name == NPaturu.NameRoleWater && hitObj.tag != Paturu.FinishTagName)
                    {
                        var dist = Vector2.Distance(Last_Paturu.transform.position, hitObj.transform.position);
                        if (dist <= distance)
                        {
                            hitObj.GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                            Tag_ColorControlName2 = hitObj.tag;
                            PaturuControy.ImagesControy(hitObj, hitObj.tag);
                            //if(Tag_ColorControlName!=hitObj.tag)
                            //PaturuControy.sethitobjCancel(Tag_ColorControlName);
                            hitObj.tag = Paturu.FinishTagName;
                            AddDeleteObj(hitObj);
                            linePosCount += 1;
                            lineSize     += 1;
                            CLine.CLineRender(hitObj, linePosCount, lineSize);
                            Bigger(hitObj);
                            currentTga = Paturu.TagName0;
                            SwichType  = false;
                            Debug.Log("sb");
                            m_SoundManager.PlaySE((int)GameSoundManager.SoundInfo.se_puzzle_link, 1.0f, startTime);
                        }
                    }
                    break;

                case "type1":
                    if (Last_Paturu != hitObj && hitObj.name == NPaturu.Name1 && hitObj.tag != Paturu.FinishTagName || Last_Paturu != hitObj && hitObj.name == NPaturu.NameRoleWind && hitObj.tag != Paturu.FinishTagName)
                    {
                        var dist = Vector2.Distance(Last_Paturu.transform.position, hitObj.transform.position);
                        if (dist <= distance)
                        {
                            hitObj.GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                            Tag_ColorControlName2 = hitObj.tag;
                            PaturuControy.ImagesControy(hitObj, hitObj.tag);
                            //if (Tag_ColorControlName != hitObj.tag)
                            //PaturuControy.sethitobjCancel(Tag_ColorControlName);
                            hitObj.tag = Paturu.FinishTagName;
                            AddDeleteObj(hitObj);
                            linePosCount += 1;
                            lineSize     += 1;
                            CLine.CLineRender(hitObj, linePosCount, lineSize);
                            Bigger(hitObj);
                            currentTga = Paturu.TagName1;
                            SwichType  = false;
                            m_SoundManager.PlaySE((int)GameSoundManager.SoundInfo.se_puzzle_link, 1.0f, startTime);
                        }
                    }
                    //Debug.Log(currentTga);
                    break;

                case "type2":
                    if (Last_Paturu != hitObj && hitObj.name == NPaturu.Name2 && hitObj.tag != Paturu.FinishTagName || Last_Paturu != hitObj && hitObj.name == NPaturu.NameRoleFire && hitObj.tag != Paturu.FinishTagName)
                    {
                        var dist = Vector2.Distance(Last_Paturu.transform.position, hitObj.transform.position);
                        if (dist <= distance)
                        {
                            hitObj.GetComponentInChildren <SpriteRenderer>().color = new Color32(255, 255, 255, 255);
                            Tag_ColorControlName2 = hitObj.tag;
                            PaturuControy.ImagesControy(hitObj, hitObj.tag);
                            //if (Tag_ColorControlName != hitObj.tag)
                            //PaturuControy.sethitobjCancel(Tag_ColorControlName);
                            hitObj.tag = Paturu.FinishTagName;
                            AddDeleteObj(hitObj);
                            linePosCount += 1;
                            lineSize     += 1;
                            CLine.CLineRender(hitObj, linePosCount, lineSize);
                            Bigger(hitObj);
                            currentTga = Paturu.TagName2;
                            SwichType  = false;
                            m_SoundManager.PlaySE((int)GameSoundManager.SoundInfo.se_puzzle_link, 1.0f, startTime);
                        }
                    }


                    break;
                }
            }
            //var dist2 = Vector2.Distance(mousePos(), DeleteList[DeleteList.Count - 2].transform.position);
            if (hitObj.tag == Paturu.FinishTagName && hitObj != Last_Paturu)
            {
                // Last_Paturu = hitObj;
                if (DeleteList.Count > 1)
                {
                    var dist  = Vector2.Distance(Last_Paturu.transform.position, hitObj.transform.position);
                    var dist2 = Vector2.Distance(mousePos(), DeleteList[DeleteList.Count - 2].transform.position);
                    if (dist <= distance && dist2 <= 0.3)
                    {
                        if (SkillCostManager.Skill_Control.Water6Swich && SkillCostManager.GetSkill6Code() != null &&
                            PaturuControy.waterskill_six.StartCountDown >= 0)
                        {
                            SkillCostManager.GetSkill6Code().CountBackControl(DeleteList[DeleteList.Count - 1]);
                        }
                        if (PaturuControy.waterskill_six.StartCountDown >= 0)
                        {
                            DraggingSKill6(hitObj, First_Paturu, FirstNameTag);
                        }
                        Last_Paturu = hitObj;
                        GameObject node;
                        Back = true;
                        Smaller(DeleteList[DeleteList.Count - 1]);
                        TagModori(DeleteList[DeleteList.Count - 1]);
                        if (DeleteList[DeleteList.Count - 1].tag == Paturu.RinkuName)
                        {
                            currentTga = Tag_ColorControlName;
                        }
                        SwichType = false;
                        // DeleteList[DeleteList.Count - 1].tag = "Finish";
                        //Debug.Log(DeleteList[DeleteList.Count - 1].tag);
                        node = CLine.Nodes_list[CLine.Nodes_list.Count - 1];
                        CLine.Nodes_list.Remove(CLine.Nodes_list[CLine.Nodes_list.Count - 1]);
                        Destroy(node);
                        lineSize     -= 1;
                        linePosCount -= 1;
                        CLine.SetlineSize(lineSize);
                        DeleteList.Remove(DeleteList[DeleteList.Count - 1]);
                        // PaturuControy.Skill.Water6Swich = true;
                    }
                }
                else if (DeleteList.Count == 1)
                {
                    Last_Paturu = hitObj;
                    SwichType   = false;
                    //currentTga = hitObj.tag;
                }
                if (hitObj.name == NPaturu.RinkuName)
                {
                    currentTga = Paturu.RinkuName;

                    PaturuControy.sethitobjCancel(Tag_ColorControlName2);
                    PaturuControy.ImagesControy(First_Paturu, Tag_ColorControlName);
                    SwichType = true;
                }
            }
            if (Back)
            {
                {
                    if (hitObj.tag == Paturu.TagName0 || hitObj.tag == Paturu.TagName1 ||
                        hitObj.tag == Paturu.TagName2 || hitObj.tag == Paturu.RinkuName)
                    {
                        Back = false;
                    }
                }
            }
        }
    }