private void OnDestroy() { if (_instance == this) { _instance = null; } }
// Start is called before the first frame update void Start() { spawner = GameObject.FindGameObjectWithTag("TargetSpawner").GetComponent <TargetSpawner>(); playerManager = GameObject.FindGameObjectWithTag("PlayerManager").GetComponent <PlayerManager>(); startTime = Time.time; audioSource = GetComponent <AudioSource>(); lifeTime = spawner.targetLifeTime; }
public override void AgentReset() { base.AgentReset(); TargetSpawner targetSpawner = target.GetComponent <TargetSpawner>(); targetSpawner.Respawn(); }
void OnDefeated() { EffectSpawner.GetInstance().Play(_defeatedEffect, _bodyCenterTransform.position); TargetSpawner.GetInstance().Spawn(); Destroy(this.gameObject); }
public Mines(ModifierType _type, ModifierParams.Default _modifierParams, ModifierParams.Mines _mineParams) { type = _type; defaultParams = _modifierParams; mineParams = _mineParams; defaultParams.duration = _mineParams.duration; defaultParams.cooldown = _mineParams.cooldown; spawner = TargetSpawnerManager.I.mSpawners[100]; }
private void Awake() { if (_instance == null) { _instance = this; } else if (_instance != null) { Destroy(this.gameObject); } }
private void OnEnable() { targetSpawner = (TargetSpawner)target; //if (targetDataList == null) // targetDataList = new ReorderableList(serializedObject,, true, true, true, true); //targetDataList.drawHeaderCallback += DrawNameHeader; //targetDataList.drawElementCallback += DrawNameElement; //targetDataList.onAddCallback += AddNameElement; //targetDataList.onRemoveCallback += RemoveNameElement; }
void Start() { //Reference ui = UIManager.instance; targetSpawn = TargetSpawner.instance; gun = GetComponent <Gun>(); //Initialize lives lives = MaxLives; UpdateLivesDisplay(); //Start spawning targets targetSpawn.StartSpawning(); }
void Spawn() { bool spawned = false; while (!spawned) { int n = Random.Range(0, _targetSpawnerList.Count); TargetSpawner spawner = _targetSpawnerList[n].GetComponent <TargetSpawner>(); if (!spawner.getHasSpawned()) { spawner.SpawnTarget(); spawned = true; } } }
// Use this for initialization void Start() { EnemySpawnPoints = new List <TargetSpawner>(); //FIll up the list. foreach (Transform t in transform) { TargetSpawner tspt = t.GetComponent <TargetSpawner>(); if (tspt) { EnemySpawnPoints.Add(tspt); } } }
void StartGame() { _streak = 1; _missStreak = 0; _currentScore = 0; _gameOn = true; LoadFootball(); if (_targetSpawner != null) { _targetSpawner.DestroyTargetsAndTargetSpawner(); } _targetSpawner = Instantiate(TargetSpawner) as TargetSpawner; _targetSpawner.OnTargetHit += TargetHit; _targetSpawner.OnTargetMissed += TargetMissed; _targetSpawner.StartTargets(); _gameTime = GameTime; StartCoroutine(StartTimer()); }
void Awake() { if (instance == null) { instance = new TargetSpawner(); } else { instance = this; } SphereCollider[] col = GetComponents <SphereCollider>(); m_minRadius = col[0].radius; m_maxRadius = col[1].radius; // Destroy the collider since we're only using it to calculate radius Destroy(col[1]); Destroy(col[0]); }
void AddSpawnerButton() { if (!inScene) { return; } GUI.backgroundColor = Color.green; //Draw a button for each target object with its name. //If the button is pushed we set the selected index. if (GUILayout.Button("Create Spwawner")) { int i = selectedSpawner; if (i == -1) { i = 0; } //Add a spawner to wave. TargetSpawner o = Instantiate(tArray.targetObjects[i]) as TargetSpawner; o.transform.parent = myInstance.transform; //Set some default values. o.name = "new"; selectedSpawner = -1; UpdateSpawnerList(); } GUI.backgroundColor = Color.white; }
// Use this for initialization protected override void Start() { base.Start(); //First create the list. _capturedTargets = new List <TargetSpawner>(); //Grab any spawners we may have. foreach (Transform t in transform) { TargetSpawner tspt = t.GetComponent <TargetSpawner>(); if (tspt) { _capturedTargets.Add(tspt); } } //Set the captured state. Captured = SpawnCaptured; Debug.Log("We have " + _capturedTargets.Count + " spawners in our Todem"); }
public static void RestartSong(bool failed = false) { waitForRestart = true; if (!Config.showStats && !failed) { InGameUI.I.Restart(); } else if (Config.showStats) { //SongEnd.I.ShowEndSeqence(); TargetSpawner spawner = GameObject.FindObjectOfType <TargetSpawner>(); Target[] activeTargets = GameObject.FindObjectsOfType <Target>(); foreach (Target t in activeTargets) { t.transform.root.gameObject.SetActive(false); } SongEnd.I.ShowResults(); recordRestarted = true; AudioDriver.I.Pause(); } PlaySound(); ResetVariables(); }
public void SetParent(TargetSpawner parent) { this.parent = parent; }
public void GenerateMap() { finishedLevels++; foregroundColour = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f); backgroundColour = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f); if (finishedLevels % 5 == 0 && finishedLevels != 0) { mapSize += 2; } seed = Random.Range(1, 100); tileMap = new Transform[mapSize, mapSize]; System.Random prng = new System.Random(seed); GetComponent <BoxCollider>().size = new Vector3(mapSize * tileSize, .05f, mapSize * tileSize); allTileCoords = new List <Coord>(); for (int x = 0; x < mapSize; x++) { for (int y = 0; y < mapSize; y++) { allTileCoords.Add(new Coord(x, y)); } } shufledTileCoords = new Queue <Coord>(Utility.ShuffleArray(allTileCoords.ToArray(), seed)); playerSpawnPosition = new Coord(mapSize / 2, mapSize / 2);////////////////////////////////////////////////////////////////////////////////////////////////////////////////// string holderName = "Generated Map"; if (transform.Find(holderName)) { DestroyImmediate(transform.Find(holderName).gameObject); } Transform mapHolder = new GameObject(holderName).transform; mapHolder.parent = transform; for (int x = 0; x < mapSize; x++) { for (int y = 0; y < mapSize; y++) { Vector3 tilePosition = CoordToPosition(x, y); Transform newTile = Instantiate(tilePrefab, tilePosition, Quaternion.Euler(Vector3.right * 90)) as Transform; newTile.localScale = Vector3.one * tileSize; newTile.parent = mapHolder; tileMap[x, y] = newTile; } } bool[,] obstacleMap = new bool[mapSize, mapSize]; int obstacleCount = (int)(mapSize * mapSize); int currentObstacleCount = 0; List <Coord> allOpenCoords = new List <Coord>(allTileCoords); for (int i = 0; i < obstacleCount; i++) { Coord randomCoord = GetRandomCoord(); obstacleMap[randomCoord.x, randomCoord.y] = true; currentObstacleCount++; if (randomCoord != playerSpawnPosition && MapIsFullyAccessible(obstacleMap, currentObstacleCount)) { float obstacleHeight = Mathf.Lerp(minObstacleHeight, maxObstacleHeight, (float)prng.NextDouble()); Vector3 obstaclePosition = CoordToPosition(randomCoord.x, randomCoord.y); Transform newObstacle = Instantiate(obstaclePrefab, obstaclePosition + Vector3.up * obstacleHeight / 2, Quaternion.identity) as Transform; newObstacle.parent = mapHolder; newObstacle.localScale = new Vector3(tileSize, obstacleHeight, tileSize); Renderer obstacleRenderer = newObstacle.GetComponent <Renderer>(); Material obstacleMaterial = new Material(obstacleRenderer.sharedMaterial); float colourPercent = randomCoord.y / (float)mapSize; obstacleMaterial.color = Color.Lerp(foregroundColour, backgroundColour, colourPercent); obstacleRenderer.sharedMaterial = obstacleMaterial; allOpenCoords.Remove(randomCoord); } else { obstacleMap[randomCoord.x, randomCoord.y] = false; currentObstacleCount--; } } shufledOpenTileCoords = new Queue <Coord>(Utility.ShuffleArray(allOpenCoords.ToArray(), seed)); TargetSpawner ts = FindObjectOfType <TargetSpawner>(); bool doStaf = ts.SpawnDestination(mapSize, foregroundColour, backgroundColour); while (!doStaf) { doStaf = ts.SpawnDestination(mapSize, foregroundColour, backgroundColour); }/**/ }
private void Start() { ts = this.gameObject.transform.parent.GetComponent <TargetSpawner>(); }
public GameObject startArea; // The start area sphere /* * In this function we get the TargSpawn script object and set the position of the start area relative to the position of the * head/camera in the Unity scene */ void Awake() { targetSpawnnerScript = targetSpawnController.GetComponent <TargetSpawner>(); startArea.transform.position = new Vector3(7.0f, 10.0f, -6.2f); // Debug.Log(startArea.transform.position); }
void OnEnable() { m_TargetSpawner = target as TargetSpawner; }
void Awake() { instance = this; }
private void Awake() { Instance = this; }
private void Start() { uiUpdater = FindObjectOfType <UIUpdater>(); targetSpawner = FindObjectOfType <TargetSpawner>(); uiUpdater.DisableCanvas(); }
void Start() { spawner = FindObjectOfType <TargetSpawner>(); }
void Awake() { targetSpawnerScript = targetSpawnController.GetComponent <TargetSpawner>(); }
private void LoadGameObjects() { //OSD if (gui == null) { gui = new OnScreenDisplay(); GameObject.Spawn(gui); } else { gui.Active = true; foreach (Component item in gui.Components) { item.Enabled = false; } } //Player if (bomberMan == null) { bomberMan = new Bomberman(); GameObject.Spawn(bomberMan, Map.GetPlayerSpawnPoint()); } else { bomberMan.Active = true; foreach (Component item in bomberMan.Components) { item.Enabled = true; } } //TargetPoints if (targetSpawner == null) { targetSpawner = new TargetSpawner(5, 3.5f); GameObject.Spawn(targetSpawner); } else { targetSpawner.Active = true; foreach (Component item in targetSpawner.Components) { item.Enabled = false; } } //AI if (enemySpawner == null) { enemySpawner = new EnemySpawner(bomberMan); GameObject.Spawn(enemySpawner); } else { enemySpawner.Active = true; foreach (Component item in enemySpawner.Components) { item.Enabled = false; } } }
void Start() { instance = this; //timer = GetNextSpawnInterval(); }