private void Start() { ui = InGameUIManager.Instance; ui.ActionButton.onClick.AddListener(player.OnActionButtonClicked); ui.TransformationButton.onClick.AddListener(player.OnTransformationButtonClicked); leftButton = ui.LeftButton.GetComponent <ButtonPressHandler>(); rightButton = ui.RightButton.GetComponent <ButtonPressHandler>(); }
// Start is called before the first frame update void Start() { camPos = GameObject.Find("Main Camera").GetComponent <Transform>(); bph = GameObject.Find("EventSystem").GetComponent <ButtonPressHandler>(); // Spawn the player and center the camera on them. var cellWidth = Screen.width / cols; hopLength = cellWidth; transform.position = new Vector3(Screen.width / 2f + cellWidth * .5f, cellWidth * .5f, -0.5f); transform.localScale = new Vector3(cellWidth * 0.15f, cellWidth * 0.15f, 1); camPos.position = transform.position + new Vector3(-cellWidth * .5f, 0, -1); float ratio = (float)Screen.height / Screen.width; GameObject.Find("Main Camera").GetComponent <Camera>().orthographicSize = ratio * Screen.width / 2f; }
// Start is called before the first frame update void Start() { tilemap = GameObject.Find("Tilemap_Base"); eventSystemRef = GameObject.Find("EventSystem"); bph = GameObject.Find("EventSystem").GetComponent <ButtonPressHandler>(); }