66 * $Notice: See LICENSE.txt for modification and distribution information
77 * Copyright (c) 2016 by Shen, Jen-Chieh $
88 */
9+ using System ;
910using UnityEngine ;
1011using MyBox ;
1112
@@ -18,13 +19,13 @@ namespace JCSUnity
1819 [ RequireComponent ( typeof ( Rigidbody ) ) ]
1920 public class JCS_Item : JCS_UnityObject
2021 {
21- public delegate void PickedFunction ( Collider other ) ;
22-
2322 /* Variables */
2423
25- public PickedFunction pickedCallback = DefaultPickCallback ;
24+ // Execution after the item is picked.
25+ public Action < Collider > onPicked = null ;
2626
2727 protected bool mCanPick = true ;
28+
2829 protected BoxCollider mBoxCollider = null ;
2930
3031 [ Separator ( "Check Variables (JCS_Item)" ) ]
@@ -188,15 +189,6 @@ public void Pick(Collider other)
188189 }
189190 }
190191
191- /// <summary>
192- /// Default pick up callback.
193- /// </summary>
194- /// <param name="other"></param>
195- public static void DefaultPickCallback ( Collider other )
196- {
197- // do anything after the character pick this item up.
198- }
199-
200192 /// <summary>
201193 /// Do pick up item action.
202194 /// </summary>
@@ -214,7 +206,7 @@ private void DoPick(Collider other)
214206 sp . PlayOneShot ( mPickSound ) ;
215207
216208 // call item effect.
217- pickedCallback . Invoke ( other ) ;
209+ onPicked ? . Invoke ( other ) ;
218210
219211 /* Play Effect Sound */
220212 if ( mPlayOneShotWhileNotPlayingForEffectSound )
0 commit comments