quantum-space-buddies/QSB/Animation/Character/WorldObjects/QSBCharacterAnimController.cs

52 lines
1.2 KiB
C#
Raw Normal View History

2021-04-27 22:49:12 +01:00
using OWML.Utils;
2021-04-26 14:30:21 +01:00
using QSB.Player;
using QSB.WorldSync;
using System.Collections.Generic;
namespace QSB.Animation.Character.WorldObjects
{
2021-04-27 22:49:12 +01:00
internal class QSBCharacterAnimController : WorldObject<CharacterAnimController>
2021-04-26 14:30:21 +01:00
{
private readonly List<PlayerInfo> _playersInHeadZone = new List<PlayerInfo>();
public override void Init(CharacterAnimController controller, int id)
{
ObjectId = id;
AttachedObject = controller;
}
public List<PlayerInfo> GetPlayersInHeadZone()
=> _playersInHeadZone;
public void AddPlayerToHeadZone(PlayerInfo player)
{
if (_playersInHeadZone.Contains(player))
{
return;
}
_playersInHeadZone.Add(player);
}
public void RemovePlayerFromHeadZone(PlayerInfo player)
{
if (!_playersInHeadZone.Contains(player))
{
return;
}
_playersInHeadZone.Remove(player);
}
public void StartConversation()
{
AttachedObject.SetValue("_inConversation", true);
QSBWorldSync.RaiseEvent(AttachedObject, "OnStartConversation");
}
public void EndConversation()
{
AttachedObject.SetValue("_inConversation", false);
QSBWorldSync.RaiseEvent(AttachedObject, "OnEndConversation");
}
}
}