示例#1
0
    public void createEnemy3()
    {
        float initialeYPosition = Random.Range(groundTopY + enemy3Height, topCameraBorder - enemy3Height);

        if (Random.Range(0, 2) == 0)
        {
            Enemy3 enemy3 = Instantiate(GameObject.Find("Enemy3").GetComponent <Enemy3>(),
                                        new Vector3(leftBorderX, initialeYPosition, 0.0f), Quaternion.identity);

            enemy3.transform.rotation = new Quaternion(0, 0, 0, 0);
            enemy3.setDirection(1);
        }
        else
        {
            Enemy3 enemy3 = Instantiate(GameObject.Find("Enemy3").GetComponent <Enemy3>(),
                                        new Vector3(rightBorderX, initialeYPosition, 0.0f), Quaternion.identity);

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