Esempio n. 1
0
        public void ResetGame()
        {
            view.ShowPlayer();
//			nutCount = 0;
            int rowCounter = 0;

            pathTiles             = new List <RecorridosTile>();
            gridSpace[rowCounter] = new RecorridosTile[7];

            boardMatrix = board.GenerateBoard(lvls [currentLevel]);

            for (int i = 0; i < boardPosition.transform.childCount; i++)
            {
                if (i % 7 == 0 && i != 0)
                {
                    rowCounter++;
                    gridSpace[rowCounter] = new RecorridosTile[7];
                }
                int key = boardMatrix [rowCounter] [i % 7];
                RecorridosTileEnum tile = keys[key];

                Sprite spriteToPut;
                tileDictionary.TryGetValue(tile, out spriteToPut);

                gridSpace[rowCounter][i % 7] = new RecorridosTile(tile,
                                                                  boardPosition.transform.GetChild(i).transform.position, spriteToPut, boardPosition.transform.GetChild(i).GetComponent <Image>(), rowCounter, i % 7);
            }

            puppetGridPosition        = board.GetStartPosition();
            initialPuppetGridPosition = board.GetStartPosition();
            EnableButtonState(true);
            view.ResetGame();
            player.transform.position = gridSpace[(int)initialPuppetGridPosition.x][(int)initialPuppetGridPosition.y].Position;
            actionsToDo = new List <RecorridosAction>();
        }
Esempio n. 2
0
        IEnumerator GoRolling(float inTime, RecorridosTile newTile)
        {
            var fromPosition = player.transform.position;

            for (var t = 0f; t < 1; t += Time.deltaTime / inTime)
            {
                player.transform.position = Vector3.Lerp(fromPosition, newTile.Position, t);
                player.transform.Rotate(0, 0, 5, Space.Self);
                yield return(null);
            }
            player.transform.eulerAngles = new Vector3(0, 0, 0);
            view.MovingDown();
            StartCoroutine(ResetList(0, true));

            EnableButtonState(true);
        }
Esempio n. 3
0
        IEnumerator DoMove(float inTime, RecorridosTile newTile)
        {
            var fromPosition = player.transform.position;

            for (var t = 0f; t < 1; t += Time.deltaTime / inTime)
            {
                player.transform.position = Vector3.Lerp(fromPosition, newTile.Position, t);
                yield return(null);
            }
            player.transform.position = newTile.Position;
            view.LightValue(currentValueAnalyzed, false, Color.clear);
            actionsToDo.RemoveAt(0);
            currentValueAnalyzed++;
            yield return(new WaitForSeconds(0.5f));

            newTile.RunAction();
        }