public void MoveInstructionScrollLower() { //Make it the 'top' element InstructionBubbleObj.transform.SetAsLastSibling(); //Move it RectTransform rectTransform = InstructionBubbleObj.GetComponent <RectTransform>(); Vector2 pos = new Vector3(0.85f, 0.25f); pos = Camera.main.ViewportToScreenPoint(pos); InstructionBubbleObj.transform.DOMove(pos, 2f, false); }
public void PreviousInstructionText() { if (activePage - 1 >= 0) { instructionTextBox.text = instructionText[--activePage]; //Modify size of instruction bubble InstructionBubbleObj.GetComponent <InstructionBubbleSizing>().UpdateSize(); OnInstruct(); } }
public void ShowInstructionBubbleNextTo(List <string> instructions) { //Debug.Log("Showing instruction bubble and canvasElement is " + canvasElement); if (instructions == null) { HideBubble(); return; } activePage = 0; Instruction = true; //Debug.Log(instructions.Count + " is instruction length"); instructionTextBox.text = instructions[activePage]; Vector2 pos = new Vector2(0f, 0f); RectTransform rectTransform = InstructionBubbleObj.GetComponent <RectTransform>(); //Need to manage canvas vs normal gameObjects if (targetObj != null) { if (canvasElement) { pos = Camera.main.ScreenToViewportPoint(targetObj.transform.position); //Debug.Log("pos = " + pos); pos = ModifyPosition(pos); pos = Camera.main.ViewportToScreenPoint(pos); InstructionBubbleObj.transform.position = pos; } else { pos = Camera.main.WorldToViewportPoint(targetObj.transform.position); //Debug.Log("pos = " + pos); pos = ModifyPosition(pos); //Debug.Log("Modified pos = " + pos); pos = Camera.main.ViewportToScreenPoint(pos); //Debug.Log("Final pos = " + pos); InstructionBubbleObj.transform.position = pos; //InstructionBubbleObj.GetComponent<RectTransform>().anchoredPosition = pos; } } InstructionBubbleObj.SetActive(true); ExpositionBubbleObj.SetActive(false); //Put tutorial indicator over item tutorialRuneObj.GetComponent <TutorialRuneIndicator>().SetPosition(targetObj, canvasElement); tutorialRuneObj.SetActive(true); OnInstruct(); }
public void NextInstructionText() { //Need to destroy the indicator as changing the instruction means changing its location. Right now it is easier //To instantiate the indicator within the inventory than through the instruction bubble if (tutorialRuneObj != null) { Destroy(tutorialRuneObj); } if (activePage + 1 < instructionText.Count) { instructionTextBox.text = instructionText[++activePage]; //Modify size of instruction bubble InstructionBubbleObj.GetComponent <InstructionBubbleSizing>().UpdateSize(); OnInstruct(); } }