void Start() { TextBox = new TextBox(); if (Randomize == true) { int randomIndex = UnityEngine.Random.Range(0, RandomItems.Length); Type = RandomItems[randomIndex]; Quantity = 1; } temp = new Item(Type); temp.Quantity = Quantity; if (Quantity == 1) { TextBox.addText("You received " + temp.Quantity + " " + temp.Name); } else if (Quantity > 1) { TextBox.addText("You received " + temp.Quantity + " " + temp.Name + "s"); } sRenderer = GetComponent<SpriteRenderer>(); BoxColl = GetComponent<BoxCollider2D>(); Player = GameObject.FindWithTag("Player").GetComponent<PlayerControls>(); }
// Use this for initialization void Start () { TextBox = new TextBox(); Quantity.Value = Quantity.Random; Item i = new Item(itm); TextBox.addText("Press \"c\" to pick up the " + i.Name); textboxObj = Resources.Load("TextBox") as GameObject; }
// Use this for initialization void Start () { TextBox = new TextBox(); foreach (string s in Speech) { TextBox.addText(s); } //Make a bigger box collider (GetComponent(typeof(BoxCollider2D)) as BoxCollider2D).size = new Vector2(0.46f, 0.46f); }
public void Start () { transform.position = StartPosition; gameObject.layer = 10; Rigid = GetComponent<Rigidbody2D>(); SpriteRender = GetComponent<SpriteRenderer>(); ladderTB = new TextBox(); ladderTB.addText("Press \"c\" to use the ladder"); textbox = Resources.Load("TextBox") as GameObject; tbTextMesh = textbox.GetComponentInChildren<TextMesh>(); smartText = textbox.GetComponentInChildren<SmartText>(); MyBoxCollider = GetComponent<BoxCollider2D>(); GM = GameObject.Find("GameManager").GetComponent<GameManagerScript>(); inventory = this.gameObject.GetComponent<Inventory>(); }