Exemplo n.º 1
0
    void Start()
    {
        player        = GameObject.FindGameObjectWithTag("Player");
        target        = player.GetComponent <Transform>();
        rb            = GetComponent <Rigidbody2D>();
        parentBul     = transform.parent.GetComponent <RapidBullet>();
        slowDownSpeed = rotateSpeed;

        Vector2 direction = new Vector2(transform.right.x, transform.right.y);

        rb.velocity = direction * bulletSpeed;
        anim.Play();
    }
Exemplo n.º 2
0
    void DeleteObjectsOnPlayerDamage(bool playerIsDead)
    {
        EnemySpawner.spawner.SetIsSpawning(false);

        if (playerIsDead)
        {
            AudioManager.Instance.Stop("MusicGame");
            // Achievement checks
            TripleCheckUnlock();
            FollowCheckUnlock(scoreText.GetScore());
            RapidCheckUnlock();

            healthUI.DisableUI();
            deathText.EnableText();
            scoreText.MoveText();
            scoreText.SetHighScore();
            ReadWriteSaveManager.Instance.SetData("PlayedOnce", true, true);
        }

        GameObject[] enemies = GameObject.FindGameObjectsWithTag("Enemy");
        foreach (GameObject enemy in enemies)
        {
            if (enemy != null)
            {
                Destroy(enemy);
            }
        }

        GameObject[] bullets = GameObject.FindGameObjectsWithTag("Bullet");
        foreach (GameObject bullet in bullets)
        {
            if (bullet != null)
            {
                Destroy(bullet);
            }
        }

        SpawningObject[] spawningObjects = FindObjectsOfType <SpawningObject>();
        foreach (SpawningObject spawningObj in spawningObjects)
        {
            if (spawningObj != null)
            {
                Destroy(spawningObj.gameObject);
            }
        }

        Bullet triBullet = FindObjectOfType <Bullet>();

        if (triBullet != null)
        {
            Destroy(triBullet.gameObject);
        }

        TripleBullet tripleBullet = FindObjectOfType <TripleBullet>();

        if (tripleBullet != null)
        {
            Destroy(tripleBullet.gameObject);
        }

        FollowBullet followBullet = FindObjectOfType <FollowBullet>();

        if (followBullet != null)
        {
            Destroy(followBullet.gameObject);
        }

        SpongeBullet spongeBullet = FindObjectOfType <SpongeBullet>();

        if (spongeBullet != null)
        {
            Destroy(spongeBullet.gameObject);
        }

        RapidBullet rapidBullet = FindObjectOfType <RapidBullet>();

        if (rapidBullet != null)
        {
            Destroy(rapidBullet.gameObject);
        }

        BounceBullet bounceBullet = FindObjectOfType <BounceBullet>();

        if (bounceBullet != null)
        {
            Destroy(bounceBullet.gameObject);
        }
    }