コード例 #1
0
ファイル: Chest.cs プロジェクト: BoolClub/ProjectCrusade
	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>();
	}
コード例 #2
0
ファイル: FloorItem.cs プロジェクト: BoolClub/ProjectCrusade
	// 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;
	}
コード例 #3
0
ファイル: NPC.cs プロジェクト: BoolClub/ProjectCrusade
	// 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);
	}
コード例 #4
0
	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>();
	}