public SpawnPackage SpawnBasic(EnemyVariables enemy_variables) { Transform spawnpoint = SelectSpawnPoint(enemy_variables.spawnpoint); GameObject clone = Instantiate(enemy_variables.enemy, spawnpoint.position, Quaternion.identity); EnemyBase eb = clone.GetComponentInChildren <EnemyBase>(); eb.SetPositions(spawnpoint.position, spawnpoint.GetChild(0).position); eb.reticle.GetComponent <ReticleScript>().InstantiateArrows(enemy_variables.arrow_direction_1, enemy_variables.arrow_direction_2); SpawnPackage sp; sp.enemy = clone; sp.spawn_point = spawnpoint; Debug.Log("Enemy spawned"); if (enemy_variables.spawnpoint == SpawnPoint.UP_LEFT || enemy_variables.spawnpoint == SpawnPoint.UP_RIGHT) { Debug.Log("scale adjusted"); clone.transform.localScale = new Vector3(0.8f, 0.8f, 1f); } return(sp); }
void Start() { objSpawner = (GameObject) GameObject.FindWithTag("EnemySpawner"); ptrScriptVariable = (EnemyVariables)objSpawner.GetComponent(typeof(EnemyVariables)); parBulletTrail = (GameObject)Instantiate(ptrScriptVariable.parBulletTrail, transform.position, Quaternion.identity); this.transform.position = new Vector3(transform.position.x, transform.position.y, 1.0f); health = maxHealth; }
/* * public void SpawnEnemy(GameObject enemy) * { * SpawnPackage sp = es.SpawnBasic(enemy); * enemies.Add(sp.enemy); * spawnpoints_used.Add(sp.spawn_point); * }// * * public void SpawnEnemy(GameObject enemy, SpawnPoint enum_spawnpoint, ArrowDirection dir1, ArrowDirection dir2) * { * SpawnPackage sp = es.SpawnBasic(enemy, enum_spawnpoint, dir1, dir2); * enemies.Add(sp.enemy); * spawnpoints_used.Add(sp.spawn_point); * }//*/ public void SpawnEnemy(EnemyVariables enemy_variables) { ; SpawnPackage sp = es.SpawnBasic(enemy_variables); //Debug.Log("ENEMY SPAWNED!!"); enemies.Add(sp.enemy); //Debug.Log("test"); //Debug.Log("sp.enemy: " + sp.enemy); spawnpoints_used.Add(sp.spawn_point); }
void Start() { objSpawner = (GameObject)GameObject.FindWithTag("EnemySpawner"); ptrScriptVariable = (EnemyVariables)objSpawner.GetComponent(typeof(EnemyVariables)); parBulletTrail = (GameObject)Instantiate(ptrScriptVariable.parBulletTrail, transform.position, Quaternion.identity); this.transform.position = new Vector3(transform.position.x, transform.position.y, 1.0f); health = maxHealth; }
void Start() { objCamera = (tk2dCamera) GameObject.FindWithTag("MainCamera").GetComponent<tk2dCamera>(); ptrScriptVariable = (EnemyVariables)GetComponent(typeof(EnemyVariables)); }
void Start() { objCamera = (tk2dCamera)GameObject.FindWithTag("MainCamera").GetComponent <tk2dCamera>(); ptrScriptVariable = (EnemyVariables)GetComponent(typeof(EnemyVariables)); }