Exemplo n.º 1
0
    public void MovePlayer(MapSquare currentSquare, MapSquare targetSquare)
    {
        PlayerMarker playerMarker = FindObjectOfType <PlayerMarker>();

        playerMarker.SetTargetPosition(targetSquare.GetPlayerMarkerPosition());
        playerMarker.moveTowardTargetPosition();
        playerMarker.SetCurrentSquare(targetSquare);

        currentSquare.UnsetPlayerPosition();
        targetSquare.SetPlayerPosition();
    }
    public void SetPlayerStart()
    {
        // If any player marker still exists, destroy it
        PlayerMarker[] oldPlayerMarkers = FindObjectsOfType <PlayerMarker>();
        foreach (PlayerMarker oldMarker in oldPlayerMarkers)
        {
            Destroy(oldMarker.gameObject);
        }

        SetPlayerPosition();
        PlayerMarker playerMarkerPrefab = parentRow.GetMapGrid().GetPlayerMarkerPrefab();
        Vector3      markerPosition     = GetPlayerMarkerPosition();
        PlayerMarker newPlayerMarker    = Instantiate(playerMarkerPrefab, markerPosition, Quaternion.identity);

        newPlayerMarker.SetCurrentSquare(this);
    }