private void Update() { if (Input.GetMouseButtonUp(1)) { int i = Random.Range(0, 3); Buildings type = Buildings.A; if (i == 0) { type = Buildings.A; } else if (i == 1) { type = Buildings.B; } else if (i == 2) { type = Buildings.C; } Build(type, Input.mousePosition); } if (Input.GetKeyUp(KeyCode.A)) { BuildSys.GetIns().GetBuildObjFromIndex("A_0").DoLevelUp(5); //Remove("A_0"); } }
public void Remove(string idx) { if (BuildSys.GetIns().Remove(idx)) { Debug.Log(string.Format("移除建筑{0}成功:", idx)); } else { Debug.Log(string.Format("建筑{0}不存在", idx)); } }
public void Build(Buildings e, Vector3 pos) { try { GameObject oo = BuildSys.GetIns().Build(e).gameObject; oo.transform.SetParent(map); oo.transform.position = pos; } catch (System.Exception ex) { Debug.LogError("null exception" + ex); } }