private void OnTriggerEnter2D(Collider2D collision) { EnemyBeing temp = collision.GetComponent <EnemyBeing>(); if (temp != null) { if ((collision.tag == "Enemy" || collision.tag == "Projectile") && temp.canGetGurt) { takeDamage(temp.attack); /* * int damage = temp.attack - defense; * if (damage <= 0) * { * damage = 1; * } * health = health - damage; * healthbar.localScale -= new Vector3(damage * barConstant, 0f, 0f); * if (health <= 0) * { * StartCoroutine(Die()); * } * else * { * StartCoroutine(SetInvin(0.5f)); * }*/ } } }
// Start is called before the first frame update void Start() { self = GetComponent <EnemyBeing>(); ply = GameObject.Find("Player"); leg0 = GameObject.Find("leg_0"); leg1 = GameObject.Find("leg_1"); part2 = Mathf.FloorToInt(self.health * 0.75f); part3 = Mathf.FloorToInt(self.health * 0.4f); shootEye = true; spawnRing = false; changeDir = false; audio = FindObjectOfType <AudioManager>(); audio.Stop("SettingsSong"); audio.Play("FirstBoss"); in_2 = false; in_3 = false; }
// Start is called before the first frame update void Start() { self = GameObject.Find("soldier").GetComponent <EnemyBeing>(); }