Skip to content
Snippets Groups Projects
Commit 526a4cb6 authored by Robin Ruud Kristensen's avatar Robin Ruud Kristensen
Browse files

added so door can teleport player to new location

parent d65ecba0
No related branches found
No related tags found
2 merge requests!52Updating master,!42Ruud
using Bigsock;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
......@@ -8,11 +9,22 @@ public class Door : MonoBehaviour, IInteractable
public SpriteRenderer spriteRenderer;
public Sprite newSprite;
private GameObject player;
private GameObject cameraPlayer;
private int i = TilemapGenerator.NextRoom();
private GameObject boundary;
public string InteractionPrompt => _prompt;
public bool Interact(Interactor interactor) {
Debug.Log("Opening door!");
spriteRenderer.sprite = newSprite;
player = GameObject.Find("BigSock");
boundary = GameObject.Find("CameraBoundry");
cameraPlayer = GameObject.Find("Main Camera");
player.transform.position = TilemapGenerator.DoorLocaitonTransport(i);
cameraPlayer.transform.position = player.transform.position;
boundary.GetComponent<PolygonCollider2D>().SetPath(0, TilemapGenerator.GetRoom(i));
return true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment