void OnTriggerEnter2D(Collider2D col) { if (col.CompareTag("Bullet")) { ProjectTile beam = col.gameObject.GetComponent <ProjectTile> (); if (beam) { health -= beam.GetDamage(); //health berkurang healthBarBG.enabled = true; healthBar.enabled = true; beam.Hit(); healthBar.fillAmount = health / maxHealth; } } }
void OnTriggerEnter2D(Collider2D col) { if (col.CompareTag("Bullet")) { ProjectTile beam = col.gameObject.GetComponent <ProjectTile> (); if (beam) { health -= beam.GetDamage(); healthBarBG.enabled = true; healthBar.enabled = true; beam.Hit(); healthBar.fillAmount = health / maxHealth; } } if (col.name == "ObjectDestroyer") //jika kotak amal hancur, spawner aktif kembali { Spawner.GetComponent <SweeperSpawnerScript> ().CanSpawn = true; } }
void OnTriggerEnter2D(Collider2D col) { if (col.CompareTag("Bullet")) { ProjectTile beam = col.gameObject.GetComponent <ProjectTile> (); if (beam) { health -= beam.GetDamage(); beam.Hit(); } } if (col.CompareTag("Player")) { if (Player.getBoostStatus()) { health -= health; } } }
void OnTriggerEnter2D(Collider2D col) { if (col.CompareTag("Bullet")) { ProjectTile beam = col.gameObject.GetComponent <ProjectTile> (); if (beam) { health -= beam.GetDamage(); //darah berkurang healthBarBG.enabled = true; healthBar.enabled = true; beam.Hit(); healthBar.fillAmount = health / maxHealth; } } //jika menabrak player yang sedang dalam keadaan powerUp lupa if (col.CompareTag("Player")) { if (Player.Boost) { health -= health; //enemy hancur } } }