// Update is called once per frame public void inspect(GameObject obj, inspectType type, int priority, Dictionary <StatType, float> stats = null) { //Debug.Log("START ins -"+obj); inspectBlock b = new inspectBlock(obj, type, priority, stats); int i = 0; while (i < blocks.Count) { if (b.priority < blocks[i].priority) { break; } i++; } if (i == 0) { if (blocks.Count > 0) { killInspection(); } createInspection(b); } blocks.Insert(i, b); }
void createInspection(inspectBlock b) { switch (b.type) { case inspectType.card: handSample = Instantiate(b.obj, transform); handSample.transform.localPosition = Vector3.zero; if (b.stats != null) { generateKeywordDesc(b.stats); } break; case inspectType.cardmaker: case inspectType.cardmakerPre: bool isPre = b.type == inspectType.cardmakerPre; Unit u = b.obj.GetComponent <Unit>(); Ordnance o = b.obj.GetComponent <Ordnance>(); Equipment e = b.obj.GetComponent <Equipment>(); if (u) { //generateKeywordDesc(u.stat.export()); visualsUnit.populateSelf(u, isPre); visualsUnit.gameObject.SetActive(true); } else if (o) { visualsAbility.populateSelf(o, isPre); visualsAbility.gameObject.SetActive(true); } else if (e) { //generateKeywordDesc(e.GetComponent<StatHandler>().export()); visualsBuff.populateSelf(e, isPre); visualsBuff.gameObject.SetActive(true); } if (isPre) { if (b.stats != null) { generateKeywordDesc(b.stats); } } else { if (u || e) { generateKeywordDesc(b.obj.GetComponent <StatHandler>().export()); } } break; } }