Exemplo n.º 1
0
    void Awake()
    {
        foreach (var render in GetComponentsInChildren <Renderer>())
        {
            render.sortingLayerName = "Character";
        }
        mecanim = GetComponentInChildren <Animator>();

        controller   = GetComponent <CharacterController2D>();
        scoreManager = FindObjectOfType <ScoreManager>();

        if (Application.isEditor && Camera.main == null)
        {
            Application.LoadLevel("title");
            return;
        }

        var screenMin = Camera.main.ScreenToWorldPoint(new Vector3(0, 0));

        transform.position = new Vector3(screenMin.x, transform.position.y);

        defaultDown = FindObjectOfType <DefaultDown>();
        defaultDown.playerControl = gameObject;
        scoreManager.ActivateAchievements();
    }