void OnTriggerEnter2D(Collider2D col) { ItemActivate item = itemGO.GetComponent <ItemActivate> (); if (col.tag == "Player") { foreach (bool value in item.getHaveItemArray()) { if (value) { item.setItemActive(false); col.gameObject.transform.position = warp.position; Camera.main.transform.position = warp.position; item.setItemActive(true); return; } else { col.gameObject.transform.position = warp.position; Camera.main.transform.position = warp.position; return; } } } }
public Item(string name, int id, string desc, ItemType type, ItemActivate obj) { itemName = name; itemID = id; itemDesc = desc; itemIcon = Resources.Load <Texture2D>("Item Icons/" + name); itemType = type; itemObject = obj; }
public virtual bool Activate(string activeCase) { if (ItemActivate != null) { ItemActivate.Invoke(Id); } //Remove(true); return(true); }
protected virtual void OnItemActivate(EventArgs e) { ItemActivate?.Invoke(this, e); }