Example #1
0
    private void Awake()
    {
        if (S != null)
        {
            Destroy(gameObject);
        }
        else
        {
            S = this;
        }

        playerDead = true;
        AutoFire   = true;

        // set up ship bounds
        shipBnd = GetComponent <BoundaryCheck>();
        shipBnd.keepOnScreen = true;

        weapon = GetComponentInChildren <Weapon>();

        spriteRend  = GetComponent <SpriteRenderer>();
        engRends    = engines.GetComponentsInChildren <SpriteRenderer>();
        engineColor = spriteRend.color;

        ExtraLives = 2;
    }
Example #2
0
    // Use this for initialization
    void Awake()
    {
        spriteRend    = GetComponent <SpriteRenderer>();
        color         = spriteRend.color;
        boundaryCheck = GetComponent <BoundaryCheck>();
        rb2d          = GetComponent <Rigidbody2D>();

        // Set velocity
        Vector3 vel = Vector3.down;

        vel          *= Random.Range(driftMinMax.x, driftMinMax.y);
        rb2d.velocity = vel;

        birthTime = Time.time;
    }
Example #3
0
    // Use this for initialization
    public virtual void Awake()
    {
        enemyRenderer = gameObject.GetComponent <SpriteRenderer>();
        originalColor = enemyRenderer.color;
        boundaryCheck = GetComponent <BoundaryCheck>();
        if (GameObject.FindWithTag("Level"))
        {
            levelFireChance = GameObject.FindWithTag("Level").GetComponent <LevelManager>().levelEnemyFireChance;
        }
        startHealth = health; // used to calcluate injury stages of a Boss

        if (PlayerPrefs.GetInt("startLevel") == 6)
        {
            currentDifficulty = infiniteDifficulty;
        }
        else
        {
            currentDifficulty = difficulty;
        }
    }