Beispiel #1
0
    // Thank you to Medium article writter for this method of tile testing.
    private void DisplayTileData(Vector3Int localPoint)
    {
        var tiles = Overworld.GetInstance().GetTiles(); // This is our Dictionary of tiles

        if (tiles.TryGetValue(localPoint, out _tile))
        {
            print("Tile " + _tile.Name + " x: " + _tile.LocalPlace.x + " y: " +
                  _tile.LocalPlace.y + " costs: " + _tile.Cost);
            _tile.TilemapMember.SetTileFlags(_tile.LocalPlace, TileFlags.None);
            _tile.TilemapMember.SetColor(_tile.LocalPlace, Color.cyan);
        }
    }
    public void Start()
    {
        // Cannot be initialized during Awake!!
        overworld = Overworld.GetInstance();
        oManager  = OverworldManager.GetInstance();

        m_MyRigidbody2D    = GetComponent <Rigidbody2D>();
        m_NextMovementTime = Time.time;
        var localPoint = new Vector3Int(Mathf.FloorToInt(transform.position.x),
                                        Mathf.FloorToInt(transform.position.y), 0);

        // Start off position
        if (OnCursorMove != null)
        {
            OnCursorMove(localPoint);
        }
    }