Ejemplo n.º 1
0
    void Start()
    {
        m_gc           = GameObject.FindWithTag("GameController").GetComponent <GameControllerScript>();
        m_alert        = GameObject.FindWithTag("GameController").GetComponent <AlertScript>();
        m_pointsSystem = GameObject.FindWithTag("PointsText").GetComponent <PointsSystemScript>();

        m_player = GameObject.FindWithTag("Player");

        InvokeRepeating("SpawnWave", 2, 6);
    }
Ejemplo n.º 2
0
    void Update()
    {
        int rng;

        // Detects if the enemy health has dropped below 0 and destroys them if it has.
        // Also plays appropriate sound clips when enemies die.
        if (health <= 0)
        {
            if (gameObject.layer == m_player.layer)
            {
                m_ss.PlaySoundClip(2);
            }

            if (m_pointsScript != null)
            {
                m_pointsScript.PointsUp(10);
            }
            else
            {
                m_pointsScript = GameObject.FindWithTag("PointsText").GetComponent <PointsSystemScript>();
            }

            rng = Random.Range(1, 100);

            if ((rng <= rndChance && m_gc.activePowerups == 0) || m_gc.dropNext == true)
            {
                SpawnPowerup();

                m_gc.PowerupDrop();
            }

            StopCoroutine("DamageColour");

            // Makes sure the elite spawners don't count as enemies for the purpose of enemy count.
            if (m_isPartOfElite == false)
            {
                m_gc.activeEnemies--;
            }
            else if (m_isElite == true)
            {
                m_gc.eliteActive = false;
            }

            AdjustAlert();

            Destroy(gameObject);
        }

        // Makes the enemy sprite flash on hit.
        if (m_enemySprite == null && m_isPartOfElite == false)
        {
            m_enemySprite   = GetComponentInChildren <SpriteRenderer>();
            m_defaultColour = m_enemySprite.color;
        }
    }
Ejemplo n.º 3
0
    void Start()
    {
        m_gc           = GameObject.FindWithTag("GameController").GetComponent <GameControllerScript>();
        m_alert        = GameObject.FindWithTag("GameController").GetComponent <AlertScript>();
        m_ss           = GameObject.FindWithTag("SoundManager").GetComponent <SoundScript>();
        m_pointsScript = GameObject.FindWithTag("PointsText").GetComponent <PointsSystemScript>();

        m_player = GameObject.FindWithTag("Player");

        m_enemySprite = GetComponentInChildren <SpriteRenderer>();

        if (m_isPartOfElite == false && m_enemySprite != null)
        {
            m_defaultColour = m_enemySprite.color;
        }
    }