// Use this for initialization
 void Start()
 {
     go        = GameObject.Find("Handler");
     kontrolli = go.GetComponent <Kontrolli>();
     sr        = GetComponent <SpriteRenderer>();
     targetPos = transform.position;
     m_Grid    = GameObject.Find("Grid").GetComponent <Grid>();
     tilemap   = GameObject.Find("Base").GetComponent <Tilemap>();
     startTime = Time.time;
     Debug.Log("GAMEOBJECT ENABLED " + startTime + "POSITION " + targetPos);
     gridPos = m_Grid.WorldToCell(targetPos);
     Debug.Log("gridPos = " + gridPos);
     //Start the coroutine we define below named ExampleCoroutine.
     //StartCoroutine(ExampleCoroutine());
     //InitGame();
 }
Exemple #2
0
    // Use this for initialization
    void Awake()
    {
        fRuudukko = new float[10, 10];
        iRuudukko = new int[10, 10, 3]; //koordinaatit, id, tyyppi, merkattu = 1

        //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);

        m_Grid  = GameObject.Find("Grid").GetComponent <Grid>();
        tilemap = GameObject.Find("Base").GetComponent <Tilemap>();
    }
Exemple #3
0
 // Use this for initialization
 void Awake()
 {
     go        = GameObject.Find("Handler");
     kontrolli = go.GetComponent <Kontrolli>();
     targetPos = transform.position;
 }
Exemple #4
0
 // Use this for initialization
 void Start()
 {
     go        = GameObject.Find("Handler");
     kontrolli = go.GetComponent <Kontrolli>();
 }