using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class MapSection : MonoBehaviour
|
|
{
|
|
public int width = 0;
|
|
public int length = 0;
|
|
int size;
|
|
public string sectionName = "";
|
|
|
|
//Lists of spawn points
|
|
//One for each possible number of players
|
|
public List<GameObject> spawns1;
|
|
public List<GameObject> spawns2;
|
|
public List<GameObject> spawns3;
|
|
public List<GameObject> spawns4;
|
|
public List<GameObject> spawns5;
|
|
public List<GameObject> spawns6;
|
|
public List<GameObject> spawns7;
|
|
public List<GameObject> spawns8;
|
|
|
|
//Lists of each type of block, assigned in the inspector
|
|
public List<GameObject> boulders;
|
|
public List<GameObject> belts;
|
|
public List<GameObject> cannons;
|
|
public List<GameObject> pits;
|
|
public List<GameObject> spikes;
|
|
public List<GameObject> track;
|
|
public List<GameObject> walls;
|
|
public List<GameObject> water;
|
|
public List<GameObject> blocks; //Complete list of all blocks, cleared & filled on creation
|
|
|
|
public List<GameObject> entrances; //Ways into this map segment
|
|
public List<GameObject> exits; //Ways out of this map segment
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
}
|
|
|
|
public void InitSection()
|
|
{
|
|
size = width * length;
|
|
blocks = new List<GameObject>();
|
|
blocks.AddRange(boulders);
|
|
blocks.AddRange(belts);
|
|
blocks.AddRange(cannons);
|
|
blocks.AddRange(pits);
|
|
//blocks.AddRange(spawns);
|
|
blocks.AddRange(spikes);
|
|
blocks.AddRange(track);
|
|
blocks.AddRange(walls);
|
|
blocks.AddRange(water);
|
|
}
|
|
|
|
public void InitSection(int num)
|
|
{
|
|
name = num + " " + name;
|
|
InitSection();
|
|
}
|
|
|
|
public int getSize()
|
|
{
|
|
return size;
|
|
}
|
|
|
|
public void destroySection()
|
|
{
|
|
/*foreach (GameObject block in blocks)
|
|
{
|
|
Object.Destroy(block);
|
|
}*/
|
|
|
|
/*Debug.Log("Destroying section " + name + ", position = " + transform.position.x + ", " + transform.position.y + ", " + transform.position.z);
|
|
gameObject.transform.position = new Vector3(0.0f, 0.0f, 1000.0f);*/
|
|
Debug.Log("Destroying section " + name + ", position = " + transform.position.x + ", " + transform.position.y + ", " + transform.position.z);
|
|
//gameObject.SetActive(false);
|
|
Destroy(gameObject);
|
|
}
|
|
}
|