Пример #1
0
    protected override IEnumerator Run(MainSystem sys)
    {
        sys.Msg_ThrowItem(_item);
        var fitem = FieldItemFactory.CreateFromItem(_item, _player.Loc);

        fitem.OnDiscovered(_player.IsBlind());
        fitem.BringToFront();

        Vector3 src      = _player.Loc.ToPosition();
        Vector3 dst      = _targetLoc.ToPosition();
        float   speed    = _player.Dir.IsDiagonal() ? Config.ItemThrowDiagonalSpeed : Config.ItemThrowSpeed;
        float   duration = Vector3.Distance(src, dst) / speed;

        yield return(CAction.Lerp(duration, src, dst, pos => {
            fitem.Position = pos;
        }));

        fitem.ResetZOrder();

        if (_target == null)   // 床に落とす
        {
            sys.FallItemToFloor(_fallLoc, fitem);
        }
        else   // ターゲットにヒット
               // TODO:ヒット判定
        {
            fitem.Destroy();
            yield return(fitem.Item.Hit(_player, _target, sys));
        }
    }