r2mods/ilspy_dump/ror2_csproj/RoR2/FrogController.cs

38 lines
700 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
namespace RoR2;
public class FrogController : MonoBehaviour
{
[SerializeField]
private int maxPets;
[SerializeField]
private PortalSpawner portalSpawner;
[SerializeField]
private PurchaseInteraction purchaseInteraction;
[SerializeField]
private string petChatToken;
private int petCount;
public void Pet(Interactor interactor)
{
petCount++;
if (!string.IsNullOrEmpty(petChatToken))
{
Chat.SendBroadcastChat(new SubjectChatMessage
{
subjectAsCharacterBody = interactor.GetComponent<CharacterBody>(),
baseToken = petChatToken
});
}
if (petCount >= maxPets && (bool)portalSpawner)
{
portalSpawner.AttemptSpawnPortalServer();
}
}
}