using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Looting : MonoBehaviour
{
private Rect inventoryWindowRect = new Rect (300, 100, 400, 400);
private bool inventoryWindowShow = false;
private Dictionary<int, string> lootDictionary = new Dictionary< int, string>()
{
{0, string.Empty},
{1, string.Empty},
{2, string.Empty},
{3, string.Empty},
{4, string.Empty},
{5, string.Empty},
{6, string.Empty},
{7, string.Empty},
{8, string.Empty}
};
ItemClass itemObject = new ItemClass();
private Ray mouseRay;
private RaycastHit rayHit;
// Use this for initialization
void Start()
{
//display dictionary
lootDictionary[0] = itemObject.arrowItem.name;
lootDictionary[1] = itemObject.breadItem.name;
}
// Update is called once per frame
void Update()
{
mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Input.GetButtonDown("Fire1"))
{
Physics.Raycast(mouseRay, out rayHit);
if (rayHit.collider.transform.tag == "lootable corpse")
{
inventoryWindowShow = true;
}
// Closes loot window
if (Input.GetButtonDown(KeyCode.I))
{
inventoryWindowShow = false;
}
}
void OnGUI()
{
if (inventoryWindowShow)
{
inventoryWindowRect = GUI.Window(0, inventoryWindowRect, inventoryWindowMethod, "corpse");
}
}
void inventoryWindowMethod (int WindowId)
{
GUILayout.BeginArea(new Rect(0, 50, 400, 400));
GUILayout.BeginHorizontal();
if (GUILayout.Button(lootDictionary[0], GUILayout.Height (50)))
{
if (lootDictionary[0] != string.Empty)
{
InventoryGUI.inventoryNameDictionary[0] = lootDictionary[0];
lootDictionary [0] = string.Empty;
}
}
if (GUILayout.Button(lootDictionary[1], GUILayout.Height(50)))
{
if (lootDictionary[1] != string.Empty)
{
InventoryGUI.inventoryNameDictionary[1] = lootDictionary[1];
lootDictionary [1] = string.Empty;
}
}
if (GUILayout.Button(lootDictionary[2], GUILayout.Height(50)))
{
if (lootDictionary[2] != string.Empty)
{
InventoryGUI.inventoryNameDictionary[2] = lootDictionary[2];
lootDictionary[2] = string.Empty;
}
}
GUILayout.EndHorizontal();
GUILayout.EndArea();
}
}
問題是行51.任何想法如何糾正它? 「}預期的」錯誤我已經嘗試了許多事物的組合。我也試過評論這個區塊,但沒有任何反應。我正在試圖爲一款遊戲搶劫系統。使用統一3D。「}預計」然而支架有
您可以在第51行添加評論嗎? –
告訴我們行號沒有行號沒有幫助。 –