Files

47 lines
1.9 KiB
C#
Raw Permalink Normal View History

2022-12-26 03:01:08 +02:00
using UnityEngine;
public class PlayerSimulation : MonoBehaviour
{
2022-12-26 03:47:56 +02:00
[SerializeField] private Player _player = default;
2023-01-18 21:41:03 +02:00
[SerializeField] private InputBuffer _inputBuffer = default;
2022-12-26 03:47:56 +02:00
[SerializeField] private PlayerAnimator _playerAnimator = default;
[SerializeField] private Audio _audio = default;
[SerializeField] private CollisionVisualizer _hurtBoxVisualizer = default;
[SerializeField] private CollisionVisualizer _hitBoxVisualizer = default;
[SerializeField] private CollisionVisualizer _pushBoxVisualizer = default;
2022-12-26 03:01:08 +02:00
2022-12-26 03:47:56 +02:00
public void Simulate(PlayerNetwork playerGs, PlayerConnectionInfo info)
2022-12-26 03:01:08 +02:00
{
2023-01-20 17:59:16 +02:00
if (!string.IsNullOrEmpty(playerGs.soundGroup))
{
2024-01-17 02:14:48 +02:00
_audio.SoundGroup(playerGs.soundGroup).PlayInRandomChance();
2023-01-20 17:59:16 +02:00
playerGs.soundGroup = "";
}
2022-12-26 03:47:56 +02:00
if (!string.IsNullOrEmpty(playerGs.sound))
{
_audio.Sound(playerGs.sound).Play();
playerGs.sound = "";
}
if (!string.IsNullOrEmpty(playerGs.soundStop))
{
_audio.Sound(playerGs.soundStop).Stop();
playerGs.soundStop = "";
}
2023-02-12 17:30:07 +02:00
if (info.state == PlayerConnectState.Disconnected && playerGs.health > 0)
2022-12-30 14:07:58 +02:00
_player.PlayerUI.Disconnected();
2023-01-12 19:12:56 +02:00
_player.Simulate(playerGs, info);
_player.PlayerUI.SetArcana(playerGs.arcanaGauge);
2023-01-16 13:26:54 +02:00
_player.PlayerUI.SetComboTimerLock(playerGs.otherPlayer.comboLocked);
2023-01-23 18:31:58 +02:00
_player.Assist.Simulate(playerGs);
2023-10-26 22:42:28 +03:00
_inputBuffer.UpdateBuffer(playerGs.inputList, playerGs.inputBuffer);
2022-12-26 03:47:56 +02:00
_playerAnimator.SetAnimation(playerGs.animation, playerGs.animationFrames);
2023-01-19 19:06:45 +02:00
_playerAnimator.SetInvinsible(playerGs.invisible);
2022-12-26 03:47:56 +02:00
_playerAnimator.SetSpriteOrder(playerGs.spriteOrder);
_hitBoxVisualizer.ShowBox(playerGs.hitbox);
_hurtBoxVisualizer.ShowBox(playerGs.hurtbox);
2022-12-27 13:12:53 +02:00
_pushBoxVisualizer.ShowBox(playerGs.pushbox);
2022-12-26 03:01:08 +02:00
}
}