private void Start() { //MVC linking model = GetComponent <EnemyModel>(); view = GetComponent <EnemyView>(); if (model.isBoss) { bossHealthScript = GameObject.Find("HealthBarStorage").GetComponent <BossHealthUI>(); } //Setup melee if (model.meleeEnabled == true) { melee = gameObject.GetComponent <MeleeWeapon>(); melee.AttackDamage = model.meleeAttackDamage; melee.attackRange = model.meleeAttackRange; } //Setup ranged if (model.rangedEnabled == true) { ranged = gameObject.GetComponent <RangedWeapon>(); ranged.damage = model.rangedAttackDamage; ranged.speed = model.rangedAttackProjectileSpeed; } //Increase the enemy counter GameObject.Find("CounterCanvas").GetComponentInChildren <EnemyCounter>().increaseCount(); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
protected override void Awake() { base.Awake(); specialDamage = 1.0f; normalDamageCount = specialDamagers.Count + 1; normalDamage = health / normalDamageCount; specialDamagers.Shuffle(); currDamager = "Normal"; currDamageAmount = normalDamage; bossUI = bossUIObject.GetComponent <BossHealthUI>(); bossUI.SetMaxHealth(health); }
protected override void Awake() { base.Awake(); head = (transform.parent != null) ? transform.parent.GetComponentInChildren <SnakeHead>() : GetComponent <SnakeHead>(); HealthManager[] healthArray = (transform.parent != null) ? transform.parent.GetComponentsInChildren <HealthManager>() : GetComponents <HealthManager>(); healthList = new List <HealthManager>(healthArray); GameObject temp = GameObject.FindGameObjectWithTag("LevelManager"); if (temp) { levelManager = temp.GetComponent <LevelManager>(); } healthUI = healthUIObject.GetComponent <BossHealthUI>(); maxTotalHealth = killsTillDeath * healthList[0].Health; currTotalHealth = maxTotalHealth; healthUI.SetMaxHealth(maxTotalHealth); }