Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

chore: partially add character and prop. #12

Merged
merged 7 commits into from
Sep 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions logic/Preparation/Constant.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using Preparation.GameObj;
using Preparation.Utility;

namespace Preparation
{
public static class Constant
{
/// <summary>
/// 基础常数与常方法
/// </summary>
public const int numOfPosGridPerCell = 1000; // 每格的【坐标单位】数
public const int numOfStepPerSecond = 20; // 每秒行走的步数

public static XYPosition GetCellCenterPos(int x, int y) // 求格子的中心坐标
{
XYPosition ret = new XYPosition(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;
}
/// <summary>
/// 玩家相关
/// </summary>
public const int basicAp = 1000; // 初始攻击力
public const int basicHp = 6000; // 初始血量
public const int basicCD = 1000; // 初始冷却
public const int basicBulletNum = 12; // 初始子弹量(如果是射手)
public const int MinAP = 0; // 最小攻击力
public const int MaxAP = int.MaxValue; //最大攻击力
/// <summary>
/// 道具相关
/// </summary>
public const int MinPropTypeNum = 1;
public const int MaxPropTypeNum = 10;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
using Preparation.Interface;

//已弃用:MoveableObj类,包含属性在抽象/具体类实现

/*
using Preparation.Interface;
using Preparation.Utility;

namespace Preparation.GameObj
Expand Down Expand Up @@ -47,3 +51,4 @@ public virtual void Reset() //复活时数据重置
}
}
}
//*/
28 changes: 28 additions & 0 deletions logic/Preparation/GameObj/BirthPoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Preparation.Interface;
using Preparation.Utility;

namespace Preparation.GameObj
{
/// <summary>
/// 出生点
/// </summary>
public class BirthPoint : ObjOfCharacter
{
public BirthPoint(XYPosition initPos, int radius) : base(initPos, radius, PlaceType.Land)
{
this.CanMove = false;
this.Type = GameObjType.BirthPoint;
}
// 修改建议:需要避免非自己的玩家进入出生点,否则会重叠
public override bool IsRigid => true;
protected override bool IgnoreCollideExecutor(IGameObj targetObj)
{
if (targetObj.Type != GameObjType.Character)
return true; // 非玩家不碰撞
else if (targetObj.Type == GameObjType.Character && targetObj.ID == this.Parent.ID)
return true; // 出生点所属的玩家不碰撞
return false;
}
public override ShapeType Shape => ShapeType.Square; // 与THUAI4不同,改成了方形
}
}
Loading