Example #1
0
    public override IEnumerator Hit(CharacterBase sender, CharacterBase target, MainSystem sys)
    {
        Assert.IsTrue(target is Enemy);

        // target をsender.Dir 方向にふきとばす
        CharacterBase hitTarget;
        Loc           to = sys.FindHitTarget(target.Loc, sender.Dir, out hitTarget);

        // hitTarget != null なら他の敵と衝突した。TODO:5 ダメージ与える
        yield return(CAction.MoveEnemy((Enemy)target, to));

        // ふきとんだ後の着地点
        Loc loc = to.Backward(sender.Dir);

        target.UpdateLoc(loc);
        // 着地点が水ならワープ
        if (sys.IsWater(loc))
        {
            yield return(new SkillWarp().Use(target, sys));
        }
    }
Example #2
0
    protected override IEnumerator Run(MainSystem sys)
    {
        sys.Msg_UseItem(_item);

        CharacterBase hitTarget;
        Loc           to = sys.FindHitTarget(_player.Loc, _player.Dir, out hitTarget);

        // 魔法弾を飛ばす
        var obj  = Resources.Load("Prefabs/Effect/magic-ball");
        var gobj = (GameObject)GameObject.Instantiate(obj);

        yield return(CAction.Move(gobj, _player.Loc, to));

        GameObject.Destroy(gobj);

        if (hitTarget == null)
        {
            yield return(_item.Hit(_player, to, sys));
        }
        else
        {
            yield return(_item.Hit(_player, hitTarget, sys));
        }
    }