コード例 #1
0
    public MyGame(string[] tmxFileNames, int levelIndex) :
        base(SCREEN_WIDTH, SCREEN_HEIGHT, FULLSCREEN) // Create a window that's 800x600 and NOT fullscreen
    {
        GL.ClearColor(1f, 1f, 1f, 1f);

        ThisInstance = this;

        _levelFiles = tmxFileNames;

        if (_levelFiles.Length == 0)
        {
            throw new ApplicationException(
                      $"_levelFiles.Length == 0, no tmx files found in {AppDomain.CurrentDomain.DynamicDirectory}");
        }

        LoadScoreBoardData();

        _mapData = TiledMapParserExtended.MapParser.ReadMap(_levelFiles[levelIndex]);

        _map = new MapGameObject(_mapData);

        _camera = new FollowCamera(0, 0, width, height);

        _canvasDebugger = new CanvasDebugger2(width, height);

        AddChild(SoundManager.Instance);

        var hudScreenFader = new HudScreenFader();

        StartScreen();

        //var startScreen = new StartScreen();
        //AddChild(startScreen);
    }
コード例 #2
0
    public CanvasDebugger2(int width, int height, GameObject drawer = null, bool addCollider = true) : base(width,
                                                                                                            height, false)
    {
        width  = Game.main.width;
        height = Game.main.height;

        SetOrigin(width * 0.5f, height * 0.5f);

        _drawer = drawer;
        if (_drawer == null)
        {
        }
        else
        {
            _drawer.AddChild(this);
        }

        Instance = this;

        this.name = "CanvasDebugger2_" + GetHashCode();

        Game.main.OnBeforeStep += ThisOnBeforeStep;
    }