Beispiel #1
0
 public void StartBandMode()
 {
     if (ModeCondition != Mode.Band && CurrentCube != null)
     {
         ModeCondition  = Mode.Band;
         cam.ViewSwitch = false;
         CurrentCube    = gridController.Cubes[CurrentCube.PosInCanvas.x, CurrentCube.PosInCanvas.y];
         StartCoroutine(bandGenerator.StartGeneration());
         smallHam.SetActive(true);
     }
 }
Beispiel #2
0
    public void StartCanvasMode()
    {
        CurrentCube = null;
        frame.ClearLine();
        ModeCondition         = Mode.Canvas;
        cam.ViewSwitch        = !cam.ViewSwitch;
        bandGenerator.started = false;
        HammerHit ham = smallHam.GetComponent <HammerHit>();

        smallHam.transform.localPosition = ham.pos;
        smallHam.transform.localRotation = ham.rot;
        smallHam.SetActive(false);
    }
Beispiel #3
0
 public void PressCube(CubeInCanvas pressed)
 {
     if (CurrentCube == pressed)
     {
         if (frameCondition != Frame.Vertical)
         {
             frameCondition = (Frame)((int)frameCondition + 1);
         }
         else
         {
             frameCondition = Frame.Horizontal;
         }
     }
     else
     {
         CurrentCube = pressed;
     }
     SetFrame();
 }
Beispiel #4
0
    public void SetNextCube()
    {
        remaining    += 1;
        CubesPainted += 1;
        if (CubesPainted == gridController.SquareOfArt)         // if the art if completly painted over
        {
            pixelArts.Pushback(imageLoader.PixArts[0].Texture); // adds completed picture to array
            UnityEngine.SceneManagement.SceneManager.LoadScene("MainMenu");
        }
        if (frameCondition == Frame.Horizontal)
        {
            Vector2Int posCube = CurrentCube.PosInCanvas;

            if (posCube.x != gridController.ArtWidth - 1)
            {
                CurrentCube = gridController.Cubes[posCube.x + 1, posCube.y];
                posCube     = CurrentCube.PosInCanvas;
                if (!CurrentCube.isFree)
                {
                    if (CurrentCube.PosInCanvas.y == 0)
                    {
                        StartCanvasMode();
                    }
                    else
                    {
                        CurrentCube = gridController.Cubes[0, CurrentCube.PosInCanvas.y - 1];
                        while (!CurrentCube.isFree && CurrentCube.PosInCanvas.x != posCube.x)
                        {
                            CurrentCube = gridController.Cubes[CurrentCube.PosInCanvas.x + 1, CurrentCube.PosInCanvas.y];
                        }
                        if (CurrentCube.PosInCanvas.x == posCube.x)
                        {
                            StartCanvasMode();
                        }
                    }
                }
                if (CurrentCube.PosInCanvas.y == 0)
                {
                    StartCanvasMode();
                }
                else
                {
                    SetFrame();
                }
            }
            else  // if the row ends
            {
                CurrentCube = gridController.Cubes[0, CurrentCube.PosInCanvas.y - 1];
                while (!CurrentCube.isFree && CurrentCube.PosInCanvas.x != posCube.x)
                {
                    CurrentCube = gridController.Cubes[CurrentCube.PosInCanvas.x + 1, CurrentCube.PosInCanvas.y];
                }
                if (CurrentCube.PosInCanvas.x == posCube.x)
                {
                    StartCanvasMode();
                }
            }
        }
        else
        {
            Vector2Int posCube = CurrentCube.PosInCanvas;

            if (posCube.x != 0)
            {
                CurrentCube = gridController.Cubes[posCube.x, posCube.y + 1];
                posCube     = CurrentCube.PosInCanvas;
                if (!CurrentCube.isFree)
                {
                    if (CurrentCube.PosInCanvas.x == gridController.ArtWidth - 1)
                    {
                        StartCanvasMode();
                    }
                    else
                    {
                        CurrentCube = gridController.Cubes[CurrentCube.PosInCanvas.x + 1, 0];
                        while (!CurrentCube.isFree && CurrentCube.PosInCanvas.y != posCube.y)
                        {
                            CurrentCube = gridController.Cubes[CurrentCube.PosInCanvas.x, CurrentCube.PosInCanvas.y + 1];
                        }
                        if (CurrentCube.PosInCanvas.y == posCube.y)
                        {
                            StartCanvasMode();
                        }
                    }
                }
                if (CurrentCube.PosInCanvas.y == gridController.ArtWidth - 1)
                {
                    StartCanvasMode();
                }
                else
                {
                    SetFrame();
                }
            }
        }
    }