public override void Interact(ref GameObject ref_held_obj, ref string original_tag, ref LayerMask original_layer) { if (ref_held_obj != null) // Not holding anything { if (original_tag == "WaterCan") { WateringCan wateringCan = ref_held_obj.GetComponent <WateringCan>(); wateringCan.WaterAmount = 100f; wateringCan.RunParticles(); SoundManager.Instance.PlayWaterCanFill(); } } }
public override void Interact(ref GameObject ref_held_obj, ref string original_tag, ref LayerMask original_layer) { // If the entity interacting with this plant is not holding anything, make it hold this plant if (ref_held_obj == null) // Not already holding an object { GameObject ref_game_obj = this.gameObject; original_tag = ref_game_obj.tag; original_layer = ref_game_obj.layer; ref_game_obj.tag = "Held"; ref_game_obj.layer = LayerMask.NameToLayer("Held"); ref_game_obj.GetComponent <Rigidbody2D>().simulated = false; transform.rotation = Quaternion.identity; ref_held_obj = ref_game_obj; SoundManager.Instance.PlayItemGrabSound(); if (_wateringCan.WaterAmount > 50f) { _wateringCan.RunParticles(); } } }