From 8c975d57a112337f94e63082bd32fefd6454669b Mon Sep 17 00:00:00 2001 From: shangfengh <3495281661@qq.com> Date: Sat, 15 Oct 2022 12:02:37 +0800 Subject: [PATCH] add logic/Preparation/GameData --- logic/Preparation/GameData/GameData.cs | 77 ++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 logic/Preparation/GameData/GameData.cs diff --git a/logic/Preparation/GameData/GameData.cs b/logic/Preparation/GameData/GameData.cs new file mode 100644 index 0000000..2d13d58 --- /dev/null +++ b/logic/Preparation/GameData/GameData.cs @@ -0,0 +1,77 @@ +using Preparation.Utility; + +namespace Preparation.GameData +{ + public static class GameData + { +#region 基本常数与常方法 + public const int numOfPosGridPerCell = 1000; // 每格的【坐标单位】数 + public const int numOfStepPerSecond = 20; // 每秒行走的步数 + public const int lengthOfMap = 50000; // 地图长度 + public const int rows = 50; // 行数 + public const int cols = 50; // 列数 + public const long gameDuration = 600000; // 游戏时长600000ms = 10min + public const long frameDuration = 50; // 每帧时长 + + public const int MinSpeed = 1; // 最小速度 + public const int MaxSpeed = int.MaxValue; // 最大速度 + + public static XYPosition GetCellCenterPos(int x, int y) // 求格子的中心坐标 + { + XYPosition ret = new((x * numOfPosGridPerCell) + (numOfPosGridPerCell / 2), (y * numOfPosGridPerCell) + (numOfPosGridPerCell / 2)); + return ret; + } + public static int PosGridToCellX(XYPosition pos) // 求坐标所在的格子的x坐标 + { + return pos.x / numOfPosGridPerCell; + } + public static int PosGridToCellY(XYPosition pos) // 求坐标所在的格子的y坐标 + { + return pos.y / numOfPosGridPerCell; + } + public static bool IsInTheSameCell(XYPosition pos1, XYPosition pos2) + { + return PosGridToCellX(pos1) == PosGridToCellX(pos2) && PosGridToCellY(pos1) == PosGridToCellY(pos2); + } +#endregion +#region 角色相关 + /// + /// 玩家相关 + /// + public const int characterRadius = numOfPosGridPerCell / 2; // 人物半径 + public const int basicAp = 3000; // 初始攻击力 + public const int basicHp = 6000; // 初始血量 + public const int basicCD = 3000; // 初始子弹冷却 + public const int basicBulletNum = 3; // 基本初始子弹量 + public const int MinAP = 0; // 最小攻击力 + public const int MaxAP = int.MaxValue; // 最大攻击力 + public const double basicAttackRange = 9000; // 基本攻击范围 + public const double basicBulletBombRange = 3000; // 基本子弹爆炸范围 + public const int basicMoveSpeed = 3000; // 基本移动速度,单位:s-1 + public const int basicBulletMoveSpeed = 3000; // 基本子弹移动速度,单位:s-1 + public const int characterMaxSpeed = 12000; // 最大速度 + public const int addScoreWhenKillOneLevelPlayer = 30; // 击杀一级角色获得的加分 + public const int commonSkillCD = 30000; // 普通技能标准冷却时间 + public const int commonSkillTime = 10000; // 普通技能标准持续时间 + public const int bulletRadius = 200; // 默认子弹半径 + public const int reviveTime = 30000; // 复活时间 + public const int shieldTimeAtBirth = 3000; // 复活时的护盾时间 + public const int gemToScore = 4; // 一个宝石的标准加分 + /// + /// 道具相关 + /// + public const int MinPropTypeNum = 1; + public const int MaxPropTypeNum = 10; + public const int PropRadius = numOfPosGridPerCell / 2; + public const int PropMoveSpeed = 3000; + public const int PropMaxMoveDistance = 15 * numOfPosGridPerCell; + public const int MaxGemSize = 5; // 随机生成的宝石最大size + public const long GemProduceTime = 10000; + public const long PropProduceTime = 10000; + public const int PropDuration = 10000; +#endregion +#region 游戏帧相关 + public const long checkInterval = 50; // 检查位置标志、补充子弹的帧时长 +#endregion + } +}