public void Build(int style) { if (!inBodyRange) { return; } if (body != null) { Vector3 pos = body.transform.position; if (Bodys != null) { int id = body.GetComponent <BodyAction>().getBodyInfo().ID; for (int i = 0; i < Bodys.Count; i++) { if (Bodys[i].ID == id) { Bodys.RemoveAt(i); } } } Destroy(body); GameObject m = Instantiate(monumentPrefabs[style], new Vector3(pos.x, pos.y, pos.z), Quaternion.identity) as GameObject; if (Graves != null) { Graves.Push(new GraveInfo(m.transform.position, gc.CurrentLevel, style)); } else { Graves = new Stack <GraveInfo>(); Graves.Push(new GraveInfo(m.transform.position, gc.CurrentLevel, style)); } } }