Created
April 20, 2016 15:12
-
-
Save bricklife/e30a7d5de6a7f30b56d0cb6e0db7c5c7 to your computer and use it in GitHub Desktop.
RxSwiftで昇竜拳判定、まずは入力猶予6フレ固定、右+Pの同時押しなし、歩き昇竜なしならこんな感じかな。動作確認どうしよう #CodePiece #rxswift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RxSwift | |
enum 入力: Int { | |
case 左下 = 1, 下, 右下, 左, 右 = 6, 左上, 上, 右上 | |
case パンチ = 0x10 | |
} | |
let 入力川 = PublishSubject<入力>() | |
_ = 入力川 | |
.subscribeNext { print($0) } | |
_ = 入力川 | |
.scan([]) { Array(($0 + [$1]).suffix(4)) } | |
.timeout(7 / 60, scheduler: MainScheduler.instance) | |
.retry() | |
.filter { $0 == [.右, .下, .右下, .パンチ] } | |
.subscribeNext { _ in print("昇竜拳!") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment