Vector2 roomSizeInTiles = new Vector2(15, 23);//(15, 23) //The setup script. public void Setup(Texture2D _tex, Vector2 _gridPos, int _type, bool _doorTop, bool _doorBot, bool _doorLeft, bool _doorRight) { tex = _tex; gridPos = _gridPos; type = _type; doorTop = _doorTop; doorBot = _doorBot; doorLeft = _doorLeft; doorRight = _doorRight; isInRoom = false; if (type == 1)//If type == 1, then this is the starting room; otherwise it is a standard room w/ clear condition { isCleared = true; } else { isCleared = false; } levelGenManager = GameObject.Find("Level Generator").GetComponent <LevelGeneration>(); MakeDoors(); GenerateRoomTiles(); }
public void Setup() { for (int i = 0; i < numberOfLevels; i++) { GameObject m_LevelGo = new GameObject("LevelRoot_" + (i + 1)); m_LevelGo.transform.parent = transform; GameObject m_MiniMapGo = new GameObject("MiniMapRoot_" + (i + 1)); m_MiniMapGo.transform.parent = m_LevelGo.transform; LevelGeneration m_LevelGen = GetComponent <LevelGeneration>(); m_LevelGen.Setup(mapSize, m_MiniMapGo.transform); levelsData[i + 1] = m_LevelGo; AddRoomsToWorld(m_LevelGo, m_LevelGen.levelRooms, i + 1); bool exit = (i == numberOfLevels - 1); SelectAndPlaceStair(i + 1, m_LevelGo.transform, exit); SelectAndPlaceItemSpawner(batteryLocations, i + 1, m_LevelGo.transform, batteryItem); m_Grid.CreateGrid(GetGridWorldSize(), GetGridRoomSize()); if (i != (currentLevel - 1)) { m_LevelGo.SetActive(false); } } }
// Use this for initialization void Start () { level = GameObject.FindGameObjectWithTag("levelGen").GetComponent<LevelGeneration>(); checkMovement = GetComponent<BoxCollider2D>(); rb = GetComponent<Rigidbody2D>(); checkMovement.offset = new Vector2(0, -1); }
public Game() { InitializeComponent(); // Initialise sound tracks Logging.Log(LogType.LOG, "Initialsing soundtracks"); backgroundMusic = new Sound(FileSystem.GetAsset("Sounds/Soundtrack.wav")); // Initialise differnet platforms Logging.Log(LogType.LOG, "Initialsing level"); level = new LevelGeneration(Controls); level.Generate(); // Initialise player Logging.Log(LogType.LOG, "Initialsing player"); player = new Player(playerControl); player.GetPlayer().BackgroundImage = Options.GetPlayerImage(); player.GetPlayer().SendToBack(); // Send the background backwards so that the platforms are visible background.SendToBack(); // Initialise hearts Logging.Log(LogType.LOG, "Populating heart array"); hearts.Add(heart1); hearts.Add(heart2); hearts.Add(heart3); // Start playing the soundtrack backgroundMusic.Play(); }
private void GenerateMinimap() { GameObject go = GameObject.FindWithTag("Level"); LevelGeneration level = go.GetComponent <LevelGeneration>(); _minimap.GenerateMinimap(level.Rooms); }
public void InitCard(LevelGeneration board, Vector2 boardindex, Player player, CardType type) { this.board = board; this.player = player; boardIndex = boardindex; cardType = type; if (cardType == CardType.NONE) { int index = Random.Range(0, 3); switch (index) { case 1: cardType = CardType.Enemy; break; case 2: cardType = CardType.Obstacle; break; case 3: cardType = CardType.NONE; break; default: cardType = CardType.NONE; break; } } if (cardType == CardType.Entry) { flipper.flipped = true; } }
//Lockdown Timer Variables //private float runTimer; //private bool timerActive; //private bool switchedRooms; public void Initialize() { controllerInput = FindObjectOfType <ControllerInputSystem>().GetComponent <ControllerInputSystem>(); levelGenerator = GetComponent <LevelGeneration>(); roomManager = GetComponent <RoomManager>(); cameraFollow = GameObject.Find("Main Camera").GetComponent <CameraSmoothFollow>(); minimapCamera = FindObjectOfType <MinimapCamera>(); audienceManager = FindObjectOfType <AudienceInteractable>().GetComponent <AudienceInteractableManager>(); websiteData = new WebsiteScript(connectWebsite); StartCoroutine(websiteData.LockFaction(2, 0, "")); screenUI = FindObjectOfType <ScreenUISystem>().GetComponent <ScreenUISystem>(); enemyManager = new EnemyManager(); // Setup level layout levelGenerator.CreateLayout(); roomManager.SpawnLayout(levelGenerator.GetGridSpaces(), levelGenerator.GetSecureRoomNum()); audienceManager.InitializeInteractables(); player = FindObjectOfType <PlayerController>(); timer = 0; // Game Variables moneyCollected = 0; //runTimer = 600; //switchedRooms = false; }
public DataStaticObjects() { //staticObjects = new List<string>(); LevelGeneration level = PlayerManager.instance.levelGeneration; //Transform[] transforms = level.environment.transform.GetComponentsInChildren<Transform>().Skip(1).ToArray(); GameObject[] sceneObjects = GameObject.FindGameObjectsWithTag("StaticObject"); length = sceneObjects.Length; staticObjects = new string[length]; position = new float[length, 3]; rotation = new float[length, 3]; for (int i = 0; i < length; i++) { staticObjects[i] = SaveSystem.GetPrefabName(sceneObjects[i].name); position[i, 0] = sceneObjects[i].transform.position.x; position[i, 1] = sceneObjects[i].transform.position.y; position[i, 2] = sceneObjects[i].transform.position.z; rotation[i, 0] = sceneObjects[i].transform.rotation.eulerAngles.x; rotation[i, 1] = sceneObjects[i].transform.rotation.eulerAngles.y; rotation[i, 2] = sceneObjects[i].transform.rotation.eulerAngles.z; } }
public void Begin() { gen = Camera.main.GetComponent <LevelGeneration>(); foreach (Transform child in transform) { Destroy(child.gameObject); } if (plain) { return; } // This is the logic for creating each platform and furnishing it with items if (Random.value < 0.7f) { // This is the scenery half. We might add something to this platform that is purely visual if (Random.value <= 0.5f) { GameObject carrotObject = Platform.carrotPool.Place(transform.position + new Vector3(0, 0.5f, 0)); gen.carrots.Add(carrotObject); } } else { // This is the item half - we may add items on this platform float genVal = Random.value; if (genVal >= 0 && genVal < CHANCE_COINS) { // coins GameObject coinObject = Platform.coinPool.Place(transform.position); gen.coins.Add(coinObject); //coinObject.transform.parent = transform; //coin.SetActive(true); } else if (genVal >= CHANCE_COINS && genVal < CHANCE_COINS + CHANCE_PICKUP) { // pickup GameObject powerupObject = Platform.powerupPool.Place(transform.position); gen.powerups.Add(powerupObject); //pickupObject.transform.parent = transform; } else if (genVal >= CHANCE_COINS + CHANCE_PICKUP && genVal < CHANCE_COINS + CHANCE_PICKUP + CHANCE_SPRING) { // spring GameObject springObject = Platform.springPool.Place(transform.position); gen.springs.Add(springObject); //springObject.transform.parent = transform; } else if (genVal >= CHANCE_COINS + CHANCE_PICKUP + CHANCE_SPRING && genVal < CHANCE_COINS + CHANCE_PICKUP + CHANCE_SPRING + CHANCE_ENEMY) { // enemy } else if (genVal >= CHANCE_COINS + CHANCE_PICKUP + CHANCE_SPRING + CHANCE_ENEMY && genVal < CHANCE_COINS + CHANCE_PICKUP + CHANCE_SPRING + CHANCE_ENEMY + CHANCE_SPIKES) { // spikes GameObject spikesObject = Platform.spikesPool.Place(transform.position); gen.spikes.Add(spikesObject); //spikesObject.transform.parent = transform; } } }
public void ClearEvents() { //loop through every event and unsubscribe the events if (LevelGeneration != null) { foreach (var eventDelegate in LevelGeneration.GetInvocationList()) { LevelGeneration -= (eventDelegate as EventHandler); } } if (LevelBaking != null) { foreach (var eventDelegate in LevelBaking.GetInvocationList()) { LevelBaking -= (eventDelegate as EventHandler); } } if (LevelPopulation != null) { foreach (var eventDelegate in LevelPopulation.GetInvocationList()) { LevelPopulation -= (eventDelegate as EventHandler); } } if (PlayerPopulation != null) { foreach (var eventDelegate in PlayerPopulation.GetInvocationList()) { PlayerPopulation -= (eventDelegate as EventHandler); } } if (PostPlayer != null) { foreach (var eventDelegate in PostPlayer.GetInvocationList()) { PostPlayer -= (eventDelegate as EventHandler); } } if (FinalizeObjectPools != null) { foreach (var eventDelegate in FinalizeObjectPools.GetInvocationList()) { FinalizeObjectPools -= (eventDelegate as EventHandler); } } if (FinalStep != null) { foreach (var eventDelegate in FinalStep.GetInvocationList()) { FinalStep -= (eventDelegate as EventHandler); } } }
private void Start() { templates = GameObject.FindGameObjectWithTag("Templates").GetComponent <DungeonPrefabs>(); stats = GameObject.FindGameObjectWithTag("Level").GetComponent <LevelGeneration>(); door = this.transform.GetChild(0).GetComponentInChildren <DoorWay>(); //Invoke("Spawn", 0.1f); }
// Use this for initialization void Start () { InvokeRepeating("calculateScore", 0, 1); circleText.text = "Circle 1"; level = GameObject.Find("levelObject").GetComponent<LevelGeneration>(); }
// Use this for initialization void Start() { LevelGeneration levelGenerator = new LevelGeneration(mapSize); map = levelGenerator.MakeMap(); DrawLevel(); }
// Start is called before the first frame update void Start() { player = GameObject.FindGameObjectWithTag("Player"); mainCamera = GetComponentInChildren <Camera>(); levelGenerationManager = GameObject.FindGameObjectWithTag("LevelGenManager").GetComponent <LevelGeneration>(); InvokeRepeating("triggerTargetRay", 0.1f, 0.2f); }
public void check_level_gen() { LevelGeneration level_gen = new LevelGeneration(); if (level_gen.tile == null) { Debug.Log("tiles are saved as gameobject"); } }
// Start is called before the first frame update void Start() { SceneManager.sceneLoaded += OnSceneLoaded; rb = GetComponent <Rigidbody2D>(); source = GetComponent <AudioSource>(); faceIndicator = transform.GetChild(0).gameObject; indicators = GetComponentsInChildren <SpriteRenderer>(); for (int i = 2; i < indicators.Length - 3; i++) // - 3 because head/torso/bottom is a child too { indicators[i].enabled = false; } attackBoxes = GetComponentsInChildren <PolygonCollider2D>(); for (int i = 0; i < attackBoxes.Length; i++) { attackBoxes[i].enabled = false; } hitboxes = GetComponentsInChildren <Hitbox>(); spriteRenderers = GetComponentsInChildren <SpriteRenderer>(); xAxis = 0; yAxis = 0; movementVector = new Vector2(0, 0); facing = 0; mercyInvuln = false; mercyInvulnTimer = 0; dying = false; maxhealth = health; m_HUD.UpdateText(1.0f * health, maxhealth); prevPoints = 10; statPoints = 10; statPointsNumber.text = statPoints.ToString(); coins = 0; coinsNumber.text = coins.ToString(); stats = new int[5]; statsToAdd = new int[5]; for (int i = 0; i < pointsText.Length; i++) { stats[i] = 5; pointsText[i].text = stats[i].ToString(); } statsUI = GameObject.Find("InventoryCanvas").transform.Find( "Inventory").Find("Stat points"); statsUI.Find("Control Buttons").gameObject.SetActive(false); updateStats(); LevelGeneration levelGen = levelGenerator.GetComponent <LevelGeneration>(); xPos = levelGen.gridSizeX; yPos = levelGen.gridSizeY; rooms = levelGen.getRooms(); auraType = 0; }
void Start() { lootableContainers = new List <LootableContainer>(); levelGeneration = GameObject.Find("LevelGeneration").GetComponent <LevelGeneration>(); districtRooms = levelGeneration.BuildRooms(); // TESTING REMOVE ME LATER Initialize(10, 9, 8, 7, 6, districtRooms); // }
private void Start() { if (!levelGen) { levelGen = FindObjectOfType <LevelGeneration>(); } //Not technically a level compomplete, but will play first cutscene and gen the first level. GameManager.Instance.LevelComplete(); }
void Awake() { Init(); EventAggregator.Fall.Subscribe(OnFallEvent); EventAggregator.Match.Subscribe(OnMatchEvent); TilesResources.OpenTileFiles(); Tiles = LevelGeneration.GenerateLevel(LvlIndex); lenX = Tiles.GetLength(0); lenY = Tiles.GetLength(1); }
private void Start() { gameController = GameObject.FindWithTag("GameController").GetComponent <GameController>(); levelGenerator = GameObject.Find("LevelGenerator").GetComponent <LevelGeneration>(); objectScrolling = GetComponentInParent <ObjectScrolling>(); player = GameObject.FindGameObjectWithTag("Player"); }
void Start() { Time.timeScale = 1; levelGen = GetComponent <LevelGeneration>(); gUI = GetComponent <UI>(); minMaxX = levelGen.minMaxX; minMaxY = levelGen.minMaxY; setSpawnPoints(); spawnEnemies(numberOfEnemies); }
// Initialization void Start() { scoreText.text = score.ToString(); finalText.text = ""; retryBtn.gameObject.SetActive(false); mainMenuBtn.gameObject.SetActive(false); levelgen = new LevelGeneration(spawnLevel, enemies); NewLevel(level); levelText.text = "Niveau: " + level; }
public void Begin() { gen = Camera.main.GetComponent<LevelGeneration>(); foreach (Transform child in transform) Destroy(child.gameObject); if (plain) return; // This is the logic for creating each platform and furnishing it with items if (Random.value < 0.7f) { // This is the scenery half. We might add something to this platform that is purely visual if (Random.value <= 0.5f) { GameObject carrotObject = Platform.carrotPool.Place(transform.position + new Vector3(0, 0.5f, 0)); gen.carrots.Add(carrotObject); } } else { // This is the item half - we may add items on this platform float genVal = Random.value; if (genVal >= 0 && genVal < CHANCE_COINS) { // coins GameObject coinObject = Platform.coinPool.Place(transform.position); gen.coins.Add(coinObject); //coinObject.transform.parent = transform; //coin.SetActive(true); } else if (genVal >= CHANCE_COINS && genVal < CHANCE_COINS + CHANCE_PICKUP) { // pickup GameObject powerupObject = Platform.powerupPool.Place(transform.position); gen.powerups.Add(powerupObject); //pickupObject.transform.parent = transform; } else if (genVal >= CHANCE_COINS + CHANCE_PICKUP && genVal < CHANCE_COINS + CHANCE_PICKUP + CHANCE_SPRING) { // spring GameObject springObject = Platform.springPool.Place(transform.position); gen.springs.Add(springObject); //springObject.transform.parent = transform; } else if (genVal >= CHANCE_COINS + CHANCE_PICKUP + CHANCE_SPRING && genVal < CHANCE_COINS + CHANCE_PICKUP + CHANCE_SPRING + CHANCE_ENEMY) { // enemy } else if (genVal >= CHANCE_COINS + CHANCE_PICKUP + CHANCE_SPRING + CHANCE_ENEMY && genVal < CHANCE_COINS + CHANCE_PICKUP + CHANCE_SPRING + CHANCE_ENEMY + CHANCE_SPIKES) { // spikes GameObject spikesObject = Platform.spikesPool.Place(transform.position); gen.spikes.Add(spikesObject); //spikesObject.transform.parent = transform; } } }
private static void GenerateObstacles() { List <Obstacle> obsList = LevelGeneration.GenerateVoronoiCells(battlefieldSize * 0.5f - new Vector2(2, 2), -battlefieldSize * 0.5f + new Vector2(2, 2), (int)Math.Floor(battlefieldSize.X * 0.1f), 4, 1); //LevelGeneration.GenerateGrid(battlefieldSize * 0.5f - new Vector2(2,2), -battlefieldSize * 0.5f + new Vector2(2,2), (int)Math.Floor(battlefieldSize.X) / 6, 4, 0.75f); LevelGeneration.DestroyCellsOnTanks(ref obsList); //obsList[0].DestroyImmediate(); // obsList.RemoveAt(0); // obsList.CullRandom(0.35f); }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
//Singleton private void Awake() { if (LevelGeneration.ins == null) { LevelGeneration.ins = this; } else { Destroy(gameObject); } }
void OnSceneLoaded(Scene scene, LoadSceneMode mode) { Debug.Log("working"); levelGenerator = GameObject.Find("Level Generator"); m_gameManager = GameObject.Find("Game Manager").GetComponent <GameManager>(); LevelGeneration levelGen = levelGenerator.GetComponent <LevelGeneration>(); xPos = levelGen.gridSizeX; yPos = levelGen.gridSizeY; rooms = levelGen.getRooms(); auraType = 0; }
private void Start() { notificationGlobalController = FindObjectOfType <NotificationGlobalController>(); if (!notificationGlobalController) { Debug.LogError("Could not find notification controller"); } levelGeneration = FindObjectOfType <LevelGeneration>(); levelGeneration.OnDoneLevelGeneration += OnDoneLevel; timeTillExplosionCounter = Random.Range(minTimeTillExplosion, maxTimeTillExplosion); }
// Start is called before the first frame update void Start() { for (int i = 0; i < 3; i++) { int e = i + 1; string thisAdjective = adjective[(Random.Range(0, 5))]; string thisNoun = noun[(Random.Range(0, 5))]; string thisLevelName = ($"{thisAdjective} {thisNoun}"); levelChoice[i] = new LevelGeneration(thisLevelName, e, e); text[i] = $"{thisLevelName} \n \n \n \n Difficulty: {e} \n \nLoot: {e}"; } }
//public float[,] posinionX; //public float[,] posinionY; //public float[,] posinionZ; public DataGround() { LevelGeneration level = PlayerManager.instance.levelGeneration; mapSize = level.mapSize; Elevation = new float[mapSize, mapSize]; for (int i = 0; i < mapSize; i++) { for (int j = 0; j < mapSize; j++) { Elevation[i, j] = level.Tiles[i, j].Elevation; } } }
private void Awake() { gameData = GameObject.Find("DataController").GetComponent <GameData>(); levelGeneration = GameObject.Find("LevelGenerator").GetComponent <LevelGeneration>(); dazzaController = GameObject.FindWithTag("Player").GetComponent <DazzaController>(); upgradeController = GetComponent <UpgradeController>(); soundEffectSource = transform.GetChild(0).GetComponent <AudioSource>(); musicSource = transform.GetChild(1).GetComponent <AudioSource>(); gameData.ApplySelectedSkinFromPlayerPrefs(); dazzaController.GetComponent <SkinController>().SetSkin(gameData.selectedSkin); }
void Start() { levelGeneration = transform.parent.GetComponent <LevelGeneration>(); dazzaY = GameObject.FindWithTag("Player").GetComponent <Transform>().position.y; objectDeleter = GameObject.Find("ObjectDeleter"); speed = (levelGeneration.GetScrollSpeed() * Time.deltaTime); myAnimator = GetComponent <Animator>(); Destroy(gameObject, 10); }
// Start is called before the first frame update void Awake() { if (SceneManager.GetActiveScene().name == levelName) { levelGen = GameObject.FindGameObjectWithTag("LevelGenManager").GetComponent <LevelGeneration>(); if (levelGen != null) { levelGen.maximumRooms = numberOfRooms; } numberOfRooms += 5; } }
public override void OnAttach(MainCharacter mainCharacter) { _levelGen = mainCharacter.GameController.LevelGeneration; _closestDogLoc = new Vector3(1000.0f, 1000.0f, 1000.0f); ExclamationSprite.SetActive(true); }