/// <summary> Walk animations (made before actually walking) </summary> public ITweenable walk(Entity entity, Vec2i to) { var body = entity.get <Body>(); var from = body.pos; var nextDir = (Dir9)Dir9.fromVec2i(to - from); // FIXME: lazily change facing or outsource it this.changeDir(entity, nextDir); var nextPosWorld = posUtil.gridToWorldCentered(to); var tween = new Tw.Walk(entity.Transform, ViewPreferences.walkDuration, nextPosWorld, ViewPreferences.walkEase); return(tween); }
/// <summary> Updates input mode and maybe creates directional modification for the player controllerd </summary> RlEvent updateModes(VInput input) { this.diaMode.update(input); var result = this.dirMode.update(input); if (result != KeyMode.Switch.TurnOn) { return(null); } if (PlayerControl.findOnlyNeighbor(this.controller.actor, this.gameCtx) is Entity neighbor) { var entity = this.controller.actor; var dir = Dir9.fromVec2i(neighbor.get <Body>().pos - entity.get <Body>().pos); return(RlEv.DirChange.smooth(entity, dir).noConsumeTurn()); } else { return(null); } }