Exemplo n.º 1
0
    private void Awake()
    {
        //Get player name from playerPrefs.
        playerName = PlayerPrefs.GetString("playerName");
        if (playerName == null || playerName == "")
        {
            Debug.LogError("Fail to get player name");
        }

        SettingUpGrid setUpGrid = GameObject.Find("GridPart").GetComponent <SettingUpGrid>();

        setUpGrid.SetUp();
    }
Exemplo n.º 2
0
    /// <summary>
    /// Initialize those variables which will be used in the movement script.
    /// Initialize the grid and blocks object and get the grid info from game manager.
    /// </summary>
    public void InitializeMovement()
    {
        //Get the components
        setUpGrid = GetComponent <SettingUpGrid>();
        manager   = GameObject.Find("_GameManager").GetComponent <GameManager>();
        if (!manager)
        {
            Debug.LogError("Failed to find game manager!");
        }

        //Get the information of the grid and array.
        gridSize       = manager.GetGridSize();
        blockNumEachR  = manager.GetBlockNumEachR();
        blocksPosition = manager.GetBlockPosition();
        array          = manager.GetArrayList();
        blocks         = manager.GetBlocksObject();

        //Initailize variables
        movingDirection = 0;
        addedCount      = 0;
        currentScore    = 0.0f;
    }