Example #1
0
        public static Vector3 GetUnderPoint(GameEntity ent)
        {
            var objPos = ent.transform.position;
            var rend   = ent.GetComponent <Collider2D>();

            return(ClickManager.GetPosForChooser(objPos, rend.bounds.size, ent.transform.localScale));
        }
Example #2
0
        public static void SetupPrevBar(GameEntity ent, Map.MapTypes type)
        {
            if (TpDict.ContainsKey(ent))
            {
                return;
            }

            var bar = staticPrevBar.GetComponent <RectTransform>();

            var objPos = ent.Current3Dpos;

            var rend = ent.GetComponent <SpriteRenderer>();
            var posR = ClickManager.GetPosForChooser(objPos, rend.size, new Vector3());


            var prevBar = Instantiate(bar.gameObject,
                                      objPos,
                                      bar.rotation);

            prevBar.transform.SetParent(ent.transform);
            prevBar.transform.position = new Vector3(objPos.x, posR.y + bar.rect.height, -3);

            var button = prevBar.transform.GetChild(0).GetComponent <Button>();

            var prevChunk = ChunkConnecter.GetFromConnection(type, ent.ChunkNumber);

            button.onClick.AddListener(delegate { ChunkManager.ChangeChunkTo(prevChunk); });

            TpDict.Add(ent, prevBar);
        }
Example #3
0
        public static GameObject SetupPoint(GameEntity ent)
        {
            if (pointList.ContainsKey(ent))
            {
                return(pointList[ent]);
            }
            var objPos = ent.transform.position;
            var rend   = ent.GetComponent <Collider2D>();
            var posR   = ClickManager.GetPosForChooser(objPos, rend.bounds.size, ent.transform.localScale);

            var pos = new Vector3(objPos.x,
                                  posR.y + BarHeight / value
                                  , objPos.z * 10);

            var point = new GameObject("Point");

            point.transform.position = pos;

            point.transform.SetParent(ent.transform);


            pointList[ent] = point;
            return(point);
        }