139 lines
4.3 KiB
C#
139 lines
4.3 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace IdleSpectator;
|
|
|
|
public enum InterestLeadKind
|
|
{
|
|
EventLed = 0,
|
|
CharacterLed = 1
|
|
}
|
|
|
|
public enum InterestCompletionKind
|
|
{
|
|
/// <summary>One-shot narrative dwell (WorldLog, harness tips).</summary>
|
|
FixedDwell = 0,
|
|
/// <summary>Combat / hunt / fire while participants stay live.</summary>
|
|
CombatActive = 1,
|
|
/// <summary>Owning AI task / beat still live.</summary>
|
|
ActivityActive = 2,
|
|
/// <summary>Grief / family emotion with survivor + optional crying.</summary>
|
|
HappinessGrief = 3,
|
|
/// <summary>Status phase still present on subject.</summary>
|
|
StatusPhase = 4,
|
|
/// <summary>Character vignette until max watch or cold activity.</summary>
|
|
CharacterVignette = 5,
|
|
/// <summary>Harness-forced session; active until released or max cap.</summary>
|
|
Manual = 6
|
|
}
|
|
|
|
/// <summary>
|
|
/// Durable interest scene candidate. Urgency (<see cref="InterestTier"/>) is preemption class only;
|
|
/// <see cref="TotalScore"/> ranks within a class.
|
|
/// </summary>
|
|
public sealed class InterestCandidate
|
|
{
|
|
public string Key = "";
|
|
public InterestTier Urgency = InterestTier.Ambient;
|
|
public InterestLeadKind LeadKind = InterestLeadKind.EventLed;
|
|
public string Category = "";
|
|
public string Source = "";
|
|
public float EventStrength;
|
|
public float CharacterSignificance;
|
|
public float Novelty = 1f;
|
|
public float VisualConfidence = 0.5f;
|
|
public float TotalScore;
|
|
public Vector3 Position;
|
|
public Actor FollowUnit;
|
|
public Actor RelatedUnit;
|
|
public long SubjectId;
|
|
public long RelatedId;
|
|
public string Label = "";
|
|
public string AssetId = "";
|
|
public string SpeciesId = "";
|
|
public string Verb = "";
|
|
public string CityKey = "";
|
|
public string KingdomKey = "";
|
|
public string RegionKey = "";
|
|
public string HappinessEffectId = "";
|
|
public string StatusId = "";
|
|
public string CorrelationKey = "";
|
|
public float CreatedAt;
|
|
public float LastSeenAt;
|
|
public float ExpiresAt;
|
|
public float MinWatch = 1.5f;
|
|
public float MaxWatch = 45f;
|
|
public InterestCompletionKind Completion = InterestCompletionKind.FixedDwell;
|
|
public bool Resumable = true;
|
|
public bool ForceActive;
|
|
public bool Selected;
|
|
public string ScoreDetail = "";
|
|
public readonly List<long> ParticipantIds = new List<long>(4);
|
|
|
|
public bool HasFollowUnit => FollowUnit != null && FollowUnit.isAlive();
|
|
|
|
public bool HasValidPosition =>
|
|
HasFollowUnit || (Position != Vector3.zero && !float.IsNaN(Position.x));
|
|
|
|
public InterestEvent ToInterestEvent()
|
|
{
|
|
return new InterestEvent
|
|
{
|
|
Tier = Urgency,
|
|
Score = TotalScore,
|
|
Position = Position,
|
|
FollowUnit = FollowUnit,
|
|
Label = Label,
|
|
CreatedAt = CreatedAt,
|
|
AssetId = AssetId
|
|
};
|
|
}
|
|
|
|
public InterestCandidate CloneShallow()
|
|
{
|
|
var copy = new InterestCandidate
|
|
{
|
|
Key = Key,
|
|
Urgency = Urgency,
|
|
LeadKind = LeadKind,
|
|
Category = Category,
|
|
Source = Source,
|
|
EventStrength = EventStrength,
|
|
CharacterSignificance = CharacterSignificance,
|
|
Novelty = Novelty,
|
|
VisualConfidence = VisualConfidence,
|
|
TotalScore = TotalScore,
|
|
Position = Position,
|
|
FollowUnit = FollowUnit,
|
|
RelatedUnit = RelatedUnit,
|
|
SubjectId = SubjectId,
|
|
RelatedId = RelatedId,
|
|
Label = Label,
|
|
AssetId = AssetId,
|
|
SpeciesId = SpeciesId,
|
|
Verb = Verb,
|
|
CityKey = CityKey,
|
|
KingdomKey = KingdomKey,
|
|
RegionKey = RegionKey,
|
|
HappinessEffectId = HappinessEffectId,
|
|
StatusId = StatusId,
|
|
CorrelationKey = CorrelationKey,
|
|
CreatedAt = CreatedAt,
|
|
LastSeenAt = LastSeenAt,
|
|
ExpiresAt = ExpiresAt,
|
|
MinWatch = MinWatch,
|
|
MaxWatch = MaxWatch,
|
|
Completion = Completion,
|
|
Resumable = Resumable,
|
|
ForceActive = ForceActive,
|
|
Selected = Selected,
|
|
ScoreDetail = ScoreDetail
|
|
};
|
|
for (int i = 0; i < ParticipantIds.Count; i++)
|
|
{
|
|
copy.ParticipantIds.Add(ParticipantIds[i]);
|
|
}
|
|
|
|
return copy;
|
|
}
|
|
}
|