组织代码

master
lightyears 2 years ago
parent f4e4d78758
commit 2b8d7519cc
Signed by: lightyears
GPG Key ID: 98D80DDF26D4F2F9

@ -1,3 +1,5 @@
global using System;
global using System.Collections;
global using System.Collections.Generic;
global using System.Linq;
global using Godot;

@ -2,13 +2,17 @@ namespace CMSGame
{
static class TimeHelper
{
/// <summary>获取自引擎启动后经过的时间。</summary>
/// <summary>
/// 获取自引擎启动后经过的时间。
/// </summary>
public static double GetTicks()
{
return Time.GetTicksMsec() / 1000.0;
}
/// <summary>将时间(单位为秒)格式化为字符串“时:分:秒.毫秒”。</summary>
/// <summary>
/// 将时间(单位为秒)格式化为字符串“时:分:秒.毫秒”。
/// </summary>
public static string FormatTime(double time)
{
return TimeSpan.FromSeconds(time).ToString("c");

@ -1,28 +1,26 @@
using System.Collections.Generic;
namespace CMSGame
{
public static class BattleGoals
{
public static readonly BattleGoal Escape = new()
public static readonly Goal<BattleContext> Escape = new()
{
Name = "保命要紧",
BasePriority = -50
};
public static readonly BattleGoal SelfRegulatory = new()
public static readonly Goal<BattleContext> SelfRegulatory = new()
{
Name = "自律行动",
BasePriority = 0
};
public static readonly BattleGoal FollowOrder = new()
public static readonly Goal<BattleContext> FollowOrder = new()
{
Name = "服从指令",
BasePriority = 50
};
public static List<BattleGoal> AllGoals()
public static List<Goal<BattleContext>> AllGoals()
{
return new() {
Escape,

@ -1,5 +1,3 @@
using System.Collections.Generic;
namespace CMSGame
{
public abstract class Action

@ -1,8 +1,6 @@
using System.Collections.Generic;
namespace CMSGame
{
public class Goal<TContext>
public class Goal<TContext> where TContext : IGoalContext
{
public string Name = string.Empty;
@ -23,6 +21,11 @@ namespace CMSGame
}
}
public interface IGoalContext
{
IList<Action> ListActions();
}
public abstract class GoalModifier<TContext>
{
public string Name = string.Empty;

@ -0,0 +1,7 @@
namespace CMSGame
{
public class Plan
{
public readonly List<Action> Actions = new();
}
}

@ -1,10 +1,8 @@
using System.Collections.Generic;
namespace CMSGame
{
public class BattleCharacter
{
public List<BattleGoal> Goals = new();
public List<Goal<BattleContext>> Goals = new();
public Character Character;

@ -0,0 +1,10 @@
namespace CMSGame
{
public class BattleContext : IGoalContext
{
public IList<Action> ListActions()
{
throw new NotImplementedException();
}
}
}
Loading…
Cancel
Save