public scr_Interactable_Result Interact(GameObject trigger, scr_Stats.ObjectType itemInInventory) { scr_Interactable_Result result = new scr_Interactable_Result(scr_Stats.Interaction.TalkToHuman, false); if (locInteractCDCounter >= locInteractCD) { locInteractCDCounter = 0; Debug.Log(TextResponse); GenerateTalkBubble(); //result.InteractionSuccessfull = true; result = new scr_Interactable_Result(scr_Stats.Interaction.TalkToHuman, true); } return(result); }
private scr_Stats.Interaction Interact() { scr_Stats.Interaction?firstInteraction = null; KeyValuePair <GameObject, i_Interactable>[] interactables = GetInteractable(); foreach (KeyValuePair <GameObject, i_Interactable> interactable in interactables) { scr_Interactable_Result result = interactable.Value.Interact(this.gameObject, pickup_ObjectType); if (!result.InteractionSuccessfull) { continue; } scr_Stats.Interaction interaction = result.Interaction; if (!firstInteraction.HasValue) { firstInteraction = interaction; } if (result.Dragable != null) { Drag(result.Dragable, interactable.Key); } if (result.PickupObjectType != scr_Stats.ObjectType.None && this.pickup_Object == null && pickup_ObjectType == scr_Stats.ObjectType.None) { pickup_Object = interactable.Key; pickup_ObjectType = result.PickupObjectType; pickup_SomethingInHand = true; animator.Pickup(); waitForAnimationFinished = true; } if (result.Damagable != null) { damage_ObjectToDamage = result.Damagable; switch (interaction) { case scr_Stats.Interaction.ChopTree: damage_DamageStrength = stats.ChopTreeStrength; break; } animator.Attack(); waitForAnimationFinished = true; } } if (!firstInteraction.HasValue && pickup_Object != null) { Vector3 position = scr_Tilemap.Get.GetNextTile(move_LookAtDirection, this.transform.position); if (scr_Tilemap.Get.IsTileFree(position, new Vector3(0.5f, 0.5f, 0.5f))) { pickup_SomethingInHand = false; animator.Pickup(); waitForAnimationFinished = true; } } return(firstInteraction.HasValue ? firstInteraction.Value : scr_Stats.Interaction.None); }