void Update() { var device = SteamVR_Controller.Input(index); /* * foreach (var buttonId in buttonIds) * { * if (SteamVR_Controller.Input(index).GetPressDown(buttonId)) * { * * } * if (SteamVR_Controller.Input(index).GetPressUp(buttonId)) * { * * } * if (SteamVR_Controller.Input(index).GetPress(buttonId)) * { * * } * } */ foreach (var buttonId in axisIds) { if (SteamVR_Controller.Input(index).GetTouchDown(buttonId)) { //Debug.Log(buttonId + " touch down"); } if (SteamVR_Controller.Input(index).GetTouchUp(buttonId)) { if (buttonId == EVRButtonId.k_EButton_SteamVR_Trigger) { DropItem(device); } } if (SteamVR_Controller.Input(index).GetTouch(buttonId)) { var axis = SteamVR_Controller.Input(index).GetAxis(buttonId); if (buttonId == EVRButtonId.k_EButton_SteamVR_Trigger) { if (itemInHand == null && axis.x >= grabThreshold && GetComponentInChildren <GrabTrigger>().things.Count > 0) { var thing = GetComponentInChildren <GrabTrigger>().things[0]; var item = thing as ObtainableItem; if (item != null) { itemInHand = item; itemInHand.Dispatch(ObtainableItemEventType.OnPickUp, this); } else { Actium.Dispatch("ViveHandInteractsWith_" + thing.name, this); } } } } } }
IEnumerator AddItemCo(ObtainableItem item, Vector3 point) { //Debug.Log(item+" has been added to the cauldron."); item.transform.parent = transform; var itemRigidbody = item.GetComponent<Rigidbody>(); itemRigidbody.useGravity = false; itemRigidbody.isKinematic = true; LeanTween.cancel(item.gameObject); LeanTween.move(item.gameObject, point + Vector3.up * 1f, 1f).setEase(LeanTweenType.easeOutCubic); LeanTween.rotate(item.gameObject, surface.transform.rotation.eulerAngles, 1f).setEase(LeanTweenType.easeInCubic); yield return new WaitForSeconds(1f); itemRigidbody.useGravity = true; itemRigidbody.isKinematic = false; yield return new WaitForSeconds(2f); items.Add(item); item.isAbleToInteract = true; //itemRigidbody.useGravity = false; //itemRigidbody.isKinematic = true; }
IEnumerator AddItemCo(ObtainableItem item, Vector3 point) { //Debug.Log(item+" has been added to the cauldron."); item.transform.parent = transform; var itemRigidbody = item.GetComponent <Rigidbody>(); itemRigidbody.useGravity = false; itemRigidbody.isKinematic = true; LeanTween.cancel(item.gameObject); LeanTween.move(item.gameObject, point + Vector3.up * 1f, 1f).setEase(LeanTweenType.easeOutCubic); LeanTween.rotate(item.gameObject, surface.transform.rotation.eulerAngles, 1f).setEase(LeanTweenType.easeInCubic); yield return(new WaitForSeconds(1f)); itemRigidbody.useGravity = true; itemRigidbody.isKinematic = false; yield return(new WaitForSeconds(2f)); items.Add(item); item.isAbleToInteract = true; //itemRigidbody.useGravity = false; //itemRigidbody.isKinematic = true; }
public void OnItemAdd(ObtainableItem item) { if (items == null) items = new List<ObtainableItem>(); StartCoroutine(AddItemCo(item, surface.transform.position)); }
IEnumerator RemoveItemCo(ObtainableItem item) { items.Remove(item); surface.isAbleToInteract = false; var targetPosition = item.transform.position + Vector3.up * 1f; var itemRigidbody = item.GetComponent <Rigidbody>(); itemRigidbody.useGravity = false; itemRigidbody.isKinematic = true; LeanTween.cancel(item.gameObject); LeanTween.move(item.gameObject, targetPosition, 1f).setEase(LeanTweenType.easeOutCubic); yield return(new WaitForSeconds(1f)); item.isAbleToInteract = true; item = null; yield return(new WaitForSeconds(1.5f)); // Activate the surface with delay after removing an item, // so the item wont get back to inventory if Player continues to point at the spot after getting the item in hand. surface.isAbleToInteract = true; }
public void OnItemTakeByVisitor(ObtainableItem item) { if (paintingHoop.hoopIndex == -1) { paintingHoop.NextHoop(); paintingHoop.targetBall = GetComponent <Basketball>(); } }
public void Drop(ObtainableItem item) { //Debug.Log("Visitor drops "+item); itemInHand.Frees(); itemInHand = null; sight.ResetTarget(); sight.reticle.SetBody(0); }
public void RegisterItem(ObtainableItem item) { if (items == null) { items = new List <ObtainableItem>(); } items.Add(item); }
public void OnItemTakeByVisitor(ObtainableItem item) { dropIsInitiated = false; targetPosition = Vector3.zero; if (GetComponent<ChangesSoundPitchOnRequest>() != null) { GetComponent<ChangesSoundPitchOnRequest>().FadeIn(1.5f); } }
public void OnItemAdd(ObtainableItem item) { if (items == null) { items = new List <ObtainableItem>(); } StartCoroutine(AddItemCo(item, surface.transform.position)); }
public void OnItemTakeByVisitor(ObtainableItem item) { dropIsInitiated = false; targetPosition = Vector3.zero; if (GetComponent <ChangesSoundPitchOnRequest>() != null) { GetComponent <ChangesSoundPitchOnRequest>().FadeIn(1.5f); } }
public void Add(ObtainableItem item) { var recipeItem = recipe.items.Find(i => HName.GetPure(i.itemName) == HName.GetPure(item.name)); if (recipeItem != null) { StartCoroutine(AddItemCo(item, recipeItem)); } else { StartCoroutine(RejectItemCo(item)); } }
IEnumerator RejectItemCo(ObtainableItem item) { Debug.Log(item + " has been rejected by the cauldron."); var itemRigidbody = item.GetComponent <Rigidbody>(); if (itemRigidbody != null) { itemRigidbody.useGravity = false; itemRigidbody.isKinematic = true; } LeanTween.move(item.gameObject, transform.position + Vector3.up * 1f, 1f).setEase(LeanTweenType.easeOutCubic); yield return(new WaitForSeconds(1f)); var targetPosition = pointOnSurface.position; LeanTween.move(item.gameObject, targetPosition, 0.5f); yield return(new WaitForSeconds(0.5f)); if (GetComponent <PlaysAudioRemarkOnRadio>()) { var maxIndex = GetComponent <PlaysAudioRemarkOnRadio>().remarks.Count; GetComponent <PlaysAudioRemarkOnRadio>().Play(Random.Range(2, maxIndex)); } audioPlayer.PlayOneShot(1); foreach (GameObject subscriber in subscribers) { subscriber.SendMessage("OnRejectFromCauldron", item, SendMessageOptions.DontRequireReceiver); } LeanTween.move(item.gameObject, transform.position + Vector3.up * 1f, 1f).setEase(LeanTweenType.easeOutCubic); yield return(new WaitForSeconds(1f)); LeanTween.move(item.gameObject, pointForRejected.position, 1f).setEase(LeanTweenType.easeOutCubic); yield return(new WaitForSeconds(1f)); if (itemRigidbody != null) { itemRigidbody.useGravity = true; itemRigidbody.isKinematic = false; } item.isAbleToInteract = true; yield return(new WaitForSeconds(1.5f)); itemRigidbody.isKinematic = true; }
public void AddItem(ObtainableItem item) { if (receiver == null && transform.parent != null) receiver = transform.parent.gameObject; ItemAddingToSurfaceInfo info; info.item = item; info.point = King.visitor.sight.hitInfo.point; receiver.gameObject.SendMessage("OnItemAdd", info); }
void DropItem(SteamVR_Controller.Device device) { if (itemInHand != null) { itemInHand.Dispatch(ObtainableItemEventType.OnDropOff, this); itemInHand.owner = null; itemInHand.GetComponent <Rigidbody>().velocity = device.velocity * 1.4f; itemInHand = null; } }
void DropItem(SteamVR_Controller.Device device) { if (itemInHand != null) { itemInHand.Dispatch(ObtainableItemEventType.OnDropOff, this); itemInHand.owner = null; itemInHand.GetComponent<Rigidbody>().velocity = device.velocity * 1.4f; itemInHand = null; } }
public void RemoveItem(ObtainableItem item) { var spotWithItem = spots.Find(s => s.item == item); if (spotWithItem == null) { Debug.LogWarning("Couldn't find " + item + " in any of the InventorySpots"); return; } spotWithItem.RemoveItem(); }
public void Take(ObtainableItem item) { //Debug.Log("Visitor takes "+item); itemInHand = item; item.Obtains(); sight.ResetTarget(); sight.reticle.SetBody(1); if (soundPlayer != null) { soundPlayer.PlayOneShot(0); } }
public void AddItem(ObtainableItem item) { if (receiver == null && transform.parent != null) { receiver = transform.parent.gameObject; } ItemAddingToSurfaceInfo info; info.item = item; info.point = King.visitor.sight.hitInfo.point; receiver.gameObject.SendMessage("OnItemAdd", info); }
public void Add(ObtainableItem item) { if (this.item != null) return; this.item = item; prevItemParent = item.transform.parent; item.transform.parent = transform; transform.parent.SendMessage("RegisterItem", item); _collider.enabled = false; Debug.Log(this.item+" has been added to the inventory."); StartCoroutine(AddItemCo()); }
public bool HasItem(string name) { ObtainableItem item = ItemList.FirstOrDefault(i => i.Name == name); if (item == default(ObtainableItem)) { if (DebugMode) { Debug.LogWarning("Could not find item " + name + " in the listing; the player dosen't have it!"); } return(false); } return(item.Owned); }
IEnumerator AddItemCo(ObtainableItem item, RecipeItem recipeItem) { Debug.Log(item + " has been added to the cauldron."); ingredientsUsed += 1; recipeItem.collected += 1; var itemRigidbody = item.GetComponent <Rigidbody>(); if (itemRigidbody != null) { itemRigidbody.useGravity = false; itemRigidbody.isKinematic = true; } LeanTween.move(item.gameObject, transform.position + Vector3.up * 1f, 1f).setEase(LeanTweenType.easeOutCubic); yield return(new WaitForSeconds(1f)); var targetPosition = pointInside.position; LeanTween.move(item.gameObject, targetPosition, 0.5f); audioPlayer.PlayOneShotAfterSec(0, 0.25f); if (ingredientsUsed == 1 && GetComponent <PlaysAudioRemarkOnRadio>() != null && !potionIsReady) { GetComponent <PlaysAudioRemarkOnRadio>().Play(0); } yield return(new WaitForSeconds(0.5f)); foreach (GameObject subscriber in subscribers) { subscriber.SendMessage("OnAddToCauldron", recipeItem, SendMessageOptions.DontRequireReceiver); } item.gameObject.SetActive(false); isAbleToInteract = true; if (potionIsReady) { GivePotion(); } }
public void Add(ObtainableItem item) { if (this.item != null) { return; } this.item = item; prevItemParent = item.transform.parent; item.transform.parent = transform; transform.parent.SendMessage("RegisterItem", item); _collider.enabled = false; Debug.Log(this.item + " has been added to the inventory."); StartCoroutine(AddItemCo()); }
public void AddItem(ObtainableItem item) { if (spots.Find(s => s.item == item) != null) { Debug.LogWarning("Item is already is in one of the inventory spots."); return; } var freeSpot = spots.Find(s => s.item == null); if (freeSpot == null) { Debug.LogWarning("There isn't any free InventorySpot available."); return; } freeSpot.Add(item); }
public void Play(ObtainableItem item) { CloseFlap(); item.transform.position = cassettePoint.position; item.transform.parent = transform; item.GetComponent<Rigidbody>().isKinematic = true; item.GetComponent<Rigidbody>().detectCollisions = false; var cassette = item.GetComponent<Cassette>(); if (cassette == null) return; speakers.clip = cassette.audioClip; Invoke("Play", 1.5f); }
IEnumerator RemoveItemCo() { isAbleToInteract = false; var targetPosition = transform.position + Vector3.up * 0.5f; LeanTween.move(item.gameObject, targetPosition, 1f).setEase(LeanTweenType.easeOutCubic); yield return(new WaitForSeconds(1f)); item.isAbleToInteract = true; item = null; yield return(new WaitForSeconds(3f)); // Activate the spot with delay after removing an item, // so the item wont get back to inventory if Player continues to point at the spot after getting the item in hand. isAbleToInteract = true; }
public void Play(ObtainableItem item) { CloseFlap(); item.transform.position = cassettePoint.position; item.transform.parent = transform; item.GetComponent <Rigidbody>().isKinematic = true; item.GetComponent <Rigidbody>().detectCollisions = false; var cassette = item.GetComponent <Cassette>(); if (cassette == null) { return; } speakers.clip = cassette.audioClip; Invoke("Play", 1.5f); }
void OnExitHoop(object sender) { lastItemPassedThrough = sender as ObtainableItem; /* * if (lastItemPassedThrough.lastOwner == null) * return; */ /* * var visitor = lastItemPassedThrough.lastOwner.GetComponent<Visitor>(); * * if (visitor == null) * return; * * if (visitor.avatar.face.GetComponent<Renderer>().material.color == DisplayColor) * { * Score += 1; * } */ Score += 1; }
void OnExitHoop(object sender) { lastItemPassedThrough = sender as ObtainableItem; /* if (lastItemPassedThrough.lastOwner == null) return; */ /* var visitor = lastItemPassedThrough.lastOwner.GetComponent<Visitor>(); if (visitor == null) return; if (visitor.avatar.face.GetComponent<Renderer>().material.color == DisplayColor) { Score += 1; } */ Score += 1; }
private string FormatItemLine() { StringBuilder builder = new StringBuilder("Items:"); // Format of line: // Items:A|B|C|E|F|G for (int i = 0; i < _ambassador.ItemList.Count; i++) { ObtainableItem current = _ambassador.ItemList[i]; if (!current.Owned) { continue; } builder.Append(current.Name); if (i < _ambassador.ItemList.Count - 1) { builder.Append("|"); } } return(builder.ToString()); }
IEnumerator AddItemCo(ObtainableItem item, RecipeItem recipeItem) { Debug.Log(item+" has been added to the cauldron."); ingredientsUsed += 1; recipeItem.collected += 1; var itemRigidbody = item.GetComponent<Rigidbody>(); if (itemRigidbody != null) { itemRigidbody.useGravity = false; itemRigidbody.isKinematic = true; } LeanTween.move(item.gameObject, transform.position + Vector3.up * 1f, 1f).setEase(LeanTweenType.easeOutCubic); yield return new WaitForSeconds(1f); var targetPosition = pointInside.position; LeanTween.move(item.gameObject, targetPosition, 0.5f); audioPlayer.PlayOneShotAfterSec(0, 0.25f); if (ingredientsUsed == 1 && GetComponent<PlaysAudioRemarkOnRadio>() != null && !potionIsReady) GetComponent<PlaysAudioRemarkOnRadio>().Play(0); yield return new WaitForSeconds(0.5f); foreach (GameObject subscriber in subscribers) { subscriber.SendMessage("OnAddToCauldron", recipeItem, SendMessageOptions.DontRequireReceiver); } item.gameObject.SetActive(false); isAbleToInteract = true; if (potionIsReady) GivePotion(); }
public void GainItem(string name) { ObtainableItem item = ItemList.FirstOrDefault(i => i.Name == name); if (item == default(ObtainableItem)) { if (DebugMode) { Debug.LogWarning("Could not find item " + name + " in the listing; adding it as owned!"); } ItemList.Add(new ObtainableItem { Name = name, Owned = true }); return; } if (DebugMode) { Debug.Log("Adding ownership of item " + name); } item.Owned = true; }
public override void PerformSegue(ObtainableItem item) { base.PerformSegue (item); item.GetComponent<Rigidbody>().isKinematic = true; item.GetComponent<Rigidbody>().detectCollisions = false; radio.OpenFlap(); item.transform.parent = radio.transform; var cassettePoint = radio.cassettePoint; var cassetterUpPosition = cassettePoint.transform.localPosition + (cassettePoint.up + -cassettePoint.forward) * 0.2f; LeanTween.rotateLocal(item.gameObject, cassettePoint.localRotation.eulerAngles, 1f).setEase(LeanTweenType.easeInSine); LeanTween.moveLocal(item.gameObject, cassetterUpPosition, 1f).setOnComplete(delegate() { LeanTween.moveLocal(item.gameObject, cassettePoint.localPosition, 1f).setOnComplete(delegate() { radio.Play(item); }).setEase(LeanTweenType.easeInSine); }).setEase(LeanTweenType.easeInSine); //radio.Play(item); }
public override void PerformSegue(ObtainableItem item) { base.PerformSegue(item); item.GetComponent <Rigidbody>().isKinematic = true; item.GetComponent <Rigidbody>().detectCollisions = false; radio.OpenFlap(); item.transform.parent = radio.transform; var cassettePoint = radio.cassettePoint; var cassetterUpPosition = cassettePoint.transform.localPosition + (cassettePoint.up + -cassettePoint.forward) * 0.2f; LeanTween.rotateLocal(item.gameObject, cassettePoint.localRotation.eulerAngles, 1f).setEase(LeanTweenType.easeInSine); LeanTween.moveLocal(item.gameObject, cassetterUpPosition, 1f).setOnComplete(delegate() { LeanTween.moveLocal(item.gameObject, cassettePoint.localPosition, 1f).setOnComplete(delegate() { radio.Play(item); }).setEase(LeanTweenType.easeInSine); }).setEase(LeanTweenType.easeInSine); //radio.Play(item); }
public void OnItemTakeByVisitor(ObtainableItem item) { enabled = false; }
public void OnItemTakeByVisitor(ObtainableItem item) { StartCoroutine(GoToSleepInSecCo(goToSleepAfterSec)); }
public void OnItemFreeByVisitor(ObtainableItem item) { StartCoroutine(FadeOutMusicAfterFreeingCo()); }
public void OnItemTakeByVisitor(ObtainableItem item) { barrel.GetComponent<PlaysAnimationOnSight>().isAbleToInteractAfterAnimation = false; }
IEnumerator RemoveItemCo(ObtainableItem item) { items.Remove(item); surface.isAbleToInteract = false; var targetPosition = item.transform.position + Vector3.up * 1f; var itemRigidbody = item.GetComponent<Rigidbody>(); itemRigidbody.useGravity = false; itemRigidbody.isKinematic = true; LeanTween.cancel(item.gameObject); LeanTween.move(item.gameObject, targetPosition, 1f).setEase(LeanTweenType.easeOutCubic); yield return new WaitForSeconds(1f); item.isAbleToInteract = true; item = null; yield return new WaitForSeconds(1.5f); // Activate the surface with delay after removing an item, // so the item wont get back to inventory if Player continues to point at the spot after getting the item in hand. surface.isAbleToInteract = true; }
public void DeregisterItem(ObtainableItem item) { items.Remove(item); }
public void OnItemTakeByVisitor(ObtainableItem item) { var _animator = GetComponent <Animator>(); }
IEnumerator RejectItemCo(ObtainableItem item) { Debug.Log(item+" has been rejected by the cauldron."); var itemRigidbody = item.GetComponent<Rigidbody>(); if (itemRigidbody != null) { itemRigidbody.useGravity = false; itemRigidbody.isKinematic = true; } LeanTween.move(item.gameObject, transform.position + Vector3.up * 1f, 1f).setEase(LeanTweenType.easeOutCubic); yield return new WaitForSeconds(1f); var targetPosition = pointOnSurface.position; LeanTween.move(item.gameObject, targetPosition, 0.5f); yield return new WaitForSeconds(0.5f); if (GetComponent<PlaysAudioRemarkOnRadio>()) { var maxIndex = GetComponent<PlaysAudioRemarkOnRadio>().remarks.Count; GetComponent<PlaysAudioRemarkOnRadio>().Play(Random.Range(2, maxIndex)); } audioPlayer.PlayOneShot(1); foreach (GameObject subscriber in subscribers) { subscriber.SendMessage("OnRejectFromCauldron", item, SendMessageOptions.DontRequireReceiver); } LeanTween.move(item.gameObject, transform.position + Vector3.up * 1f, 1f).setEase(LeanTweenType.easeOutCubic); yield return new WaitForSeconds(1f); LeanTween.move(item.gameObject, pointForRejected.position, 1f).setEase(LeanTweenType.easeOutCubic); yield return new WaitForSeconds(1f); if (itemRigidbody != null) { itemRigidbody.useGravity = true; itemRigidbody.isKinematic = false; } item.isAbleToInteract = true; yield return new WaitForSeconds(1.5f); itemRigidbody.isKinematic = true; }
public virtual void PerformSegue(ObtainableItem item) { }
public void OnItemTakeByVisitor(ObtainableItem item) { StartCoroutine(EatCo()); }
public void OnItemTakeByVisitor(ObtainableItem item) { barrel.GetComponent <PlaysAnimationOnSight>().isAbleToInteractAfterAnimation = false; }
public void OnItemTakeByVisitor(ObtainableItem item) { StartCoroutine(RemoveItemCo(item)); }
IEnumerator RemoveItemCo() { isAbleToInteract = false; var targetPosition = transform.position + Vector3.up * 0.5f; LeanTween.move(item.gameObject, targetPosition, 1f).setEase(LeanTweenType.easeOutCubic); yield return new WaitForSeconds(1f); item.isAbleToInteract = true; item = null; yield return new WaitForSeconds(3f); // Activate the spot with delay after removing an item, // so the item wont get back to inventory if Player continues to point at the spot after getting the item in hand. isAbleToInteract = true; }
public void OnItemTakeByVisitor(ObtainableItem item) { StartCoroutine(GoToPlaceInSec(moveAfterSec)); }
public void OnItemTakeByVisitor(ObtainableItem item) { var _animator = GetComponent<Animator>(); }
void Update() { var device = SteamVR_Controller.Input(index); /* foreach (var buttonId in buttonIds) { if (SteamVR_Controller.Input(index).GetPressDown(buttonId)) { } if (SteamVR_Controller.Input(index).GetPressUp(buttonId)) { } if (SteamVR_Controller.Input(index).GetPress(buttonId)) { } } */ foreach (var buttonId in axisIds) { if (SteamVR_Controller.Input(index).GetTouchDown(buttonId)) { //Debug.Log(buttonId + " touch down"); } if (SteamVR_Controller.Input(index).GetTouchUp(buttonId)) { if (buttonId == EVRButtonId.k_EButton_SteamVR_Trigger) { DropItem(device); } } if (SteamVR_Controller.Input(index).GetTouch(buttonId)) { var axis = SteamVR_Controller.Input(index).GetAxis(buttonId); if (buttonId == EVRButtonId.k_EButton_SteamVR_Trigger) { if (itemInHand == null && axis.x >= grabThreshold && GetComponentInChildren<GrabTrigger>().things.Count > 0) { var thing = GetComponentInChildren<GrabTrigger>().things[0]; var item = thing as ObtainableItem; if (item != null) { itemInHand = item; itemInHand.Dispatch(ObtainableItemEventType.OnPickUp, this); } else { Actium.Dispatch("ViveHandInteractsWith_" + thing.name, this); } } } } } }
void Update() { foreach (var index in controllerIndices) { //var controllerState = SteamVR_Controller.Input((int)index).GetState(); //var t = transform; //var baseTransform = new SteamVR_Utils.RigidTransform(t); var device = SteamVR_Controller.Input(index); // TODO: why it does return the position and rotation with a quite noticeable delay to a real position? /* transform.position = device.transform.pos; transform.rotation = device.transform.rot; */ foreach (var buttonId in buttonIds) { if (SteamVR_Controller.Input(index).GetPressDown(buttonId)) { if (buttonId == EVRButtonId.k_EButton_SteamVR_Trigger) { //Debug.Log("GRAB"); } } if (SteamVR_Controller.Input(index).GetPressUp(buttonId)) { /* Debug.Log(buttonId + " press up"); if (buttonId == EVRButtonId.k_EButton_SteamVR_Trigger) { SteamVR_Controller.Input(index).TriggerHapticPulse(); PrintControllerStatus(index); } */ } if (SteamVR_Controller.Input(index).GetPress(buttonId)) { //Debug.Log(buttonId); } } foreach (var buttonId in axisIds) { if (SteamVR_Controller.Input(index).GetTouchDown(buttonId)) { //Debug.Log(buttonId + " touch down"); } if (SteamVR_Controller.Input(index).GetTouchUp(buttonId)) { DropItem(device); } if (SteamVR_Controller.Input(index).GetTouch(buttonId)) { var axis = SteamVR_Controller.Input(index).GetAxis(buttonId); if (buttonId == EVRButtonId.k_EButton_SteamVR_Trigger) { if (axis.x >= grabThreshold && GetComponentInChildren<GrabTrigger>().things.Count > 0) { var thing = GetComponentInChildren<GrabTrigger>().things[0]; if (thing != null && thing.GetComponent<ObtainableItem>() != null && thing.GetComponent<ObtainableItem>().IsObtainable) { itemInHand = thing.GetComponent<ObtainableItem>(); itemInHand.Dispatch(ObtainableItemEventType.OnPickUp, this); } } else { DropItem(device); } } } } } }