Esempio n. 1
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;
    }
Esempio n. 2
0
 private void SwapCones()
 {
     CurrentCone.Hide();
     IncrementCurrentConeIndex();
     CurrentCone.Show();
 }