Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class UsingDelegates : MonoBehaviour
- {
- private List<Unicorn> unicorns = new List<Unicorn>();
- Vector3 playerPosition;
- static Func<Unicorn, Vector3, bool> isCloseTo = (Unicorn unicorn, Vector3 position) => (position - unicorn.transform.position).magnitude > 5f;
- void Update()
- {
- unicorns.ForEach(@if: isCloseTo, then: Unicorn.GiveHug, arg1: playerPosition);
- }
- }
Add Comment
Please, Sign In to add comment