public static Action <Danmaku> Homing(Func <Danmaku, Transform> target) { if (target == null) { throw new ArgumentNullException("target"); } return(delegate(Danmaku danmaku) { Transform trans = target(danmaku); if (trans) { danmaku.Rotation = DanmakuUtil.AngleBetween2D(danmaku.position, trans.position); } }); }
public static IEnumerable Towards(this IEnumerable coroutine, GameObject target, Func <FireData, bool> filter = null) { if (target == null) { throw new ArgumentNullException("target"); } Transform trans = target.transform; return(coroutine.ForEachFireData(delegate(FireData fd) { if (trans) { fd.Rotation = DanmakuUtil.AngleBetween2D(fd.Position, trans.position); } }, filter)); }
public static IEnumerable Towards(this IEnumerable coroutine, Vector2 target, Func <FireData, bool> filter = null) { return(coroutine.ForEachFireData(fd => fd.Rotation = DanmakuUtil.AngleBetween2D(fd.Position, target), filter)); }