private float camHeight, camWidth, dir;//altura, anchura and direction (-1,0,1) in that order void Start() { gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControllerSC>(); cam_Camera = Camera.main; //Gets camera dimensions camHeight = 2f * cam_Camera.orthographicSize; camWidth = camHeight * cam_Camera.aspect; }
private void Start() //get components { //deathPanel = gameObject.GetComponent<Renderer>().material.color;//Color player gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControllerSC>(); rb = gameObject.GetComponent <Rigidbody2D>(); //spr = gameObject.GetComponent<SpriteRenderer>(); anim = gameObject.GetComponent <Animator>(); //circle = GameObject.FindGameObjectsWithTag("box").GetComponent<Rigidbody2D>(); }
public static GameControllerSC instance = null;//Variable to save the instance void Awake() { //Singleton start if (instance == null) //Check if instance already exists { instance = this; //if not, the instance is set to this GO } else if (instance != this) //If instance already exists but difirent GO: { Destroy(gameObject); //Destroys gameobject if diferent instance } DontDestroyOnLoad(gameObject); //Sets this to not be destroyed when reloading scene //Singleton ends }
private void Start() { gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControllerSC>(); }
private void Start() { gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControllerSC>(); playerTransform = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); startPosition = this.transform.position; }
void Start() { //Get components of gameobjects player = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControllerSC>(); }
void Start() { //get components gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameControllerSC>(); }