Example #1
0
 // Use this for initialization
 public void Initialise(Vector2Int startpos, Scr_MapData mapref)
 {
     playerRef           = GetComponentInParent <Transform>();
     mapScr              = mapref;
     positionModifier_x -= (mapScr.map_size_x / 2);         // further align sprite display dependent on map size
     positionModifier_y -= (mapScr.map_size_y / 2);
     pos_x = startpos.x;
     pos_y = startpos.y;
     UpdatePlayerPosition();
 }
Example #2
0
    // Use this for initialization
    void Start()
    {
        playerScr = playerRef.GetComponent <Scr_Player>();
        mapScr    = mapRef.GetComponent <Scr_MapData>();

        mapScr.Initialise();
        Vector2Int startpos = new Vector2Int(1, 1);

        startpos = mapScr.FindTilePosition((int)Scr_MapData.TileType.START);
        if (startpos.x == -1 || startpos.y == -1)
        {
            Debug.Log("No start position on map!");
            startpos = new Vector2Int(1, 1);
        }
        playerScr.Initialise(startpos, mapScr);
    }