private void HandleSpriteCollisionWhileShell(Sprite sprite, Vector2 resolutionDistance) { if (sprite.IsPlayer) { // If the player's center is to the right (or equal to) our // center, go left Otherwise, go right spriteWalker.Direction = (sprite.Hitbox.Center.X >= Owner.Hitbox.X) ? Direction.Left : Direction.Right; State = ShelledEnemyState.ShellSpinning; ActionScheduler.Instance.CancelScheduledAction(emergeAction); emergeAction = null; } }
private void GoToShell() { State = ShelledEnemyState.Shell; spriteChasePlayer.IsActive = false; emergeAction = ActionScheduler.Instance.ScheduleAction(() => { State = ShelledEnemyState.Emerging; emergeAction = ActionScheduler.Instance.ScheduleActionOnNextFrame(() => { State = ShelledEnemyState.Walking; spriteChasePlayer.IsActive = (Behavior == ShelledEnemyBehavior.ChasePlayer); }, framesFromEmergingToWalking); }, framesFromShellToEmerging); }