Example #1
0
    public void createEnemy1()
    {
        if (Random.Range(0, 2) == 0)
        {
            Enemy1 enemy1 = Instantiate(GameObject.Find("Enemy1").GetComponent <Enemy1>(),
                                        new Vector3(leftBorderX, groundTopY + enemy1Height / 2, 0.0f), Quaternion.identity);

            enemy1.transform.rotation = new Quaternion(0, 0, 0, 0);
            enemy1.setDirection(1);
        }
        else
        {
            Enemy1 enemy1 = Instantiate(GameObject.Find("Enemy1").GetComponent <Enemy1>(),
                                        new Vector3(rightBorderX, groundTopY + enemy1Height / 2, 0.0f), Quaternion.identity);

            enemy1.transform.rotation = new Quaternion(0, 180, 0, 0);
            enemy1.setDirection(-1);
        }
    }