void FixedUpdate() { transform.position -= direction / distance * speed; if (Mathf.Sqrt(Mathf.Pow(transform.position.x, 2) + Mathf.Pow(transform.position.y + 11f, 2)) < 8.25f) { playBoltStrike(); Destroy(gameObject); if (Health.healthcount > 0) { Health.AddHealth(-10); PlayerSector.FlipInput(); ReminderManager.ReverseControl(); PlayerSector.reverse.SetActive(true); } } }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.name == "Player") { playBoltStrike(); Destroy(gameObject); if (Health.healthcount > 0) { Health.AddHealth(-10); PlayerSector.FlipInput(); ReminderManager.ReverseControl(); PlayerSector.reverse.SetActive(true); } } if (other.gameObject.CompareTag("Trap")) { //if (other.gameObject.GetComponent<RadialTrap>().isSet) { playExplosion(); Destroy(gameObject); ScoreManager.AddScore(2); } } if (other.gameObject.CompareTag("Bullet")) { playExplosion(); Destroy(gameObject); Destroy(other.gameObject); ScoreManager.AddScore(2); } if (other.gameObject.CompareTag("Grenade")) { playExplosion(); Destroy(gameObject); ScoreManager.AddScore(2); } }