public void StartNewGame()
    {
        GameState = GameState.Play;
        _timer = 0;

        if (GameMap != null)
        {
            GameMap.ClearMap();
        }

        CurDangerlevel = 0;
        if (_mapGenerator == null)
            _mapGenerator = GetComponent<TutorialGenerator>();

        GameMap = _mapGenerator.CreateHexMap(_curMapSize, HexRadius);
        GameMap.CheckNeighbours();

        GameMap.GetTile(Vector2.zero).GetComponent<GameTile>().ThisType = GameTile.TileType.EMPTY;
        GameMap.GetTile(Vector2.zero).GetComponent<GameTile>().ActivateTile();

        CollectedTreasureAmount = 0;

        EnableSwipe = PlayerPrefs.GetInt("Swiping") == 0 ? false : true;
        ShowTutorial = PlayerPrefs.GetInt("Tutorial") == 0 ? false : true;

        RumLevel = 0;
        CurKrakenAmmount = 0;

        for (int i = 0; i < (int)TutorialInfo.Count; i++)
        {
            _tutorialIsShown[i] = false;
        }
        ShowTutorialInfo(TutorialInfo.Intro, null);
        ShowTutorialInfo(TutorialInfo.FirstMove, null);

        //Play the ambient sound effect
        AudioManager.Instance.PlayAmbientSfx("NewAmbienceSfx_00");

        _playerController = PlayerController.Instance;
        _playerController.StartGame();
        _player = _playerController.PlayerRef;
        _player.ArrivedOnHex += CheckCurrentTile;
        ActivateTileKeg(null);
    }
Example #2
0
    public void BeginTutorial()
    {
        Maze = new GameObject("Maze");
        Maze.transform.parent = GameParent.transform;

        //floor 1
        MazeNode[,] tutorial1 = TutorialGenerator.GenerateFloor1();

        //floor 2
        MazeNode[,] tutorial2 = TutorialGenerator.GenerateFloor2();

        //floor 3
        MazeNode[,] tutorial3 = TutorialGenerator.GenerateFloor3();

        //floor 4
        tutorial4 = TutorialGenerator.GenerateFloor4();

        tutorial1[0, 2].AddLadderTo(tutorial2[0, 0]);
        tutorial2[5, 2].AddLadderTo(tutorial3[0, 2]);
        tutorial3[4, 4].AddLadderTo(tutorial4[3, 3]);

        BeginPlay();

        for (int i = 0; i < 4; i++)
        {
            MazeNode[,] TutorialFloor = new MazeNode[7, 7];
            List <MazeNode> nodes;
            MazeSection     section = new MazeSection();
            //int[] sectionIDs = new int[4];
            switch (i)
            {
            case 0:
                TutorialFloor = tutorial1;
                break;

            case 1:
                TutorialFloor = tutorial2;
                break;

            case 2:
                TutorialFloor = tutorial3;
                break;

            case 3:
                TutorialFloor = tutorial4;
                break;
            }

            section.Root = TutorialFloor[0, 0];
            int sectionID = AnalyticsManager.AddSection(lvlID, 0, -4 + i);
            section.SectionID = sectionID;
            section.Spawned   = false;
            foreach (MazeNode n in MazeGenerator.nodesInSection(section.Root))
            {
                n.SectionID = section.SectionID;
            }
            //Sections.Add(section);
            nodes = MazeGenerator.nodesInSection(section.Root);
            SpawnSection(section);
        }

        Vector3 location = new Vector3(20, -119, 8);

        PlayerObj = Instantiate(Resources.Load(PlayerTypeLoc), location, tutorial1[0, 0].GetRotation()) as GameObject;
        GameObject.FindGameObjectWithTag("Player").AddComponent <Actor>().ActorID = AnalyticsManager.AddActor(SessionID, ActorType.Player);
        PlayerObj.transform.parent = GameParent.transform;
    }