예제 #1
0
        public static void InitDestructorMap(Destructor destructor)
        {
            var bounds = destructor.GetComponent <BoxCollider2D>().bounds;

            var min  = Vector3.zero - bounds.extents;
            var size = bounds.size;

            DestructorMap = new BoxMap(min, size);
        }
예제 #2
0
        public static void Init()
        {
            var camera = Camera.main;

            ScreenMapSize = new Vector2(Screen.width, Screen.height);
            ScreenMap     = new BoxMap(Vector3.zero, ScreenMapSize);

            Vector3 mappedScreen = camera.ScreenToWorldPoint(ScreenMapSize);
            Vector3 mappedZero   = camera.ScreenToWorldPoint(Vector2.zero);

            WorldMapSize = mappedScreen - mappedZero;

            WorldMap = new BoxMap(mappedZero, WorldMapSize);

            InverseWorldMapHeight = 1f / WorldMapSize.y;


            ScreenSizeToWorldSizeScale = new Vector2(WorldMap.Width / ScreenMap.Width, WorldMap.Height / ScreenMap.Height);
            WorldSizeToScreenSizeScale = new Vector2(ScreenMap.Width / WorldMap.Width, ScreenMap.Height / WorldMap.Height);
        }