private void Update() { boundary = Mathf.Abs(GetComponent <Transform>().position.x); if (boundary > 11) { Destroy(gameObject); SpawnMob.mobDestroy(); } }
public void Damage(int damageCount) { hp -= damageCount; /* * MonsterMove damage = new MonsterMove(); * damage.damage(damageCount); */ GetComponent <Rigidbody2D>().AddForce(new Vector2(0, 500f)); if (hp <= 0) { Destroy(gameObject); SpawnMob.mobDestroy(); } }