//--Methods--// protected override void Start() { base.Start(); Debug.Assert(m_enemyType != EEnemySpawnableType.MAX, "Enemy Type Not Set! : " + gameObject.name); //Debug.Assert(m_targetCharacter, "Missing Target Character, should be set when enemy is spawned!"); m_characterAimer.Init(m_targetCharacter.transform); if (m_isFlyingEnemy) { m_animator.SetFloat("FlyingAnimation", 1.0f); } else { m_animator.SetFloat("FlyingAnimation", 0.0f); } if (m_spawnable_floatingHealthBar) { GameObject go = Instantiate(m_spawnable_floatingHealthBar, Vector3.zero, Quaternion.Euler(0, 0, 0)); if (go) { //go.transform.SetParent(transform); //go.transform.localPosition = new Vector3(0, m_floatingHealthbarHeight, 0); m_floatingHealthBar = go.GetComponent <FloatingHealthbar>(); } if (m_floatingHealthBar) { m_floatingHealthBar.SetCharacter(this); m_floatingHealthBar.SetHealthBarOffset(new Vector3(0, m_floatingHealthbarHeight, 0)); } } }
void Start() { healthbar = GetComponent<FloatingHealthbar>(); health = maxHealth; player = GameObject.Find ("Player").transform; opponent = player.GetComponent<PlayerHealthbarController>(); }