Exemplo n.º 1
0
        public int DetectHit(int currindex, Vector3 dir)
        {
            int        index      = -1;
            float      mint       = -1;
            ChoiceData choiceData = choiceDatalist[currindex];
            Vector3    center     = new Vector3(choiceData.center.x, choiceData.center.y, 0f);
            Ray        ray        = new Ray(center, dir);
            List <int> intlist    = new List <int>();

            for (int i = 0; i < choiceDatalist.Count; i++)
            {
                if (i != currindex)
                {
                    ChoiceData choice = choiceDatalist[i];
                    float      flo    = 0;
                    if (choice.DetectHit(ray, out flo))
                    {
                        if (mint == -1)
                        {
                            mint  = flo;
                            index = i;
                        }
                        else
                        {
                            if (flo < mint)
                            {
                                mint  = flo;
                                index = i;
                            }
                        }
                    }
                }
            }
            //if (intlist.Count == 1)
            //{
            //    index = intlist[0];
            //}
            //else if (intlist.Count > 0)
            //{
            //    for(int it= 0; it < intlist.Count; it++)
            //    {
            //        ChoiceData itemdata = choiceDatalist[intlist[it]];
            //        float dis = Vector2.Distance(itemdata.center, choiceData.center);
            //        if (it == 0)
            //        {
            //            mint = dis;
            //            index = intlist[it];
            //        }
            //        else
            //        {
            //            if (mint> dis)
            //            {
            //                mint = dis;
            //                index = intlist[it];
            //            }
            //        }
            //    }
            //}
            return(index);
        }
Exemplo n.º 2
0
        public void SetChoiceLoader(int index, bool show, string url, EquipData equipData = null, Action action = null)
        {
            ChoiceData choiceData = choiceDatalist[index];

            if (show)
            {
                choiceData.equipData       = equipData;
                choiceData.gLoader.visible = true;
                choiceData.gLoader.url     = url;
                choiceData.unEquiaAction   = action;
            }
            else
            {
                choiceData.equipData       = null;
                choiceData.gLoader.visible = false;
                choiceData.unEquiaAction   = null;
            }
        }
Exemplo n.º 3
0
        public int Choice(int currindex, choicedirection choicedirectionx)
        {
            ChoiceData     choiceData     = choiceDatalist[currindex];
            ChoicetypeData choicetypeData = choiceData.ChoicetypeDic[choicedirectionx.ToString()];
            int            toindex        = -1;

            if (choicetypeData.choicetype == choicetype.ray)
            {
                Vector3 dir = new Vector3();
                switch (choicedirectionx)
                {
                case choicedirection.Left:
                    dir = Vector3.left;
                    break;

                case choicedirection.Right:
                    dir = Vector3.right;
                    break;

                case choicedirection.Up:
                    dir = Vector3.up;
                    break;

                case choicedirection.Down:
                    dir = Vector3.down;
                    break;
                }
                toindex = DetectHit(currindex, dir);
            }
            else if (choicetypeData.choicetype == choicetype.fix)
            {
                toindex = choicetypeData.index;
            }
            else
            {
            }
            return(toindex);
        }
Exemplo n.º 4
0
        public void Unequia(int index)
        {
            ChoiceData choiceData = choiceDatalist[index];

            choiceData.unEquiaAction();
        }
Exemplo n.º 5
0
        public EquipData GetIndexEquipData(int index)
        {
            ChoiceData choiceData = choiceDatalist[index];

            return(choiceData.equipData);
        }
Exemplo n.º 6
0
        public Vector2 GetIndexPos(int index)
        {
            ChoiceData choiceData = choiceDatalist[index];

            return(choiceData.pos);
        }
Exemplo n.º 7
0
        public bool GetChoiceLoadervisible(int index)
        {
            ChoiceData choiceData = choiceDatalist[index];

            return(choiceData.gLoader.visible);
        }