void Start() { if (spwn == null) { spwn = GameObject.FindGameObjectWithTag("SPWN").GetComponent<Spawning>(); } }
void SpawnItem(TileMapData map) { int r = (int)Random.Range(0, 4); if (r == 0) { Spawning.SpawnItem(map, Sword); GameObject.FindGameObjectWithTag("Equip").GetComponent <Weapon>().setStats(DungeonFloor + 1, DungeonFloor / 2, 0); } else if (r == 1) { Spawning.SpawnItem(map, Helmet); GameObject.FindGameObjectWithTag("Equip").GetComponent <Helmet>().setStats(DungeonFloor / 2, DungeonFloor + 1, 0); } else if (r == 2) { Spawning.SpawnItem(map, Necklace); GameObject.FindGameObjectWithTag("Equip").GetComponent <Necklace>().setStats(DungeonFloor + 1, DungeonFloor + 1, DungeonFloor + 1); } else if (r == 3) { Spawning.SpawnItem(map, Armor); GameObject.FindGameObjectWithTag("Equip").GetComponent <Armor>().setStats(DungeonFloor / 2, 0, DungeonFloor + 1); } }
// Use this for initialization public void ReactToHit() { if (shotcounter == 1) { Shooting behavior = GetComponent <Shooting> (); if (behavior != null) { behavior.SetAlive(false); } WanderingNPC b = GetComponent <WanderingNPC> (); if (b != null) { b.SetAlive(false); } GameObject s = GameObject.FindGameObjectWithTag("Respawn"); Spawning sp = s.GetComponent <Spawning> (); sp.decrementCounter(); StartCoroutine(Die()); } else { shotcounter++; } }
public void NextFloor()//called when player hits action on downstairs { float startTime = Time.realtimeSinceStartup; PlayerInstance.SetActive(false); toPrevFloor = false; DungeonFloor++; ClearEnemies(); ClearItems(); if (DungeonFloor >= dungeon.length())//if the player hasn't been here before, generate a new floor { TileMapData generated = genTMD(); MoveMap(generated); dungeon.add(generated); EnemySpawningDifficulty(generated, numEnemies); } else { MoveMap(dungeon.getTMD(DungeonFloor)); //if the player has been here, load it from the list Spawning.RespawnEnemies(DungeonFloor); } PlayerInstance.SetActive(true); float endTime = Time.realtimeSinceStartup; Debug.Log(endTime - startTime + "seconds loadtime"); Debug.Log("DungeonFloor: " + DungeonFloor); }
// Update is called once per frame void Update() { if (_alive) { timer += Time.deltaTime; if (timer >= wanderTimer) { Vector3 newPos = RandomNavSphere(transform.position, wanderRadius, -1); agent.SetDestination(newPos); anim.SetBool("isIdle", false); anim.SetBool("isWalking", true); timer = 0; } if (transform.position.y < -1) { Destroy(this.gameObject); GameObject s = GameObject.FindGameObjectWithTag("Respawn"); Spawning sp = s.GetComponent <Spawning> (); sp.decrementCounter(); } anim.SetBool("isWalking", false); anim.SetBool("isIdle", true); } }
private bool isDead = false; // Initialize the animator // Use this for initialization void Start() { // Find spawn points and start the destroy timers Spawning = GameObject.Find("BalloonSpawn").GetComponent <Spawning>(); StartCoroutine(DestroyBalloon()); }
private void GenerateRowFromList() { string bottomRow = levelData[levelData.Count - 1]; //Debug.Log(bottomRow); for (int i = 0; i < bottomRow.Length; i++) { switch (bottomRow[i]) { case prawnObj: Spawning.SpawnObject("Prawn", i - 1); Debug.Log(i); break; case rubbishObj: Spawning.SpawnObject("Rabbish", i - 1); break; case sharkObj: Spawning.SpawnObject("Shark", i - 1); break; default: break; } } levelData.RemoveAt(levelData.Count - 1); }
// Use this for initialization void Awake() { float halfSelfWidth = transform.localScale.x / 2; screenHalfWidthInWorldUnits = Camera.main.aspect * Camera.main.orthographicSize - halfSelfWidth; spawnLink = GetComponent <Spawning> (); }
void ReadSpawnFile() { // initialize spawnList.Clear(); spawnIndex = 0; spawnEnd = false; // read file - stage TextAsset file = Resources.Load("stage" + stage) as TextAsset; StringReader stringReader = new StringReader(file.text); while (stringReader != null) { string line = stringReader.ReadLine(); if (line == null) { break; } // split spawn data and add in to the list. Spawning spawn = new Spawning(); spawn.delay = float.Parse(line.Split(',')[0]); spawn.enemyType = line.Split(',')[1]; spawn.spawnPoint = int.Parse(line.Split(',')[2]); spawnList.Add(spawn); } // close file stringReader.Close(); // first spawning delay NextDelay = spawnList[0].delay; }
//When the player touches an enemy the Danger and Invulnerability functions are called private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.GetComponent <Enemy>() != null) { Enemy eb = collision.gameObject.GetComponent <Enemy>(); //If the enemies size is more than the playes, the player takes damage //If the enemies size is less than the players, the enemy is destroyed and the players size increases if (eb.size > size) { Damage(1); Invulnerability(2); } else if (eb.size <= size) { size += eb.size / 5; if (size > 50) { size = 50; } Spawning.respawn(collision.gameObject, this.gameObject); //Destroy(collision.gameObject); } } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag.Contains("Finish")) { gameObject.GetComponent <Rigidbody>().velocity = Vector3.zero; gameObject.GetComponent <Rigidbody>().angularVelocity = Vector3.zero; gameObject.transform.Find("meteor").gameObject.SetActive(false); gameObject.transform.Find("Impact").gameObject.SetActive(true); gameObject.transform.Find("Impact").Find("ImpactSparks").GetComponent <ParticleSystem>().Play(); gameObject.transform.Find("Impact").Find("Smokering").GetComponent <ParticleSystem>().Play(); gameObject.transform.Find("Impact").Find("Debris").GetComponent <ParticleSystem>().Play(); Spawning spawning = GameObject.Find("Terrain").GetComponent <Spawning>(); List <GameObject> kill = new List <GameObject>(); foreach (GameObject enemy in spawning.enemiesList) { if ((enemy.gameObject.transform.position - gameObject.transform.position).magnitude <= 4) { kill.Add(enemy); } } foreach (GameObject enemy in kill) { spawning.DestroyEntity(enemy); } Destroy(gameObject, 2f); } }
public void EnemySpawningDifficulty(TileMapData map, int numEnemies) { for (int i = 0; i < numEnemies; i++) { Spawning.SpawnEnemies(map, 1, SpawnAppropriateEnemy(DungeonFloor), PlayerInstance); } }
// Start is called before the first frame update void Start() { anim = GetComponent <Animator>(); rb = GetComponent <Rigidbody2D>(); sp = Object.FindObjectOfType <Spawning>(); wb = GameObject.Find("WayBackBar"); cB = GameObject.Find("FuelBar"); }
public bool canShoot; // Can the player currently shoot? // Use this for initialization void Start() { shootTimer = 0.0f; canShoot = true; isRockOn = false; isRockGod = false; spawning = GameObject.Find("Game Manager").GetComponent <Spawning>(); }
// Use this for initialization void Start() { spawning = GameObject.Find("Game Manager").GetComponent <Spawning>(); invincibilityTimer = 0.0f; isInvincible = false; hurtSFX = GetComponent <AudioSource>(); sprite = GetComponent <SpriteRenderer>(); }
// Start is called before the first frame update void Start() { cmp_life = GetComponent <Life>(); cmp_enemy_model = GetComponent <Enemy_BossModel>(); cmp_spwn = GetComponent <Spawning>(); cmp_life.life = cmp_enemy_model.bosslife; GameObject ply = GameObject.Find("Player"); }
private void SpawnPeasants() { countPeasants += Convert.ToInt32(countPeasants * proccentSpawnPeasants / 100); if (countPeasants >= winCount) { Win?.Invoke("Отлично! Вы победили! Из вас вышел отличный феодал! "); } Spawning?.Invoke("!! У вас прибавление крестьян !!"); }
// Use this for initialization void Awake() { neighbourPlatforms = new List <Platform>(); exitsUnused = this.GetComponent <PlatformEntryPoints>().entryPoints.Length; coords = new Dictionary <char, int>(); lookingAt = new List <int[]>(); spawnArea = GetComponentInChildren <Spawning>(); }
// Start is called before the first frame update void Start() { cmp_spwn = GetComponent <Spawning>(); if (GameObject.Find("LevelStat")) { cmp_levelSt = GameObject.Find("LevelStat").GetComponent <LevelStats>(); enemysBefDesf = cmp_levelSt.enemyKillCounter; } //EmpezarDesafio2(); }
private void OnTriggerEnter(Collider other) { GameObject.Find("Console").GetComponent <Console>().Print("BAM"); Spawning spawning = GameObject.Find("Terrain").GetComponent <Spawning>(); if (other.tag.Contains("EnemyHitbox")) { Debug.Log("shit"); spawning.DestroyEntity(other.GetComponent <MainHitbox>().enemyGameObject.transform.parent.gameObject); } }
// Start is called before the first frame update void Start() { cmp_spwn = GetComponent <Spawning>(); if (GameObject.Find("Player")) { cmp_plyMod = GameObject.Find("Player").GetComponent <PlayerModelo>(); } if (GameObject.Find("LevelStat")) { cmp_levelSt = GameObject.Find("LevelStat").GetComponent <LevelStats>(); } }
private PlayerContext NewPlayerContext(string playerId, Commands.StructVector3 pos, DirectionEnum dir) { var playerContext = new PlayerContext(playerId, pos, dir); var auto = new Spawning <PlayerContext, List <PlayerContext> >(clientFrame, playerContext); playerContext.auto = auto; var prefab = Resources.Load("Chara") as GameObject; playerModels[playerId] = Instantiate(prefab, new Vector3(playerContext.x, playerContext.height, playerContext.z), Quaternion.identity) as GameObject; return(playerContext); }
//Rachel Murray void Start() { score = GameObject.Find("Score"); inventory = GameObject.Find("Inventory/" + this.name); player = GameObject.Find("SpawnCenter"); spawnScript = player.GetComponent <Spawning>(); height = GetComponent <SphereCollider>().radius; xPoint = Random.Range(player.transform.position.x - 20, player.transform.position.x + 20); zPoint = Random.Range(player.transform.position.z - 20, player.transform.position.z + 20); newLocation = new Vector3(xPoint, height, zPoint); }
//public bool golpeAlSuelo; /*public int lugarGolpeMartillo; * public float tMartillo; * public float tMVolverInicio; * public float tMSiguienteataque;*/ // Start is called before the first frame update void Start() { spwnerBombs.SetActive(false); spwnerLions.SetActive(false); spwnerRhinos.SetActive(false); atackTimer = 0; cmp_life = GetComponent <Life>(); cmp_enemy_model = GetComponent <Enemy_BossModel>(); cmp_spwn = GetComponent <Spawning>(); cmp_life.life = cmp_enemy_model.bosslife; GameObject ply = GameObject.Find("Player"); }
void Start() { spawner = FindObjectOfType <Spawning>(); board = FindObjectOfType <Board>(); previousFallTime = Time.time; previousMoveTime = Time.time; if (!CheckValidUnder()) { validUnder = false; lastFallTime = Time.time; } }
public void ToggleEnemies() { Rock[] rocks = FindObjectsOfType <Rock>(); Bat[] bats = FindObjectsOfType <Bat>(); Spawning _spawn = FindObjectOfType <Spawning>(); _spawn.TogglePause(); foreach (var item in rocks) { item.TogglePause(); } foreach (var item in bats) { item.TogglePause(); } }
void OnDestroy() { GameObject SpawnManager = GameObject.Find("SpawnManager"); if (SpawnManager == null) { Debug.Log("FATAL ERROR ! SPAWN MANAGER IS NOT FOUND !"); } Spawning SpawningComponent = SpawnManager.GetComponent <Spawning>(); if (SpawningComponent == null) { Debug.Log("FATAL ERROR ! SPAWNING COMPONENT IS NOT FOUND !"); } SpawningComponent.IsSpawnedObjectAlive = false; }
public void PreviousFloor()//called when player hits action on upstairs { if (DungeonFloor > 0) { float startTime = Time.realtimeSinceStartup; PlayerInstance.SetActive(false); toPrevFloor = true; DungeonFloor--; ClearEnemies(); ClearItems(); MoveMap(dungeon.getTMD(DungeonFloor)); PlayerInstance.SetActive(true); float endTime = Time.realtimeSinceStartup; Debug.Log(endTime - startTime + "seconds loadtime"); Spawning.RespawnEnemies(DungeonFloor); } else { Debug.Log("You are on the top floor"); } }
void DepositFood() { if (m_FoodCollected > 0) { // Play sound AudioManager.PlaySound(ScoreSound, Vector3.zero); // Update score m_Score += m_FoodCollected; UIManager.instance.activeElements.scoreText.SetValue(m_Score); UIManager.instance.cachedScore += m_Score; // Reset collected food m_FoodCollected = 0; collectedSeeds = 0; collectedSandwiches = 0; UIManager.instance.ClearFoodUI(); Spawning.RefreshSpawned(); } }
// Start is called before the first frame update void Start() { cmp_spawn = GetComponent<Spawning>(); }
// Use this for initialization void Start() { spawning = GameObject.Find("Game Manager").GetComponent <Spawning>(); BGM = GameObject.Find("Game Manager").GetComponent <AudioSource>(); myAudio = GetComponents <AudioSource>(); BGM.Pause(); // Break the song into its 3 sections, then each section into its chords // Then, randomly select one of the chord tones to play int[] trio; // First part if (BGM.time < (21.0f + (1.0f / 3.0f))) { // Mod (10 + 2/3) float musicTime = BGM.time % (10.0f + (2.0f / 3.0f)); if (musicTime < (2.0f + (2.0f / 3.0f))) { // i chord trio = new int[] { 0, 2, 4 }; } else if (musicTime < 4.0f) { // VI chord trio = new int[] { 5, 0, 2 }; } else if (musicTime < (5.0f + (1.0f / 3.0f))) { // VII chord trio = new int[] { 6, 1, 3 }; } else if (musicTime < 8.0f) { // i chord trio = new int[] { 0, 2, 4 }; } else if (musicTime < (9.0f + (1.0f / 3.0f))) { // III chord trio = new int[] { 2, 4, 6 }; } else { // iv chord trio = new int[] { 3, 5, 0 }; } } // Second part else if (BGM.time < (37.0f + (1.0f / 3.0f))) { // Mod (5 + 1/3) float musicTime = BGM.time % (5.0f + (1.0f / 3.0f)); if (musicTime < (2.0f + (2.0f / 3.0f))) { // iv chord trio = new int[] { 3, 5, 0 }; } else { // i chord trio = new int[] { 0, 2, 4 }; } } // End part else { float musicTime = BGM.time % (5.0f + (1.0f / 3.0f)); if (musicTime < (1.0f + (1.0f / 3.0f))) { // VI chord trio = new int[] { 5, 0, 2 }; } else if (musicTime < (2.0f + (2.0f / 3.0f))) { // VII chord trio = new int[] { 6, 1, 3 }; } else { // V chord trio = new int[] { 4, 7, 1 }; } } // The chord should match the chord currently playing for (uint i = 0; i < myAudio.Length; i++) { myAudio[i].pitch = pitches[trio[i]]; } }
public static void Spawn(Spawning spawn) { spwn.StartCoroutine(spwn.StartSpawn()); }