private void Awake() { GetSpawnEnemy = this; currentEnemyCount = 0; currentWave = 0; finishWave = false; }
void MakeInstance() { if (instance == null) { instance = this; } }
Vector3 m_pos; // Position of the enemy. void Start() { rb = GetComponent <Rigidbody2D>(); m_enemyHandler = GetComponent <SpawnEnemy>(); m_pos = transform.position; m_bDead = false; }
void Update() { float posLeft1 = cam.transform.position.x - 8f; float posLeft2 = posLeft1 + 18f; float posRight = posLeft2 + 10f; for (int i = 0; i < count; i++) { SpawnEnemy spawnEnemy = spawnEnemies[i]; Vector3 pos = spawnEnemy.gameObject.transform.position; float posX = pos.x; float posY = pos.y; if (posX > posLeft1) { if ((posLeft2 < posX && posX < posRight) || (posY > camUp && posX < posLeft2)) { spawnEnemy.timer -= Time.deltaTime; if (spawnEnemy.timer < 0f) { spawnEnemy.Spawn(); } } } } }
// Start is called before the first frame update void Start() { player1 = (Player1)FindObjectOfType(typeof(Player1)); dead = false; maxLive = liveScale; worth = worthScale; live = maxLive; startMoved = false; randomFloat = Random.value * moveDistance; enemySpawner = (SpawnEnemy)FindObjectOfType(typeof(SpawnEnemy)); Vector3 temp = new Vector3(transform.position.x / 0.16f + 640f, transform.position.y / 0.16f + 340f, transform.position.z / 0.15f); ProgressBar obj = Instantiate(pb, temp, Quaternion.identity); obj.MaxLive = maxLive; obj.Live = live; obj.BarValue = live / maxLive * health; obj.transform.SetParent(gameObject.GetComponentInChildren <Canvas>().gameObject.transform, gameObject); sectorTime = Time.time - sectorDelay; shootTime = Time.time - simpleDelay; circleTime = Time.time - circle1Delay; circleTime2 = Time.time - circle2Delay; realRainTime = Time.time - realDelay; rainTime = Time.time - hardDelay; rainNormalTime = Time.time - normalDelay; shootTraceTime = Time.time - traceDelay; }
void Start() { enemyManager = FindObjectOfType <SpawnEnemy> (); enemyManager.bossFight = true; animator = GetComponent <Animator> (); Invoke("WeaponsReady", 2.5f); }
IEnumerator Spawning(SpawnEnemy spawnEnemy) { spawnEnemy.isSpawnEnd = true; SpawnEffect(); GameObject e = Instantiate(spawnEnemy.enemyPrefab, enemySpawnPoint); e.SetActive(false); e.GetComponent <Hero>().isPlayerHero = false; e.transform.position = this.transform.position; yield return(new WaitForEndOfFrame()); e.SetActive(true); StageManagement.instance.AddMonsterCount(); List <GameObject> allys = Common.FindAlly(); foreach (var ally in allys) { if (ally.GetComponent <Hero>() != null) { ally.GetComponent <Hero>().ResearchingEnemys(e); } } yield return(new WaitForSeconds(spawnTime)); spawnEnemy.isSpawnEnd = false; spawnCount = Common.FindEnemysCount(); yield return(null); }
/** * create the list of action use in the game * set the logo for each action */ public List <Action> GetActionList() { List <Action> actionList = new List <Action>(); foreach (ACTION_TYPE type in ActionInTimeline) { switch (type) { case ACTION_TYPE.ATTACK: { Attack attack = new Attack(); attack.actionLogo = attackLogo; actionList.Add(attack); } break; case ACTION_TYPE.DEFEND: { Defend defend = new Defend(); defend.actionLogo = defendLogo; actionList.Add(defend); } break; case ACTION_TYPE.CURSE: { Curse curse = new Curse(); curse.actionLogo = curseLogo; actionList.Add(curse); } break; case ACTION_TYPE.MOVE_ENEMY: { MoveEnemy moveEnemy = new MoveEnemy(); moveEnemy.actionLogo = moveEnemyLogo; actionList.Add(moveEnemy); } break; case ACTION_TYPE.SPAWN_ENEMY: { SpawnEnemy spawnEnemy = new SpawnEnemy(); spawnEnemy.actionLogo = spawnEnemyLogo; actionList.Add(spawnEnemy); } break; case ACTION_TYPE.SPAWN_FOW: { SpawnFOW spawnFOW = new SpawnFOW(); spawnFOW.actionLogo = spawnFOWLogo; actionList.Add(spawnFOW); } break; } } return(actionList); }
void Start() { hp = gameObject.GetComponent <HitPoints>(); sp = gameObject.GetComponent <SpawnEnemy>(); hook = gameObject.GetComponent <Transform>(); startHp = hp.health; }
void Start() { SpawnEnemy = GameObject.Find("Spawner"); SpawnEnemyScript = SpawnEnemy.GetComponent <SpawnEnemy>(); targetPos = transform.position; teleportCD = 0; attackReady = true; }
private void Awake() { Instance = this; regionNumberToSpawnPointsNumber.Add(1, spawnPointsRegionOne); regionNumberToSpawnPointsNumber.Add(2, spawnPointsRegionTwo); regionNumberToSpawnPointsNumber.Add(3, spawnPointsRegionThree); playerPosition = GameObject.FindWithTag("Player").GetComponent <Transform>().position; }
void Start() { if (GameObject.FindGameObjectWithTag("EnemySpawner") != null) { se = GameObject.FindGameObjectWithTag("EnemySpawner").GetComponent <SpawnEnemy> (); } shrinkRate = transform.localScale.x / 20.0f; }
void SetSpawnMonster() { foreach (var mon in HeroSystem.GetStageMonster(StageManagement.instance.stageInfo.stageNumber)) { SpawnEnemy spawnEnemy = new SpawnEnemy(PrefabsDatabaseManager.instance.GetMonsterPrefab(mon.id), 1); spawnEnemys.Add(spawnEnemy); } }
public float m_fMagnitude = 0.5f; // The magnitude. void Start() { m_anim = GetComponent <Animator>(); // Get the animator component. rb = GetComponent <Rigidbody2D>(); // Get the rigidbody2D component. m_enemyHandler = GetComponent <SpawnEnemy>(); pos = transform.position; // The pos vector is set to the position of the enemy. m_bDead = false; // Set it to false. }
// 스폰할 적의 종류 추가. public SpawnEnemy resisterSpawnEnemy() { var spawn = new SpawnEnemy(); this.spawn_enemies.Add(spawn); return(spawn); }
void Start() { m_anim = GetComponent <Animator>(); // Get the bosses animator component. rb = GetComponent <Rigidbody2D>(); // Get the bosses rigidbody2D component. m_enemyHandler = GetComponent <SpawnEnemy>(); // Get the spawn enemy component. pos = transform.position; // The position vector is the position of the boss. m_bDead = false; // Boss is not dead. }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); m_enemyHandler = GetComponent <SpawnEnemy>(); m_pos = transform.position; m_bDead = false; m_enemiesLeft = SpawnEnemy.m_iCurrentEnemyCount; }
void Awake() { checkStart = GameObject.FindGameObjectWithTag("SpawnEnemy").GetComponent <SpawnEnemy>(); source = GameObject.FindGameObjectWithTag("SpawnEnemy").GetComponent <AudioSource>(); button = this.GetComponent <Button>(); text = this.GetComponentInChildren <Text> (); text.color = Color.clear; fadeTime = 10.0f; }
// Use this for initialization void Start() { Obj = this; isPaused = false; speedScalingFactor = 0.9f; enemySpawnSpeed = currentEnemyMaxSpeed * speedScalingFactor; enemiesSpawned = 0; StartCoroutine(Spawner()); }
// 적을 펑하고 스폰한다(Action, 호스트용)). public void create_enemy_internal() { // 등록된 적 중에서 랜덤하게 선택. if (this.spawn_enemies.Count == 0) { this.spawn_enemies.Add(new SpawnEnemy()); } float sum = 0.0f; foreach (var se in this.spawn_enemies) { sum += se.frequency; } SpawnEnemy spawn_enemy = this.spawn_enemies[0]; float rand = Random.Range(0.0f, sum); foreach (var se in this.spawn_enemies) { rand -= se.frequency; if (rand <= 0.0f) { spawn_enemy = se; break; } } // dbwin.console().print("Spawn LairName:" + this.name); dbwin.console().print("Create enemy:" + spawn_enemy.enemy_name); //Debug.Log("Spawn LairName:" + this.name); //Debug.Log("Create enemy:" + spawn_enemy.enemy_name); chrBehaviorEnemy enemy = LevelControl.get().createCurrentRoomEnemy <chrBehaviorEnemy>(spawn_enemy.enemy_name); if (enemy != null) { enemy.setBehaveKind(spawn_enemy.behave_kind, spawn_enemy.behave_desc); enemy.beginSpawn(this.transform.position + Vector3.up * 3.0f, this.transform.forward); if (GameRoot.get().isHost()) { // 이 문자열을 함께 게스트에 송신한다. string pedigree = enemy.name + "." + spawn_enemy.behave_kind; // 원격 송신. EnemyRoot.get().RequestSpawnEnemy(this.name, pedigree); //Debug.Log(pedigree); } } }
void OnTriggerEnter(Collider obj) { //string name = obj.gameObject.name; if (obj.gameObject.tag == "EnemyBullets") { Destroy(obj.gameObject); live--; source.PlayOneShot(hit); GameObject[] gameObjectsEnemyBullets = GameObject.FindGameObjectsWithTag("EnemyBullets"); for (var i = 0; i < gameObjectsEnemyBullets.Length; i++) { Destroy(gameObjectsEnemyBullets[i]); } SpawnEnemy enemySpawner = (SpawnEnemy)FindObjectOfType(typeof(SpawnEnemy)); Destroy(enemySpawner); GameObject[] gameObjectsEnemies = GameObject.FindGameObjectsWithTag("Enemies"); for (var i = 0; i < gameObjectsEnemies.Length; i++) { Destroy(gameObjectsEnemies[i]); } shootContinue = false; speed = 0; lspeed = 0; lastShootTime = Time.time + 999; ultTime = Time.time + 999; savePlayer(); SceneManager.LoadScene("GameOver"); } if (obj.gameObject.tag == "PowerUp") { score += (int)Random.value * 20 + 5; int temp = (int)(Random.value * 9); if (temp % 3 == 0) { if (bulletPower < 3) { bulletPower++; } else if (ultLeft < 5) { ultLeft++; } } else if (ultLeft < 5) { ultLeft++; } Destroy(obj.gameObject); } }
private void Awake() { if (instance != null) { Debug.LogWarning("Multiple instances of " + this + " found"); } instance = this; }
// Start is called before the first frame update void Start() { gm = GameObject.FindWithTag("GameController").GetComponent <gamaManager>(); screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z)); //Debug.Log(screenBounds); forward_force = gm.forwardForce; //StartCoroutine(CoinsGenerate()); sm = GetComponent <SpawnEnemy>(); sm.coin = a; }
void Awake() { Ins = this; //if (!InitGlobalIns()) return; GlobalManager.AddToDisabledObjContainer(this); SceneManager.sceneLoaded += OnSceneLoaded; InspectorEventSignals.OnSpawnEnemyInspectorUpdated += OnSpawnEnemyInspectorUpdated; GameEventSignals.OnSceneConfigured += OnSceneConfigured; }
// Update is called once per frame void Update() { if (health <= 0) { Destroy(gameObject); SpawnEnemy.DecreaseSpawnedEnemies(); PlayerController.EnemyIsDead(); Debug.Log(gameObject.name + " is dead."); } }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
private void OnDestroy() { GameObject spawn = GameObject.FindGameObjectWithTag("EnemySpawnArea"); SpawnEnemy script = spawn.GetComponent <SpawnEnemy>(); GameObject player = GameObject.FindGameObjectWithTag("Player"); if (player == null) { script.GameOver(); } }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } }
// Use this for initialization void Start() { roundOngoingText.GetComponent <Text> ().text = "No wave ongoing"; instance = this; lastSpawnTime = Time.time; gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); droneEnemiesList = new List <GameObject>(); tankEnemiesList = new List <GameObject>(); spiderEnemiesList = new List <GameObject>(); outsideEnemiesList = new List <GameObject>(); }
// Start is called before the first frame update void Start() { player = GameObject.Find("Player").transform; navMesh = GetComponent <NavMeshAgent>(); anim = GetComponent <Animator>(); health = GetComponent <EnemyHealth>(); enemy = GetComponent <SpawnEnemy>(); finishedSpawn = false; alive = true; StartCoroutine(SpawnAnimation()); }
void Awake() { // First we check if there are any other instances conflicting if (instance != null && instance != this) { // If that is the case, we destroy other instances Destroy(gameObject); } // Here we save our singleton instance instance = this; // Furthermore we make sure that we don't destroy between scenes (this is optional) DontDestroyOnLoad(gameObject); }
public void UnregisterSpawnPoint(SpawnEnemy spawnPoint) { mSpawnPoints.Remove(spawnPoint); }
public void RegisterSpawnPoint(SpawnEnemy spawnPoint) { mSpawnPoints.Add(spawnPoint); }
void OnLevelWasLoaded(int level) { readyToEndLevel = false; AllWavesSpawned = false; //Debug.Log("level: " + levelCount); if (level == 1) { inCombatLevel = true; levelCount++; waveCount = 1; enemySpawner = GameObject.FindGameObjectWithTag("EnemySpawner").GetComponent<SpawnEnemy>(); Init(); } else inCombatLevel = false; }