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

added check for that stairs of been pressed to change location after deafating boss

parent 08eec84d
No related branches found
No related tags found
1 merge request!79Ruud1
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using BigSock.Interact;
using Cinemachine;
using UnityEngine;
using UnityEngine.Tilemaps;
using static System.Net.WebRequestMethods;
namespace Bigsock
......@@ -27,27 +24,32 @@ namespace Bigsock
GameObject[] enemies;
GameObject[] Chest;
List<GameObject> chests;
GameObject stair;
private int roomNr = 0;
bool stairs_down;
void Start()
{
chests = new List<GameObject>();
neighborMapGenerator.RunProceduralGeneration();
player = GameObject.Find("BigSock");
stair = GameObject.Find("Stairs(Clone)");
Chest = GameObject.FindGameObjectsWithTag("Chest");
foreach(GameObject c in Chest)
{
chests.Add(c);
c.SetActive(false);
}
stairs_down = stair.GetComponent<Stairs>().stairs_touch;
}
void LateUpdate()
{
boss = GameObject.FindGameObjectsWithTag("Boss");
enemies = GameObject.FindGameObjectsWithTag((roomNr).ToString());
stairs_down = stair.GetComponent<Stairs>().stairs_touch;
if (boss.Length == 0 && levels <= 1 && Input.GetKey(KeyCode.Return))
if (boss.Length == 0 && levels <= 1 && stairs_down)
{
roomNr = 0;
foreach(GameObject c in chests)
......@@ -57,9 +59,9 @@ namespace Bigsock
chests.Clear();
TilemapGenerator.resetMaps();
TilemapGenerator.SetRoomIDZero();
player.transform.position = new Vector3(9,5,0);
neighborMapGenerator.RunProceduralGeneration();
Chest = GameObject.FindGameObjectsWithTag("Chest");
Debug.Log("Size: " + Chest.Length);
foreach (GameObject c in Chest)
{
if(c != null)
......@@ -68,14 +70,12 @@ namespace Bigsock
chests.Add(c);
}
}
player.transform.position = new Vector3(9, 5, 0);
levels++;
}
int i = 0;
if(i == 0) {
cameraMap.InvalidateCache();
i++;
}
if (enemies.Length == 0)
......
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