-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add GameObj of Areas - add AreaFactory - adjust the switch-expr of other factories
- Loading branch information
Showing
16 changed files
with
265 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Preparation.Utility; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public static class AreaFactory | ||
{ | ||
public static Immovable GetArea(XY pos, PlaceType placeType) => placeType switch | ||
{ | ||
PlaceType.Home => new Home(pos, GameObjType.Home), | ||
PlaceType.Ruin => new Ruin(pos, GameObjType.Ruin), | ||
PlaceType.Shadow => new Shadow(pos, GameObjType.Shadow), | ||
PlaceType.Asteroid => new Asteroid(pos, GameObjType.Asteroid), | ||
PlaceType.Resource => new Resource(pos, GameObjType.Resource), | ||
PlaceType.Construction => new Construction(pos, GameObjType.Construction), | ||
PlaceType.Wormhole => new Wormhole(pos, GameObjType.Wormhole), | ||
_ => throw new System.NotImplementedException() | ||
}; | ||
public static OutOfBoundBlock GetOutOfBoundBlock(XY pos) => new(pos); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Preparation.Utility; | ||
using System; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class Asteroid : Immovable | ||
{ | ||
public override bool IsRigid => throw new NotImplementedException(); | ||
public override ShapeType Shape => ShapeType.Square; | ||
public Asteroid(XY initPos, GameObjType initType) | ||
: base(initPos, int.MaxValue, initType) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Preparation.Utility; | ||
using System; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class Construction : Immovable | ||
{ | ||
public override bool IsRigid => throw new NotImplementedException(); | ||
public override ShapeType Shape => ShapeType.Square; | ||
public Construction(XY initPos, GameObjType initType) | ||
: base(initPos, int.MaxValue, initType) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using System; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class Home : Immovable, IHome | ||
{ | ||
public AtomicLong TeamID => throw new NotImplementedException(); | ||
public LongWithVariableRange HP => throw new NotImplementedException(); | ||
public long Score => throw new NotImplementedException(); | ||
public override bool IsRigid => throw new NotImplementedException(); | ||
public override ShapeType Shape => ShapeType.Square; | ||
public void AddScore(long add) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
public Home(XY initPos, GameObjType initType) | ||
: base(initPos, int.MaxValue, initType) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
/// <summary> | ||
/// 逻辑墙 | ||
/// </summary> | ||
public class OutOfBoundBlock : Immovable, IOutOfBound | ||
{ | ||
public OutOfBoundBlock(XY initPos) | ||
: base(initPos, int.MaxValue, GameObjType.OutOfBoundBlock) | ||
{ | ||
} | ||
|
||
public override bool IsRigid => true; | ||
public override ShapeType Shape => ShapeType.Square; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Preparation.Utility; | ||
using System; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class Resource : Immovable | ||
{ | ||
public override bool IsRigid => throw new NotImplementedException(); | ||
public override ShapeType Shape => ShapeType.Square; | ||
public Resource(XY initPos, GameObjType initType) | ||
: base(initPos, int.MaxValue, initType) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Preparation.Utility; | ||
using System; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class Ruin : Immovable | ||
{ | ||
public override bool IsRigid => throw new NotImplementedException(); | ||
public override ShapeType Shape => ShapeType.Square; | ||
public Ruin(XY initPos, GameObjType initType) | ||
: base(initPos, int.MaxValue, initType) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Preparation.Utility; | ||
using System; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class Shadow : Immovable | ||
{ | ||
public override bool IsRigid => throw new NotImplementedException(); | ||
public override ShapeType Shape => ShapeType.Square; | ||
public Shadow(XY initPos, GameObjType initType) | ||
: base(initPos, int.MaxValue, initType) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Preparation.Interface; | ||
using Preparation.Utility; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace GameClass.GameObj.Areas; | ||
|
||
public class Wormhole : Immovable, IWormhole | ||
{ | ||
public List<XY> Entrance => throw new NotImplementedException(); | ||
public List<XY> Content => throw new NotImplementedException(); | ||
public override bool IsRigid => throw new NotImplementedException(); | ||
public override ShapeType Shape => ShapeType.Square; | ||
public Wormhole(XY initPos, GameObjType initType) | ||
: base(initPos, int.MaxValue, initType) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
using Preparation.Utility; | ||
|
||
namespace GameClass.GameObj | ||
namespace GameClass.GameObj; | ||
|
||
public abstract class Immovable : GameObj | ||
{ | ||
public abstract class Immovable : GameObj | ||
public override XY Position => position; | ||
public Immovable(XY initPos, int initRadius, GameObjType initType) | ||
: base(initPos, initRadius, initType) | ||
{ | ||
public override XY Position => position; | ||
public Immovable(XY initPos, int initRadius, GameObjType initType) : base(initPos, initRadius, initType) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.