supervisor-simulator/scripts/Models/StudentModel.cs
2025-12-06 18:54:23 +08:00

64 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
namespace Models;
/// <summary>
/// 学生数据模型 (StudentModel)
/// 包含学生的数值、状态和特质。
/// 与 Godot 的 Node (View) 分离,便于序列化和逻辑处理。
/// </summary>
public class StudentModel: UnitModel
{
public enum StudentType
{
MasterCandidate,
DoctorCandidate
}
// --- 静态属性 (Property) ---
/// <summary>
/// 学生类型
/// </summary>
public StudentType Type { get; private set; }
// --- 动态状态 (Status) ---
/// <summary>
/// 体力 (Stamina)
/// 范围 0-100。工作消耗体力休息恢复。体力过低效率下降。
/// </summary>
public StatusValue Stamina { get; set; }
/// <summary>
/// 忠诚度 (Loyalty)
/// 范围 0-100。过低可能跳槽或举报。
/// </summary>
public StatusValue Loyalty { get; set; }
/// <summary>
/// 年级
/// </summary>
public StatusValue Grade { get; set; }
/// <summary>
/// 记录对每个 Task 的贡献量,用于署名分配
/// </summary>
public Dictionary<Guid, PropertyValue> Contributions { get; set; }
/// <summary>
/// 特质列表 (如 "DDL战士", "卷王")
/// </summary>
public List<string> Traits { get; set; } = [];
public StudentModel(string name) : base(name)
{
var random = new Random();
Stamina = new StatusValue(random.Next(100),100, 0);
Loyalty = new StatusValue(80, 100, 0);
Type = random.Next(2) == 0 ? StudentType.MasterCandidate : StudentType.DoctorCandidate;
Grade = new StatusValue(0, Type == StudentType.DoctorCandidate ? 6 : 3);
}
}