- Home /
Question by
woolfgaang · Feb 15, 2018 at 09:25 PM ·
gameobjectinventory
Get inventory of gameobject
Im trying to show Objects on the map which contains the item of intrest by id. However, it seems to only work when i first interact with the object instead of always showing. Can I enable it somehow without interaction. Ive tried with setactive and enabled. Is there something else i can do?
foreach (GameObject kista in this.Chests)
{
kista.SetActive(true);
inne = kista.GetComponent<Inventory>();
inne.SetEnabled(true);
Utils.DrawLabelS(new Rect((float)(Screen.width - 160), 45f, 200f, 50f), this.Lang("b_dm"), Color.red, 15);
float num1 = Vector3.Distance(this.pLocalPlayer.transform.position, kista.transform.position);
if ((double)num1 <= (double)this.esplmt3)
{
Color c = Color.Lerp(Color.gray, Color.green, 0.5f);
int num2 = (int)num1;
//
//
if (inne.HasItem(231, 1))
{
Utils.DrawLabel(kista.transform.position, "[" + (object)num2 + "m]\n" + (" Detcap"), c, 12);
}
if (inne.HasItem(144, 1))
{
Utils.DrawLabel(kista.transform.position, "[" + (object)num2 + "m]\n" + ("C4"), c, 12);
}
}
}
Comment