Beispiel #1
0
 public int HitStack(Vector2Int scoop)
 {
     if (CurrentCone.ValidLane(scoop.x))
     {
         if (scoop.y <= ConeStackHeight() && scoop.y >= ConeStackHeight() - 2)
         {
             return(scoop.y);
         }
     }
     return(-1);
 }
Beispiel #2
0
    private void Awake()
    {
        LeanTween.LISTENERS_MAX = 25;
        PointsManager.Points    = 0;
        if (cam == null)
        {
            Debug.LogError("Cannot calculate grid bounds because camera is missing.");
            return;
        }
        float screenHeight = 2f * cam.orthographicSize;
        float screenWidth  = screenHeight * cam.aspect;

        laneWidth = screenWidth / numberOfLanes;
        rowHeight = screenHeight / numberOfRows;
        Bounds cameraBounds = new Bounds(cam.transform.position, new Vector3(screenWidth, screenHeight, 0));

        grid = new Grid(TotalRows, numberOfRows, numberOfLanes, rowHeight, laneWidth, cameraBounds).grid;

        if (scoopManager != null)
        {
            scoopManager.board = this;
        }
        else
        {
            Debug.LogError("ScoopManager is null for BoardManager");
        }

        cones.Add(Instantiate(conePrefab, transform.position, transform.rotation) as Cone);
        cones.Add(Instantiate(conePrefab, transform.position, transform.rotation) as Cone);
        foreach (Cone cone in cones)
        {
            cone.SetBoard(this);
            cone.Hide();
        }
        currentConeIndex = 0;
        CurrentCone.Show();

        audioSource       = gameObject.AddComponent <AudioSource>();
        livesCounter.text = "" + lives;

        Gestures.OnSwipe    += HandleSwipe;
        Gestures.SwipeEnded += EndSwipe;

        BoardManager.FreezeGame   += OnFreezeGame;
        BoardManager.UnfreezeGame += OnUnfreezeGame;
    }
Beispiel #3
0
    public void HandleSwipe(SwipeInfo swipe)
    {
        if (handlingSwipe ||
            swipe.Direction == SwipeInfo.SwipeDirection.UP)
        {
            return;
        }

        if (swipe.Direction == SwipeInfo.SwipeDirection.DOWN)
        {
            // SwapCones();
            // handlingSwipe = true;
            return;
        }
        if (TutorialActive())
        {
            if (CurrentTutorialStep() == Tutorial.TutorialStep.WaitingForSwipe)
            {
                if (swipe.Direction == SwipeInfo.SwipeDirection.RIGHT)
                {
                    UnfreezeGame();
                }
                else
                {
                    return;
                }
            }
            else
            {
                // Don't allow swiping unless the Tutorial Step is WaitingForSwipe
                return;
            }
        }
        handlingSwipe = true;
        if (CurrentCone != null)
        {
            coneTween = CurrentCone.MoveCone(swipe.Direction);
        }
    }
Beispiel #4
0
 public int ConeStackHeight()
 {
     return(CurrentCone.StackHeight());
 }
Beispiel #5
0
 public int ConeLane()
 {
     return(CurrentCone.Lane());
 }
Beispiel #6
0
 public void AddScoopToCone(Scoop scoop)
 {
     CurrentCone.AddScoop(scoop);
 }
Beispiel #7
0
 public void GameOver()
 {
     FreezeGame();
     CurrentCone.GameOver();
 }
Beispiel #8
0
 public void ScoopTapped(int index)
 {
     CurrentCone.HandleScoopTap(index);
 }
Beispiel #9
0
 public void DebugStack(string intro, List <Scoop> stack)
 {
     CurrentCone.Debug_ScoopList(intro, stack);
 }
Beispiel #10
0
 private void SwapCones()
 {
     CurrentCone.Hide();
     IncrementCurrentConeIndex();
     CurrentCone.Show();
 }