Beispiel #1
0
    private void Start()
    {
        mainCamera        = Camera.main;
        backgroundCreator = new BackgroundCreator(innerBackground, outerBackground, Border, size, mainCamera);
        cameraPlacer      = new CameraPlacer(mainCamera, size, margin);
        levelSerializer   = new LevelSerializer();

        CreateTestLevel();
    }
Beispiel #2
0
    public void ReplacePlayer()
    {
        GameObject playerLast = GameObject.FindGameObjectWithTag("Player");

        GameObject[]      cloudList         = GameObject.FindGameObjectsWithTag("Cloud");
        GenerateMap       generateMap       = GameObject.Find("Generator").GetComponent <GenerateMap>();
        ScoreManager      scoreManager      = GameObject.Find("ScoreManager").GetComponent <ScoreManager>();
        BackgroundCreator backgroundCreator = GameObject.Find("BackgroundCreator").GetComponent <BackgroundCreator>();
        Settings          settings          = GameObject.Find("Buttons").GetComponent <Settings>();

        Destroy(playerLast);

        GameObject player = Instantiate(prefab, shop.SpawnPoint.position, Quaternion.identity);

        settings.GetComponent <Settings>().player                   = player.GetComponent <PersonController>();
        generateMap.GetComponent <GenerateMap>().player             = player.GetComponent <Transform>();
        scoreManager.GetComponent <ScoreManager>().player           = player.GetComponent <Transform>();
        backgroundCreator.GetComponent <BackgroundCreator>().player = player.GetComponent <Transform>();

        for (int i = 0; i < cloudList.Length; i++)
        {
            cloudList[i].GetComponent <Cloud>().player = player;
        }
    }