private void OnTriggerEnter(Collider other) { StaticStuff.FlowDebug(this.name + " OnTriggerEnter() other: " + other.name); ArticyReference colliderArtRef = other.gameObject.GetComponent <ArticyReference>(); if (colliderArtRef == null) { //Debug.LogWarning("null ArticyReference on the thing we collided with."); StaticStuff.FlowDebugWarning("null ArticyReference on the thing we collided with."); } else { //Debug.Log("we connected with something that has an ArticyRef. Now lets see if it's an NPC."); StaticStuff.FlowDebug("we connected with something that has an ArticyRef. Now lets see what it is."); Dialogue dialogue = colliderArtRef.reference.GetObject() as Dialogue; if (dialogue != null) { StaticStuff.FlowDebug("we have a dialogue, so set the FlowPlayer to start on it"); SceneRoot.SetFlowPlayerStartOn(dialogue); NavMeshAgent.SetDestination(this.transform.position); } else { StaticStuff.FlowDebugWarning("not sure what to do with this type yet: " + colliderArtRef.reference.GetObject().GetType()); } } }
/// <summary> /// Called when the control is created and it basically is setup to represent the item in the inventory bar /// </summary> public void AssignItem(Item aNewItem, Inventory aInventorySystem) { itemRef = GetComponent <ArticyReference>(); sceneHandler = FindObjectOfType <SceneHandler>(); inventorySystem = aInventorySystem; itemRef.SetObject(aNewItem); if (itemRef.IsValid) { // we use the previewimage to get the icon of the item icon.sprite = aNewItem.PreviewImage.Asset.LoadAssetAsSprite(); // and we update the object name, makes it easier when debugging the inventory in unity gameObject.name = string.Format("ItemUI_{0}", aNewItem.TechnicalName); } // making sure the hover background is hidden hoverBackground.gameObject.SetActive(false); }