public Piece(Puzzle _puzzle, uint _x, uint _y, List<uint> _indices) { puzzle = _puzzle; uint[] ind = _indices.ToArray (); computeBounds (ind); ComputeBorderIndices (_x, _y, ind); IndFill = earTriangulation(_indices); IsLinked = Enumerable.Repeat(false, puzzle.nbSides).ToArray(); Neighbours = new Piece[puzzle.nbSides]; }
protected override void OnUpdateFrame (FrameEventArgs e) { base.OnUpdateFrame (e); switch (currentState) { case GameState.Init: return; case GameState.CutStart: if (puzzle != null) puzzle.Dispose (); puzzle = new Puzzle (NbPceX, NbPceY, ImagePath); mainShader.Enable (); mainShader.ImgSize = new Vector2 (puzzle.Image.Width, puzzle.Image.Height); puzzle.Shuffle (); eyeDistTarget = puzzle.Image.Width * 1.5f; EyeDist = eyeDistTarget; currentState = GameState.Play; RebuildCache = true; return; case GameState.CutFinished: return; } GGL.Animation.ProcessAnimations (); if (RebuildCache) updateCache (); }
void closeCurrentPuzzle(){ currentState = GameState.Init; if (finishedMessage != null) { CrowInterface.DeleteWidget (finishedMessage); finishedMessage = null; } mainMenu.Visible = true; if (puzzle != null) puzzle.Dispose(); puzzle = null; }