//////////////////////////////////////////////////////////// protected virtual void Start() { gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); levelManager = GameObject.Find("LevelManager").GetComponent <LevelManager>(); if (transform.position.y > 3.0f) { Debug.LogError("Error: " + gameObject.name + " spawned above floor position! Room Index: " + roomIndex + " Make spawners smaller and closer to the floor."); //gameManager.enemiesKilledNeededToGetThreeUpgrades--; //if ( levelManager.spawnedEnemies.Contains( gameObject ) == true ) // levelManager.spawnedEnemies.Remove( gameObject ); //gameManager.SetKillText(); //Destroy( gameObject ); return; } //////////////////////////////////////////////////////////// // GET COMPONENTS //////////////////////////////////////////////////////////// if (materialParents.Count != 0) { foreach (GameObject materialParent in materialParents) { //Material[] newMaterial = materialParent.GetComponent<Renderer>().materials; originalMaterials.Add(materialParent.GetComponent <Renderer>().materials); } } else { Debug.LogError("Error: Materialparents not set up for " + gameObject.name); } animator = GetComponent <Animator>(); navAgent = GetComponent <NavMeshAgent>(); player = GameObject.Find("Player").GetComponent <PlayerController>(); enemyHitEffects = GameObject.Find("EnemyHit VFXs").GetComponent <VFXList>(); enemyBullets = GameObject.Find("Enemy Bullets").GetComponent <VFXList>(); cameraTrans = Camera.main.transform; colliders = GetComponents <Collider>(); //////////////////////////////////////////////////////////// // APPLY FLOOR SCALING //////////////////////////////////////////////////////////// floor = GameObject.Find("LevelManager").GetComponent <LevelManager>().floor; health += healthScaling * floor; damage += attackScaling * floor; navAgent.speed += speedScaling * floor; AttachSound(); ChangeState(false); }
// Start is called before the first frame update protected override void Start() { base.Start(); enemyBullets = GameObject.Find("Firestarter Bullets").GetComponent <VFXList>(); enemyExplosionEffects = GameObject.Find("Explosion VFXs").GetComponent <VFXList>(); EnemyLayer = (1 << LayerMask.NameToLayer("Enemy")); if (isRanged == true) { gameObject.GetComponent <Collider>().isTrigger = false; } else { EnemyLayer = (1 << LayerMask.NameToLayer("Enemy")); gameObject.GetComponent <Collider>().isTrigger = true; } }