Example #1
0
        public ChoiceData(GLoader loader, Vector2 point, Vector2 postion, Vector2 sizev2,
                          ChoicetypeData LeftChoicetypeData, ChoicetypeData RightChoicetypeData, ChoicetypeData UpChoicetypeData, ChoicetypeData DownChoicetypeData)
        {
            gLoader = loader;

            center = point;
            pos    = postion;
            size   = sizev2;
            ChoicetypeDic.Add("Left", LeftChoicetypeData);
            ChoicetypeDic.Add("Right", RightChoicetypeData);
            ChoicetypeDic.Add("Up", UpChoicetypeData);
            ChoicetypeDic.Add("Down", DownChoicetypeData);
            Vector3 pointv3 = new Vector3(point.x, point.y, 0f);
            Vector3 sizev3  = new Vector3(sizev2.x, sizev2.y, 1f);

            bounds = new Bounds(pointv3, sizev3);
        }
Example #2
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);
        }