Browse Source

build: 🚧 finish the Map

tags/0.1.0
shangfengh 2 years ago
parent
commit
9d594f2964
6 changed files with 80 additions and 62 deletions
  1. +46
    -0
      logic/GameClass/GameObj/Map/Door.cs
  2. +20
    -0
      logic/GameClass/GameObj/Map/Map.cs
  3. +7
    -36
      logic/GameClass/GameObj/Map/Window.cs
  4. +1
    -19
      logic/Gaming/ActionManager.cs
  5. +4
    -4
      logic/Server/CopyInfo.cs
  6. +2
    -3
      logic/规则Logic.md

+ 46
- 0
logic/GameClass/GameObj/Map/Door.cs View File

@@ -0,0 +1,46 @@
using Preparation.Interface;
using Preparation.Utility;

namespace GameClass.GameObj
{
/// <summary>
/// 门
/// </summary>
public class Door : GameObj
{
public Door(XY initPos, PlaceType placeType) :
base(initPos, GameData.numOfPosGridPerCell / 2, GameObjType.Door)
{
this.place = placeType;
this.CanMove = false;
}
public override bool IsRigid => true;
public override ShapeType Shape => ShapeType.Square;
protected override bool IgnoreCollideExecutor(IGameObj targetObj)
{
return isOpen;
}

private bool isOpen = false;
public bool IsOpen
{
get => isOpen;
set
{
lock (gameObjLock)
isOpen = value;
}
}

private int openOrLockDegree = 0;
public int OpenOrLockDegree
{
get => openOrLockDegree;
set
{
lock (gameObjLock)
openOrLockDegree = (value > 0) ? value : 0;
}
}
}
}

+ 20
- 0
logic/GameClass/GameObj/Map/Map.cs View File

@@ -190,6 +190,26 @@ namespace GameClass.GameObj
Add(new Chest(GameData.GetCellCenterPos(i, j)));
break;
}
case (uint)PlaceType.Door3:
{
Add(new Door(GameData.GetCellCenterPos(i, j), PlaceType.Door3));
break;
}
case (uint)PlaceType.Door5:
{
Add(new Door(GameData.GetCellCenterPos(i, j), PlaceType.Door5));
break;
}
case (uint)PlaceType.Door6:
{
Add(new Door(GameData.GetCellCenterPos(i, j), PlaceType.Door6));
break;
}
case (uint)PlaceType.Window:
{
Add(new Window(GameData.GetCellCenterPos(i, j)));
break;
}
case (uint)PlaceType.BirthPoint1:
case (uint)PlaceType.BirthPoint2:
case (uint)PlaceType.BirthPoint3:


+ 7
- 36
logic/GameClass/GameObj/Map/Window.cs View File

@@ -4,7 +4,7 @@ using Preparation.Utility;
namespace GameClass.GameObj
{
/// <summary>
/// 出口
///
/// </summary>
public class Window : GameObj
{
@@ -18,50 +18,21 @@ namespace GameClass.GameObj
public override ShapeType Shape => ShapeType.Square;
protected override bool IgnoreCollideExecutor(IGameObj targetObj)
{
if (targetObj.Type != GameObjType.Character)
return true; // 非玩家不碰撞
else if (!((Character)targetObj).IsGhost())
return true; // 不是鬼不碰撞
if (targetObj == whoIsClimbing)
return true;
return false;
}

private bool powerSupply = false;
public bool PowerSupply
private Character? whoIsClimbing = null;
public Character? WhoIsClimbing
{
get => powerSupply;
get => whoIsClimbing;
set
{
lock (gameObjLock)
powerSupply = value;
whoIsClimbing = value;
}
}

private bool isOpening = false;
public bool IsOpening
{
get => isOpening;
set
{
lock (gameObjLock)
isOpening = value;
}
}

private int openDegree = 0;
public int OpenDegree
{
get => openDegree;
set
{
if (value > 0)
lock (gameObjLock)
openDegree = (value < GameData.degreeOfOpenedDoorway) ? value : GameData.degreeOfOpenedDoorway;
else
lock (gameObjLock)
openDegree = 0;
}
}

public bool IsOpen() => (OpenDegree == GameData.degreeOfOpenedDoorway);
}
}

+ 1
- 19
logic/Gaming/ActionManager.cs View File

@@ -288,25 +288,7 @@ namespace Gaming
{
if ((!player.Commandable()) || player.PlayerState == PlayerStateType.IsOpeningTheChest)
return false;
Chest? chestToOpen = null;


gameMap.GameObjLockDict[GameObjType.Chest].EnterReadLock();
try
{
foreach (Chest chest in gameMap.GameObjDict[GameObjType.Chest])
{
if (GameData.ApproachToInteract(chest.Position, player.Position))
{
chestToOpen = chest;
break;
}
}
}
finally
{
gameMap.GameObjLockDict[GameObjType.Chest].ExitReadLock();
}
Chest? chestToOpen = (Chest?)gameMap.OneForInteract(player.Position, GameObjType.Chest);

if (chestToOpen == null || chestToOpen.IsOpen)
return false;


+ 4
- 4
logic/Server/CopyInfo.cs View File

@@ -203,8 +203,8 @@ namespace Server
for (int i = 0; i < GameData.maxNumOfSkill - player.TimeUntilActiveSkillAvailable.Count(); ++i)
msg.StudentMessage.TimeUntilSkillAvailable.Add(-1);

foreach (var Value in player.PropInventory)
msg.StudentMessage.Prop.Add(ToPropType(Value.GetPropType()));
foreach (var value in player.PropInventory)
msg.StudentMessage.Prop.Add(ToPropType(value.GetPropType()));

msg.StudentMessage.Place = ToPlaceType(player.Place);
msg.StudentMessage.Guid = player.ID;
@@ -247,8 +247,8 @@ namespace Server
msg.StudentMessage.TimeUntilSkillAvailable.Add(-1);

msg.TrickerMessage.Place = ToPlaceType(player.Place);
foreach (var Value in player.PropInventory)
msg.StudentMessage.Prop.Add(ToPropType(Value.GetPropType()));
foreach (var value in player.PropInventory)
msg.StudentMessage.Prop.Add(ToPropType(value.GetPropType()));

msg.TrickerMessage.TrickerType = ToTrickerType(player.CharacterType);
msg.TrickerMessage.Guid = player.ID;


+ 2
- 3
logic/规则Logic.md View File

@@ -28,7 +28,7 @@
- 只展示外部需要的属性,部分属性被省略

### BgmType
- 枚举类BgmType
- *枚举类BgmType*
1. 不详的感觉:监管者进入(求生者的警戒半径/监管者的隐蔽度)时,求生者收到;监管者距离求生者越近,Bgm音量越大。bgmVolume=(警戒半径/二者距离)
2. 期待搞事的感觉:求生者进入(监管者的警戒半径/求生者的隐蔽度)时,监管者收到;监管者距离求生者越近,Bgm音量越大。bgmVolume=(警戒半径/可被发觉的最近的求生者距离)
3. 修理电机的声音: 监管者警戒半径内有电机正在被修理时收到;bgmVolume=(警戒半径*电机修理程度/二者距离)/10300000
@@ -135,7 +135,7 @@
- 沉迷游戏程度
- 最大沉迷游戏程度
- 被治疗程度
- *(去)救援(别人)程度*
- *被救援程度*

### 搞蛋鬼:人物
@@ -186,7 +186,6 @@
### 箱子:物体
- *是否开启*
- *开箱进度*
- *是否正在被开启*

### 门:物体
- *属于那个教学区*


Loading…
Cancel
Save