/* * private void FixedUpdate() * { * float moveHorizontal = Input.GetAxis("Horizontal"); * float moveVertical = Input.GetAxis("Vertical"); * * Vector2 movement = new Vector2(moveHorizontal, moveVertical); * * rb.AddForce(movement * speed); * } */ private void OnCollisionEnter2D(Collision2D collision) { HealthBarHandlerEnemy.SetHealthBarValue(HealthBarHandlerEnemy.GetHealthBarValue() - 0.1f); if (HealthBarHandlerEnemy.GetHealthBarValue() <= 0) { Destroy(gameObject); } }
//public float speed; //private Rigidbody2D rb; private void Start() { //rb = GetComponent<Rigidbody2D>(); HealthBarHandlerEnemy.SetHealthBarValue(1); }
// Start is called before the first frame update void Start() { HealthBarHandlerEnemy.SetHealthBarValue(1); }