Ejemplo n.º 1
0
    public void Setup(Vector2 _gridPos, Vector2 _roomPos, RoomType _type, bool _doorTop, bool _doorRight, bool _doorBot, bool _doorLeft, int _numberOfNeighbours, Sprite _roomIconForMap)
    {
        gridPos             = _gridPos;
        roomPos             = _roomPos;
        type                = _type;
        doorTop             = _doorTop;
        doorBot             = _doorBot;
        doorLeft            = _doorLeft;
        doorRight           = _doorRight;
        numberOfNeighbours  = _numberOfNeighbours;
        roomIconForMap      = _roomIconForMap;
        defaultRoomColor    = MapSpriteSelector.PickColor(type);
        activeRoomColor     = MapSpriteSelector.PickColor(RoomType.Active);
        mortalEnemiesInRoom = GetComponentsInChildren <Enemy>();

        CMCamera = GetComponentInChildren <CinemachineVirtualCamera>();
        if (type == RoomType.BaseRoom)
        {
            CMCamera.Priority = 15;
            isActive          = true;
        }
        MakeDoors();
    }
Ejemplo n.º 2
0
    public void InstantiateMapSprite(Transform parent)
    {
        objectWithMapSprite      = new GameObject();
        objectWithMapSprite.name = "Map Piece";

        SpriteRenderer renderer = objectWithMapSprite.AddComponent <SpriteRenderer>();

        renderer.sprite = roomIconForMap;
        renderer.color  = MapSpriteSelector.PickColor(type);

        Vector2 drawPos = gridPos;

        drawPos.x *= 16;//aspect ratio of map sprite HAS TO BE THE SAME LIKE IN LEVEL GENERATION IN DRAWMAP
        drawPos.y *= 8;

        drawPos += new Vector2(-500, 500);

        objectWithMapSprite.transform.position = drawPos;
        if (parent != null)
        {
            objectWithMapSprite.transform.parent = parent;
        }
        // Instantiate(objectWithMapSprite, drawPos, Quaternion.identity);
    }