public int HitStack(Vector2Int scoop) { if (CurrentCone.ValidLane(scoop.x)) { if (scoop.y <= ConeStackHeight() && scoop.y >= ConeStackHeight() - 2) { return(scoop.y); } } return(-1); }
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; }
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); } }
public int ConeStackHeight() { return(CurrentCone.StackHeight()); }
public int ConeLane() { return(CurrentCone.Lane()); }
public void AddScoopToCone(Scoop scoop) { CurrentCone.AddScoop(scoop); }
public void GameOver() { FreezeGame(); CurrentCone.GameOver(); }
public void ScoopTapped(int index) { CurrentCone.HandleScoopTap(index); }
public void DebugStack(string intro, List <Scoop> stack) { CurrentCone.Debug_ScoopList(intro, stack); }
private void SwapCones() { CurrentCone.Hide(); IncrementCurrentConeIndex(); CurrentCone.Show(); }