Exemplo n.º 1
0
    //Feedback


    //Awake is always called before any Start functions
    void Awake()
    {
        Application.targetFrameRate = 300;
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        //Get components
        levelManager = GetComponent <LevelManager>();
        boundManager = GetComponent <BoundManager>();
        lineRenderer = GetComponent <LineRenderer>();
        adMobManager = GetComponent <AdMobManager>();
        colorManager = GetComponent <ColorManager>();
        uIManager    = GetComponent <UIManager>();
        //iAPManager = new IAPManager();

        //Init objects
        trajectorySimulator = new TrajectorySimulation(lineRenderer);
        ballObjectsList     = new List <GameObject>();
    }
Exemplo n.º 2
0
    private List <GameObject> trajectoryPoints;       // List of all trajectory points

    // Initialization of singleton.
    private void Awake()

    {
        if (!Instance)             // Determine if instance is null
        {
            Instance = this;       // Assign instance
        }
        else if (Instance != this) // Determine if instance already assigned
        {
            Destroy(gameObject);   // If we have that already, we don't need another one.
        }
    }
Exemplo n.º 3
0
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }
        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        myController = Instantiate(controller, transform.position, Quaternion.identity);
        myController.SetActive(false);

        arrowSprite       = arrow.GetComponent <SpriteRenderer>();
        arrowBaseScale    = arrow.transform.localScale;
        arrowBaseRotation = arrow.transform.rotation;
        rBody             = GetComponent <Rigidbody2D>();
        laTrajectoire     = GetComponent <TrajectorySimulation>();
    }