* The object is falling.
| 2237 | * The object is falling. |
| 2238 | */ |
| 2239 | class Falling implements State { |
| 2240 | private _behavior: PlatformerObjectRuntimeBehavior; |
| 2241 | |
| 2242 | constructor(behavior: PlatformerObjectRuntimeBehavior) { |
| 2243 | this._behavior = behavior; |
| 2244 | } |
| 2245 | |
| 2246 | enter(from: State) { |
| 2247 | // Only forbid jumping when starting to fall from a platform, |
| 2248 | // not when falling during a jump. This is because the Jumping |
| 2249 | // state has already set `_canJump` to false and we don't want to reset |
| 2250 | // it again because it could have been set back to `true` to allow |
| 2251 | // for an "air jump". |
| 2252 | // Transition from Falling to Falling state should not happen, |
| 2253 | // but don't change anything if this ever happen. |
| 2254 | if (from !== this._behavior._jumping && from !== this) { |
| 2255 | this._behavior._canJump = false; |
| 2256 | } |
| 2257 | } |
| 2258 | |
| 2259 | leave() {} |
| 2260 | |
| 2261 | beforeUpdatingObstacles(timeDelta: float) {} |
| 2262 | |
| 2263 | checkTransitionBeforeX() {} |
| 2264 | |
| 2265 | beforeMovingX() {} |
| 2266 | |
| 2267 | checkTransitionBeforeY(timeDelta: float) { |
| 2268 | const behavior = this._behavior; |
| 2269 | // Go on a ladder |
| 2270 | behavior._checkTransitionOnLadder(); |
| 2271 | // Jumping |
| 2272 | behavior._checkTransitionJumping(); |
| 2273 | |
| 2274 | // Grabbing a platform |
| 2275 | if ( |
| 2276 | behavior._canGrabPlatforms && |
| 2277 | (behavior._requestedDeltaX !== 0 || behavior._canGrabWithoutMoving) |
| 2278 | ) { |
| 2279 | behavior._checkGrabPlatform(); |
| 2280 | } |
| 2281 | } |
| 2282 | |
| 2283 | beforeMovingY(timeDelta: float, oldX: float) { |
| 2284 | //Fall |
| 2285 | this._behavior._fall(timeDelta); |
| 2286 | } |
| 2287 | |
| 2288 | getNetworkSyncData(): FallingStateNetworkSyncData { |
| 2289 | return {}; |
| 2290 | } |
| 2291 | |
| 2292 | updateFromNetworkSyncData(data: FallingStateNetworkSyncData) {} |
| 2293 | |
| 2294 | toString(): String { |
| 2295 | return 'Falling'; |
| 2296 | } |
nothing calls this directly
no outgoing calls
no test coverage detected