コード例 #1
0
            private void DrawExit(SceneDataControl scene, ExitDataControl exit)
            {
                var scenes = Controller.Instance.SelectedChapterDataControl.getScenesList();
                var index  = scenes.getSceneIndexByID(exit.getNextSceneId());

                // If the exit points to a cutscene it normally is out of the array
                if (index < 0 || index > scenes.getScenes().Count)
                {
                    return;
                }

                var polygon = AdaptToViewport(GetExitArea(scene, exit), space);

                if (polygon == null || polygon.Length == 0)
                {
                    // If the exit is empty use the scene center itself to prevent errors
                    polygon = new [] { AdaptToViewport(GetSceneRect(scene), space).center };
                }

                var c = sceneColors[scene.getId()];

                c = new Color(c.r, c.g, c.b, 0.8f);
                HandleUtil.DrawPolygon(polygon, c);

                var nextScene = scenes.getScenes()[index];
                var sceneRect = AdaptToViewport(GetSceneRect(nextScene), space);

                Vector2 origin = polygon.Center(), destination;

                if (exit.hasDestinyPosition())
                {
                    destination   = new Vector2(exit.getDestinyPositionX(), exit.getDestinyPositionY());
                    destination.x = sceneRect.x + (destination.x / sizes[nextScene.getPreviewBackground()].x) * sceneRect.width;
                    destination.y = sceneRect.y + (destination.y / sizes[nextScene.getPreviewBackground()].y) * sceneRect.height;
                }
                else
                {
                    destination = sceneRect.ToPoints().Center();
                }

                HandleUtil.DrawPolyLine(new [] { origin, destination }, false, sceneColors[scene.getId()], 4);

                DrawArrowCap(destination, (destination - origin), 15f);
            }