Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        customizationManager = GameObject.Find("CustomizationManager").GetComponent <CustomizationManager>();
        startPos             = this.transform.position;

        botY   = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0, 0)).y - 3;
        topY   = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)).y + 3;
        rightX = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)).x + 3;
        leftX  = Camera.main.ScreenToWorldPoint(Vector3.zero).x - 3;
        // Setting the ball's custom attributes
        gameObject.AddComponent <SpriteRenderer>(customizationManager.GetCurrentBall());
        gameObject.GetComponent <SpriteRenderer>().sortingOrder = 10;
        noGrav = GameObject.FindGameObjectsWithTag("NoGrav");

        if (customizationManager.HasTrail())
        {
            gameObject.AddComponent <TrailRenderer>(customizationManager.GetCurrentTrail());
        }
    }