feat: ✨ add craftingBench and change Prop to consumables
tags/v0.1.0
| @@ -35,7 +35,7 @@ namespace GameClass.GameObj | |||||
| public override bool IgnoreCollideExecutor(IGameObj targetObj) | public override bool IgnoreCollideExecutor(IGameObj targetObj) | ||||
| { | { | ||||
| if (targetObj == Parent) return true; | if (targetObj == Parent) return true; | ||||
| if (targetObj.Type == GameObjType.Prop || targetObj.Type == GameObjType.Bullet) | |||||
| if (targetObj.Type == GameObjType.Consumables || targetObj.Type == GameObjType.Bullet) | |||||
| return true; | return true; | ||||
| return false; | return false; | ||||
| } | } | ||||
| @@ -257,6 +257,7 @@ namespace GameClass.GameObj | |||||
| try | try | ||||
| { | { | ||||
| maxHp = value; | maxHp = value; | ||||
| if (hp > maxHp) hp = maxHp; | |||||
| } | } | ||||
| finally | finally | ||||
| { | { | ||||
| @@ -286,7 +287,7 @@ namespace GameClass.GameObj | |||||
| { | { | ||||
| if (value > 0) | if (value > 0) | ||||
| { | { | ||||
| hp = value <= MaxHp ? value : MaxHp; | |||||
| hp = value <= maxHp ? value : maxHp; | |||||
| } | } | ||||
| else | else | ||||
| hp = 0; | hp = 0; | ||||
| @@ -302,7 +303,6 @@ namespace GameClass.GameObj | |||||
| /// 尝试减血 | /// 尝试减血 | ||||
| /// </summary> | /// </summary> | ||||
| /// <param name="sub">减血量</param> | /// <param name="sub">减血量</param> | ||||
| /// <returns>减操作是否成功</returns> | |||||
| public int TrySubHp(int sub) | public int TrySubHp(int sub) | ||||
| { | { | ||||
| HPReadWriterLock.EnterWriteLock(); | HPReadWriterLock.EnterWriteLock(); | ||||
| @@ -359,7 +359,6 @@ namespace GameClass.GameObj | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| private double oriVampire = 0; | |||||
| public double OriVampire { get; protected set; } | public double OriVampire { get; protected set; } | ||||
| #endregion | #endregion | ||||
| #region 状态相关的基本属性与方法 | #region 状态相关的基本属性与方法 | ||||
| @@ -597,9 +596,9 @@ namespace GameClass.GameObj | |||||
| } | } | ||||
| #region 道具和buff相关属性、方法 | #region 道具和buff相关属性、方法 | ||||
| private Prop[] propInventory = new Prop[GameData.maxNumOfPropInPropInventory] | |||||
| private Consumables[] propInventory = new Consumables[GameData.maxNumOfPropInPropInventory] | |||||
| {new NullProp(), new NullProp(),new NullProp() }; | {new NullProp(), new NullProp(),new NullProp() }; | ||||
| public Prop[] PropInventory | |||||
| public Consumables[] PropInventory | |||||
| { | { | ||||
| get => propInventory; | get => propInventory; | ||||
| set | set | ||||
| @@ -616,19 +615,19 @@ namespace GameClass.GameObj | |||||
| /// 使用物品栏中的道具 | /// 使用物品栏中的道具 | ||||
| /// </summary> | /// </summary> | ||||
| /// <returns>被使用的道具</returns> | /// <returns>被使用的道具</returns> | ||||
| public Prop UseProp(int indexing) | |||||
| public Consumables UseProp(int indexing) | |||||
| { | { | ||||
| if (indexing < 0 || indexing >= GameData.maxNumOfPropInPropInventory) | if (indexing < 0 || indexing >= GameData.maxNumOfPropInPropInventory) | ||||
| return new NullProp(); | return new NullProp(); | ||||
| lock (gameObjLock) | lock (gameObjLock) | ||||
| { | { | ||||
| Prop prop = propInventory[indexing]; | |||||
| Consumables prop = propInventory[indexing]; | |||||
| PropInventory[indexing] = new NullProp(); | PropInventory[indexing] = new NullProp(); | ||||
| return prop; | return prop; | ||||
| } | } | ||||
| } | } | ||||
| public Prop UseProp(PropType propType) | |||||
| public Consumables UseProp(PropType propType) | |||||
| { | { | ||||
| lock (gameObjLock) | lock (gameObjLock) | ||||
| { | { | ||||
| @@ -638,7 +637,7 @@ namespace GameClass.GameObj | |||||
| { | { | ||||
| if (PropInventory[indexing].GetPropType() != PropType.Null) | if (PropInventory[indexing].GetPropType() != PropType.Null) | ||||
| { | { | ||||
| Prop prop = PropInventory[indexing]; | |||||
| Consumables prop = PropInventory[indexing]; | |||||
| PropInventory[indexing] = new NullProp(); | PropInventory[indexing] = new NullProp(); | ||||
| return prop; | return prop; | ||||
| } | } | ||||
| @@ -649,7 +648,7 @@ namespace GameClass.GameObj | |||||
| { | { | ||||
| if (PropInventory[indexing].GetPropType() == propType) | if (PropInventory[indexing].GetPropType() == propType) | ||||
| { | { | ||||
| Prop prop = PropInventory[indexing]; | |||||
| Consumables prop = PropInventory[indexing]; | |||||
| PropInventory[indexing] = new NullProp(); | PropInventory[indexing] = new NullProp(); | ||||
| return prop; | return prop; | ||||
| } | } | ||||
| @@ -788,7 +787,7 @@ namespace GameClass.GameObj | |||||
| { | { | ||||
| if (IsRemoved) | if (IsRemoved) | ||||
| return true; | return true; | ||||
| if (targetObj.Type == GameObjType.Prop) | |||||
| if (targetObj.Type == GameObjType.Consumables) | |||||
| { | { | ||||
| return true; | return true; | ||||
| } | } | ||||
| @@ -15,8 +15,8 @@ namespace GameClass.GameObj | |||||
| public override bool IsRigid => true; | public override bool IsRigid => true; | ||||
| public override ShapeType Shape => ShapeType.Square; | public override ShapeType Shape => ShapeType.Square; | ||||
| private readonly Prop[] propInChest = new Prop[GameData.maxNumOfPropInChest] { new NullProp(), new NullProp() }; | |||||
| public Prop[] PropInChest => propInChest; | |||||
| private readonly Consumables[] propInChest = new Consumables[GameData.maxNumOfPropInChest] { new NullProp(), new NullProp() }; | |||||
| public Consumables[] PropInChest => propInChest; | |||||
| private int openStartTime = 0; | private int openStartTime = 0; | ||||
| public int OpenStartTime => openStartTime; | public int OpenStartTime => openStartTime; | ||||
| @@ -3,13 +3,13 @@ using Preparation.Utility; | |||||
| namespace GameClass.GameObj | namespace GameClass.GameObj | ||||
| { | { | ||||
| public abstract class Prop : ObjOfCharacter | |||||
| public abstract class Consumables : ObjOfCharacter | |||||
| { | { | ||||
| public override bool IsRigid => true; | public override bool IsRigid => true; | ||||
| public override bool IgnoreCollideExecutor(IGameObj targetObj) | public override bool IgnoreCollideExecutor(IGameObj targetObj) | ||||
| { | { | ||||
| if (targetObj.Type == GameObjType.Prop || targetObj.Type == GameObjType.Bullet | |||||
| if (targetObj.Type == GameObjType.Consumables || targetObj.Type == GameObjType.Bullet | |||||
| || targetObj.Type == GameObjType.Character || targetObj.Type == GameObjType.Chest) | || targetObj.Type == GameObjType.Character || targetObj.Type == GameObjType.Chest) | ||||
| return true; | return true; | ||||
| return false; | return false; | ||||
| @@ -19,8 +19,8 @@ namespace GameClass.GameObj | |||||
| public abstract PropType GetPropType(); | public abstract PropType GetPropType(); | ||||
| public Prop(XY initPos, int radius = GameData.PropRadius) : | |||||
| base(initPos, radius, GameObjType.Prop) | |||||
| public Consumables(XY initPos, int radius = GameData.PropRadius) : | |||||
| base(initPos, radius, GameObjType.Consumables) | |||||
| { | { | ||||
| this.canMove = false; | this.canMove = false; | ||||
| this.MoveSpeed = GameData.PropMoveSpeed; | this.MoveSpeed = GameData.PropMoveSpeed; | ||||
| @@ -31,32 +31,16 @@ namespace GameClass.GameObj | |||||
| ///// <summary> | ///// <summary> | ||||
| ///// 坑人地雷 | ///// 坑人地雷 | ||||
| ///// </summary> | ///// </summary> | ||||
| // public abstract class DebuffMine : Prop | |||||
| // public abstract class DebuffMine : Consumables | |||||
| //{ | //{ | ||||
| // public DebuffMine(XYPosition initPos) : base(initPos) { } | // public DebuffMine(XYPosition initPos) : base(initPos) { } | ||||
| // } | // } | ||||
| public sealed class CraftingBench : Prop | |||||
| { | |||||
| public override bool IsRigid => true; | |||||
| public override bool IgnoreCollideExecutor(IGameObj targetObj) => false; | |||||
| public CraftingBench(XY initPos) : | |||||
| base(initPos) | |||||
| { | |||||
| } | |||||
| public override PropType GetPropType() => PropType.CraftingBench; | |||||
| } | |||||
| public abstract class BuffProp : Prop | |||||
| { | |||||
| public BuffProp(XY initPos) : base(initPos) { } | |||||
| } | |||||
| #region 所有增益道具 | #region 所有增益道具 | ||||
| /// <summary> | /// <summary> | ||||
| /// 增加速度 | /// 增加速度 | ||||
| /// </summary> | /// </summary> | ||||
| public sealed class AddSpeed : BuffProp | |||||
| public sealed class AddSpeed : Consumables | |||||
| { | { | ||||
| public AddSpeed(XY initPos) : | public AddSpeed(XY initPos) : | ||||
| base(initPos) | base(initPos) | ||||
| @@ -68,7 +52,7 @@ namespace GameClass.GameObj | |||||
| /// <summary> | /// <summary> | ||||
| /// 复活甲 | /// 复活甲 | ||||
| /// </summary> | /// </summary> | ||||
| public sealed class AddLifeOrClairaudience : BuffProp | |||||
| public sealed class AddLifeOrClairaudience : Consumables | |||||
| { | { | ||||
| public AddLifeOrClairaudience(XY initPos) : | public AddLifeOrClairaudience(XY initPos) : | ||||
| base(initPos) | base(initPos) | ||||
| @@ -76,7 +60,7 @@ namespace GameClass.GameObj | |||||
| } | } | ||||
| public override PropType GetPropType() => PropType.AddLifeOrClairaudience; | public override PropType GetPropType() => PropType.AddLifeOrClairaudience; | ||||
| } | } | ||||
| public sealed class AddHpOrAp : BuffProp | |||||
| public sealed class AddHpOrAp : Consumables | |||||
| { | { | ||||
| public AddHpOrAp(XY initPos) : | public AddHpOrAp(XY initPos) : | ||||
| base(initPos) | base(initPos) | ||||
| @@ -84,7 +68,7 @@ namespace GameClass.GameObj | |||||
| } | } | ||||
| public override PropType GetPropType() => PropType.AddHpOrAp; | public override PropType GetPropType() => PropType.AddHpOrAp; | ||||
| } | } | ||||
| public sealed class RecoveryFromDizziness : BuffProp | |||||
| public sealed class RecoveryFromDizziness : Consumables | |||||
| { | { | ||||
| public RecoveryFromDizziness(XY initPos) : | public RecoveryFromDizziness(XY initPos) : | ||||
| base(initPos) | base(initPos) | ||||
| @@ -95,35 +79,35 @@ namespace GameClass.GameObj | |||||
| /// <summary> | /// <summary> | ||||
| /// 矛盾 | /// 矛盾 | ||||
| /// </summary> | /// </summary> | ||||
| public sealed class ShieldOrSpear : BuffProp | |||||
| public sealed class ShieldOrSpear : Consumables | |||||
| { | { | ||||
| public ShieldOrSpear(XY initPos) : base(initPos) | public ShieldOrSpear(XY initPos) : base(initPos) | ||||
| { | { | ||||
| } | } | ||||
| public override PropType GetPropType() => PropType.ShieldOrSpear; | public override PropType GetPropType() => PropType.ShieldOrSpear; | ||||
| } | } | ||||
| public sealed class Key3 : BuffProp | |||||
| public sealed class Key3 : Consumables | |||||
| { | { | ||||
| public Key3(XY initPos) : base(initPos) | public Key3(XY initPos) : base(initPos) | ||||
| { | { | ||||
| } | } | ||||
| public override PropType GetPropType() => PropType.Key3; | public override PropType GetPropType() => PropType.Key3; | ||||
| } | } | ||||
| public sealed class Key5 : BuffProp | |||||
| public sealed class Key5 : Consumables | |||||
| { | { | ||||
| public Key5(XY initPos) : base(initPos) | public Key5(XY initPos) : base(initPos) | ||||
| { | { | ||||
| } | } | ||||
| public override PropType GetPropType() => PropType.Key5; | public override PropType GetPropType() => PropType.Key5; | ||||
| } | } | ||||
| public sealed class Key6 : BuffProp | |||||
| public sealed class Key6 : Consumables | |||||
| { | { | ||||
| public Key6(XY initPos) : base(initPos) | public Key6(XY initPos) : base(initPos) | ||||
| { | { | ||||
| } | } | ||||
| public override PropType GetPropType() => PropType.Key6; | public override PropType GetPropType() => PropType.Key6; | ||||
| } | } | ||||
| public sealed class NullProp : Prop | |||||
| public sealed class NullProp : Consumables | |||||
| { | { | ||||
| public NullProp() : base(new XY(1, 1)) | public NullProp() : base(new XY(1, 1)) | ||||
| { | { | ||||
| @@ -159,12 +143,10 @@ namespace GameClass.GameObj | |||||
| // #endregion | // #endregion | ||||
| public static class PropFactory | public static class PropFactory | ||||
| { | { | ||||
| public static Prop GetProp(PropType propType, XY pos) | |||||
| public static Consumables GetConsumables(PropType propType, XY pos) | |||||
| { | { | ||||
| switch (propType) | switch (propType) | ||||
| { | { | ||||
| case PropType.CraftingBench: | |||||
| return new CraftingBench(pos); | |||||
| case PropType.AddSpeed: | case PropType.AddSpeed: | ||||
| return new AddSpeed(pos); | return new AddSpeed(pos); | ||||
| case PropType.AddLifeOrClairaudience: | case PropType.AddLifeOrClairaudience: | ||||
| @@ -3,17 +3,18 @@ using System; | |||||
| namespace GameClass.GameObj | namespace GameClass.GameObj | ||||
| { | { | ||||
| // 为方便界面组做道具拾起特效,现引入“被捡起的道具”,在每帧发送给界面组 | // 为方便界面组做道具拾起特效,现引入“被捡起的道具”,在每帧发送给界面组 | ||||
| public class PickedProp : Immovable | |||||
| /* | |||||
| public class Prop : Immovable | |||||
| { | { | ||||
| public override ShapeType Shape => ShapeType.Circle; | public override ShapeType Shape => ShapeType.Circle; | ||||
| public override bool IsRigid => false; | public override bool IsRigid => false; | ||||
| public long MappingID { get; } | public long MappingID { get; } | ||||
| public readonly Prop propHasPicked; | |||||
| public PickedProp(Prop prop) : | |||||
| base(prop.Position, prop.Radius, GameObjType.PickedProp) | |||||
| public readonly Consumables propHasPicked; | |||||
| public Prop(Consumables prop) : | |||||
| base(prop.Position, prop.Radius, GameObjType.Prop) | |||||
| { | { | ||||
| this.propHasPicked = prop; | this.propHasPicked = prop; | ||||
| this.MappingID = prop.ID; | this.MappingID = prop.ID; | ||||
| } | } | ||||
| } | |||||
| }*/ | |||||
| } | } | ||||
| @@ -0,0 +1,68 @@ | |||||
| using Preparation.Interface; | |||||
| using Preparation.Utility; | |||||
| namespace GameClass.GameObj | |||||
| { | |||||
| public abstract class Prop : ObjOfCharacter | |||||
| { | |||||
| public override bool IsRigid => true; | |||||
| public override bool IgnoreCollideExecutor(IGameObj targetObj) => false; | |||||
| public override ShapeType Shape => ShapeType.Square; | |||||
| public abstract PropType GetPropType(); | |||||
| public Prop(XY initPos, int radius = GameData.PropRadius) : | |||||
| base(initPos, radius, GameObjType.Prop) | |||||
| { | |||||
| this.canMove = false; | |||||
| this.MoveSpeed = GameData.PropMoveSpeed; | |||||
| } | |||||
| } | |||||
| ///// <summary> | |||||
| ///// 坑人地雷 | |||||
| ///// </summary> | |||||
| // public abstract class DebuffMine : Consumables | |||||
| //{ | |||||
| // public DebuffMine(XYPosition initPos) : base(initPos) { } | |||||
| // } | |||||
| public sealed class CraftingBench : Prop | |||||
| { | |||||
| public CraftingBench(XY initPos) : | |||||
| base(initPos) | |||||
| { | |||||
| } | |||||
| public override PropType GetPropType() => PropType.CraftingBench; | |||||
| } | |||||
| // #region 所有坑人地雷 | |||||
| ///// <summary> | |||||
| ///// 减速 | |||||
| ///// </summary> | |||||
| // public sealed class MinusSpeed : DebuffMine | |||||
| //{ | |||||
| // public MinusSpeed(XYPosition initPos) : base(initPos) { } | |||||
| // public override PropType GetPropType() => PropType.minusSpeed; | |||||
| // } | |||||
| ///// <summary> | |||||
| ///// 减少攻击力 | |||||
| ///// </summary> | |||||
| // public sealed class MinusAP : DebuffMine | |||||
| //{ | |||||
| // public MinusAP(XYPosition initPos) : base(initPos) { } | |||||
| // public override PropType GetPropType() => PropType.minusAP; | |||||
| // } | |||||
| ///// <summary> | |||||
| ///// 增加冷却 | |||||
| ///// </summary> | |||||
| // public sealed class AddCD : DebuffMine | |||||
| //{ | |||||
| // public AddCD(XYPosition initPos) : base(initPos) { } | |||||
| // public override PropType GetPropType() => PropType.addCD; | |||||
| // } | |||||
| // #endregion | |||||
| } | |||||
| @@ -303,7 +303,7 @@ namespace Gaming | |||||
| player.SetPlayerStateNaturally(); | player.SetPlayerStateNaturally(); | ||||
| for (int i = 0; i < GameData.maxNumOfPropInChest; ++i) | for (int i = 0; i < GameData.maxNumOfPropInChest; ++i) | ||||
| { | { | ||||
| Prop prop = chestToOpen.PropInChest[i]; | |||||
| Consumables prop = chestToOpen.PropInChest[i]; | |||||
| chestToOpen.PropInChest[i] = new NullProp(); | chestToOpen.PropInChest[i] = new NullProp(); | ||||
| prop.ReSetPos(player.Position); | prop.ReSetPos(player.Position); | ||||
| gameMap.Add(prop); | gameMap.Add(prop); | ||||
| @@ -395,7 +395,7 @@ namespace Gaming | |||||
| Door? doorToLock = (Door?)gameMap.OneForInteract(player.Position, GameObjType.Door); | Door? doorToLock = (Door?)gameMap.OneForInteract(player.Position, GameObjType.Door); | ||||
| if (doorToLock == null) return false; | if (doorToLock == null) return false; | ||||
| bool flag = false; | bool flag = false; | ||||
| foreach (Prop prop in player.PropInventory) | |||||
| foreach (Consumables prop in player.PropInventory) | |||||
| { | { | ||||
| switch (prop.GetPropType()) | switch (prop.GetPropType()) | ||||
| { | { | ||||
| @@ -370,7 +370,7 @@ namespace Gaming | |||||
| for (int i = 0; i < GameData.maxNumOfPropInPropInventory; i++) | for (int i = 0; i < GameData.maxNumOfPropInPropInventory; i++) | ||||
| { | { | ||||
| Prop? prop = player.UseProp(i); | |||||
| Consumables? prop = player.UseProp(i); | |||||
| if (prop != null) | if (prop != null) | ||||
| { | { | ||||
| prop.ReSetPos(player.Position); | prop.ReSetPos(player.Position); | ||||
| @@ -23,7 +23,7 @@ namespace Gaming | |||||
| { | { | ||||
| if (player.IsRemoved || player.CharacterType == CharacterType.Robot) | if (player.IsRemoved || player.CharacterType == CharacterType.Robot) | ||||
| return; | return; | ||||
| Prop prop = player.UseProp(propType); | |||||
| Consumables prop = player.UseProp(propType); | |||||
| switch (prop.GetPropType()) | switch (prop.GetPropType()) | ||||
| { | { | ||||
| case PropType.ShieldOrSpear: | case PropType.ShieldOrSpear: | ||||
| @@ -79,17 +79,17 @@ namespace Gaming | |||||
| if (indexing == GameData.maxNumOfPropInPropInventory) | if (indexing == GameData.maxNumOfPropInPropInventory) | ||||
| return false; | return false; | ||||
| Prop pickProp = new NullProp(); | |||||
| Consumables pickProp = new NullProp(); | |||||
| if (propType == PropType.Null) // 自动检查有无道具可捡 | if (propType == PropType.Null) // 自动检查有无道具可捡 | ||||
| { | { | ||||
| pickProp = player.PropInventory[indexing] = ((Prop?)gameMap.OneInTheSameCell(player.Position, GameObjType.Prop)) ?? new NullProp(); | |||||
| pickProp = player.PropInventory[indexing] = ((Consumables?)gameMap.OneInTheSameCell(player.Position, GameObjType.Consumables)) ?? new NullProp(); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| gameMap.GameObjLockDict[GameObjType.Prop].EnterReadLock(); | |||||
| gameMap.GameObjLockDict[GameObjType.Consumables].EnterReadLock(); | |||||
| try | try | ||||
| { | { | ||||
| foreach (Prop prop in gameMap.GameObjDict[GameObjType.Prop]) | |||||
| foreach (Consumables prop in gameMap.GameObjDict[GameObjType.Consumables]) | |||||
| { | { | ||||
| if (prop.GetPropType() == propType) | if (prop.GetPropType() == propType) | ||||
| { | { | ||||
| @@ -102,14 +102,14 @@ namespace Gaming | |||||
| } | } | ||||
| finally | finally | ||||
| { | { | ||||
| gameMap.GameObjLockDict[GameObjType.Prop].ExitReadLock(); | |||||
| gameMap.GameObjLockDict[GameObjType.Consumables].ExitReadLock(); | |||||
| } | } | ||||
| } | } | ||||
| if (pickProp.GetPropType() != PropType.Null) | if (pickProp.GetPropType() != PropType.Null) | ||||
| { | { | ||||
| gameMap.Remove(pickProp); | gameMap.Remove(pickProp); | ||||
| gameMap.Add(new PickedProp(pickProp)); | |||||
| //gameMap.Add(new Prop(pickProp)); | |||||
| return true; | return true; | ||||
| } | } | ||||
| else | else | ||||
| @@ -120,7 +120,7 @@ namespace Gaming | |||||
| { | { | ||||
| if (!gameMap.Timer.IsGaming || player.IsRemoved) | if (!gameMap.Timer.IsGaming || player.IsRemoved) | ||||
| return; | return; | ||||
| Prop prop = player.UseProp(propType); | |||||
| Consumables prop = player.UseProp(propType); | |||||
| if (prop.GetPropType() == PropType.Null) | if (prop.GetPropType() == PropType.Null) | ||||
| return; | return; | ||||
| @@ -128,9 +128,9 @@ namespace Gaming | |||||
| gameMap.Add(prop); | gameMap.Add(prop); | ||||
| } | } | ||||
| private static Prop ProduceOnePropNotKey(Random r, XY Pos) | |||||
| private static Consumables ProduceOnePropNotKey(Random r, XY Pos) | |||||
| { | { | ||||
| return PropFactory.GetProp((PropType)r.Next(GameData.numOfTeachingBuilding + 1, GameData.numOfPropSpecies + 1), Pos); | |||||
| return PropFactory.GetConsumables((PropType)r.Next(GameData.numOfTeachingBuilding + 1, GameData.numOfPropSpecies + 1), Pos); | |||||
| } | } | ||||
| private Chest GetChest(Random r) | private Chest GetChest(Random r) | ||||
| @@ -30,8 +30,8 @@ namespace Preparation.Utility | |||||
| { | { | ||||
| Null = 0, | Null = 0, | ||||
| Character = 1, | Character = 1, | ||||
| Prop = 2, | |||||
| PickedProp = 3, | |||||
| Consumables = 2, | |||||
| Prop = 3, | |||||
| Bullet = 4, | Bullet = 4, | ||||
| BombedBullet = 5, | BombedBullet = 5, | ||||
| @@ -45,8 +45,8 @@ namespace Preparation.Utility | |||||
| { | { | ||||
| return gameObjType != GameObjType.Null && gameObjType != GameObjType.Grass | return gameObjType != GameObjType.Null && gameObjType != GameObjType.Grass | ||||
| && gameObjType != GameObjType.OutOfBoundBlock && gameObjType != GameObjType.Window | && gameObjType != GameObjType.OutOfBoundBlock && gameObjType != GameObjType.Window | ||||
| && gameObjType != GameObjType.Bullet&&gameObjType != GameObjType.Prop | |||||
| &&gameObjType != GameObjType.PickedProp&&gameObjType != GameObjType.BombedBullet | |||||
| && gameObjType != GameObjType.Bullet&&gameObjType != GameObjType.Consumables | |||||
| &&gameObjType != GameObjType.Prop&&gameObjType != GameObjType.BombedBullet | |||||
| &&gameObjType != GameObjType.EmergencyExit&&gameObjType != GameObjType.Doorway; | &&gameObjType != GameObjType.EmergencyExit&&gameObjType != GameObjType.Doorway; | ||||
| }*/ | }*/ | ||||
| @@ -19,12 +19,8 @@ namespace Server | |||||
| else return Student((Student)character); | else return Student((Student)character); | ||||
| case Preparation.Utility.GameObjType.Bullet: | case Preparation.Utility.GameObjType.Bullet: | ||||
| return Bullet((Bullet)gameObj); | return Bullet((Bullet)gameObj); | ||||
| case Preparation.Utility.GameObjType.Prop: | |||||
| return Prop((Prop)gameObj); | |||||
| case Preparation.Utility.GameObjType.BombedBullet: | case Preparation.Utility.GameObjType.BombedBullet: | ||||
| return BombedBullet((BombedBullet)gameObj); | return BombedBullet((BombedBullet)gameObj); | ||||
| case Preparation.Utility.GameObjType.PickedProp: | |||||
| return PickedProp((PickedProp)gameObj); | |||||
| case Preparation.Utility.GameObjType.Generator: | case Preparation.Utility.GameObjType.Generator: | ||||
| return Classroom((Generator)gameObj); | return Classroom((Generator)gameObj); | ||||
| case Preparation.Utility.GameObjType.Chest: | case Preparation.Utility.GameObjType.Chest: | ||||
| @@ -37,6 +33,10 @@ namespace Server | |||||
| else return null; | else return null; | ||||
| case Preparation.Utility.GameObjType.Door: | case Preparation.Utility.GameObjType.Door: | ||||
| return Door((Door)gameObj); | return Door((Door)gameObj); | ||||
| case GameObjType.Prop: | |||||
| return Prop((Prop)gameObj); | |||||
| case Preparation.Utility.GameObjType.Consumables: | |||||
| return Prop((Consumables)gameObj); | |||||
| default: return null; | default: return null; | ||||
| } | } | ||||
| } | } | ||||
| @@ -157,6 +157,22 @@ namespace Server | |||||
| return msg; | return msg; | ||||
| } | } | ||||
| private static MessageOfObj Prop(Consumables prop) | |||||
| { | |||||
| MessageOfObj msg = new() | |||||
| { | |||||
| PropMessage = new() | |||||
| { | |||||
| Type = Transformation.ToPropType(prop.GetPropType()), | |||||
| X = prop.Position.x, | |||||
| Y = prop.Position.y, | |||||
| FacingDirection = prop.FacingDirection.Angle(), | |||||
| Guid = prop.ID | |||||
| } | |||||
| }; | |||||
| return msg; | |||||
| } | |||||
| private static MessageOfObj Prop(Prop prop) | private static MessageOfObj Prop(Prop prop) | ||||
| { | { | ||||
| MessageOfObj msg = new() | MessageOfObj msg = new() | ||||
| @@ -191,18 +207,6 @@ namespace Server | |||||
| return msg; | return msg; | ||||
| } | } | ||||
| private static MessageOfObj PickedProp(PickedProp pickedProp) | |||||
| { | |||||
| MessageOfObj msg = new MessageOfObj(); // MessageOfObj中没有PickedProp | |||||
| /*msg.MessageOfPickedProp = new MessageOfPickedProp(); | |||||
| msg.MessageOfPickedProp.MappingID = pickedProp.MappingID; | |||||
| msg.MessageOfPickedProp.X = pickedProp.PropHasPicked.Position.x; | |||||
| msg.MessageOfPickedProp.Y = pickedProp.PropHasPicked.Position.y; | |||||
| msg.MessageOfPickedProp.FacingDirection = pickedProp.PropHasPicked.FacingDirection;*/ | |||||
| return msg; | |||||
| } | |||||
| private static MessageOfObj Classroom(Generator generator) | private static MessageOfObj Classroom(Generator generator) | ||||
| { | { | ||||
| MessageOfObj msg = new() | MessageOfObj msg = new() | ||||