public async Task AddPlayerCatch(Player player, Monster monster) { var playerCatch = new PlayerCatch { PlayerId = player.PlayerId, MonsterId = monster.MonsterId, Level = monster.Level }; _monsterContext.PlayerCatch.Add(playerCatch); await _monsterContext.SaveChangesAsync(); }
private void OnTriggerStay2D(Collider2D other) { if (player.isDropping == false) { return; } var otherPlayer = GetOtherPlayer(other); if (otherPlayer == null) { if (player.IsGrounded == false) { return; } if (other.gameObject.name != "Level") { return; } player.isDropping = false; if (player.GetControlManipulation() != PlayerController.ControlManipulation.Normal) { return; // no penatly if controls messed up } player.stunnedUntil = Time.time + 0.4f * PlayerController.DropStunPeriod; return; } player.isDropping = false; //player.catchableAfter = Time.time + 0.1f; // extra protection against catcher-bug if (otherPlayer.stunnedUntil < Time.time) { otherPlayer.stunnedUntil = Time.time + 1.1f * PlayerController.DropStunPeriod; } // required for unknown reasons, otherwise catcher can stun someone without catching if (player.isCatcher && PlayerCatch.CanBeCaught(otherPlayer, ignoreIsDropping: true)) { otherPlayer.MakeCatcher(player); } }