Anim onPosChange(RlEv.PosChange posChange) { switch (posChange.cause.ev) { case RlEv.Walk walk: var body = walk.entity.get <Body>(); var next = body.pos + walk.dir.vec; var tween = _s.viewUtil.walk(walk.entity, next); var tweenAnim = Anim.tween(tween).setKind(AnimationKind.Parallel); return(tweenAnim); default: posChange.entity.get <CharaView>().forceUpdatePos(); return(null); } }
public IEnumerable <RlEvent> handle(RlEv.PosChange posChange) { if (!this.filter(posChange)) { yield break; } var pos = posChange.to; var entities = base.gameCtx.entitiesAt(pos); var stair = entities.FirstOrDefault(e => e.has <Stair>())?.get <Stair>(); if (stair != null) { if (stair.kind == Stair.Kind.Downstair) { yield return(new RlEv.Stair(RlEv.Stair.Kind.Downstair)); } else { yield return(new RlEv.Stair(RlEv.Stair.Kind.Upstair)); } } }
bool filter(RlEv.PosChange posChange) { return(posChange.entity.has <Player>() && posChange.cause.ev is RlEv.Walk); }
public IEnumerable <RlEvent> handle(RlEv.PosChange posChange) { posChange.entity.get <Body>().setPos(posChange.to); yield break; }