Beispiel #1
0
    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.SlowDown();
                ReminderManager.SlowDown();
                PlayerSector.slow.SetActive(true);
            }
        }
    }
Beispiel #2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.name == "Player" || other.gameObject.CompareTag("Wall"))
        {
            playBoltStrike();
            Destroy(gameObject);
            if (Health.healthcount > 0)
            {
                Health.AddHealth(-10);
                PlayerSector.SlowDown();
                ReminderManager.SlowDown();
                PlayerSector.slow.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);
        }
    }