Skip to content

Commit b181e0f

Browse files
committed
feat(Modules): ✨ add NullModules
1 parent b4cc258 commit b181e0f

File tree

6 files changed

+64
-18
lines changed

6 files changed

+64
-18
lines changed

logic/GameClass/GameObj/Modules/ModuleFactory.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ public static class ModuleFactory
1212
ProducerType.Producer1 => new CivilProducer1(),
1313
ProducerType.Producer2 => new CivilProducer2(),
1414
ProducerType.Producer3 => new CivilProducer3(),
15-
_ => throw new System.NotImplementedException()
15+
_ => new NullProducer()
1616
},
1717
ShipType.FlagShip => producerType switch
1818
{
1919
ProducerType.Producer1 => new FlagProducer1(),
20-
_ => throw new System.NotImplementedException()
20+
_ => new NullProducer()
2121
},
22-
_ => throw new System.NotImplementedException()
22+
_ => new NullProducer()
2323
};
2424
public static IConstructor FindIConstructor(ShipType shipType, ConstructorType constructorType) => shipType switch
2525
{
@@ -28,67 +28,67 @@ public static class ModuleFactory
2828
ConstructorType.Constructor1 => new CivilConstructor1(),
2929
ConstructorType.Constructor2 => new CivilConstructor2(),
3030
ConstructorType.Constructor3 => new CivilConstructor3(),
31-
_ => throw new System.NotImplementedException()
31+
_ => new NullConstructor()
3232
},
3333
ShipType.FlagShip => constructorType switch
3434
{
3535
ConstructorType.Constructor1 => new FlagConstructor1(),
36-
_ => throw new System.NotImplementedException()
36+
_ => new NullConstructor()
3737
},
38-
_ => throw new System.NotImplementedException()
38+
_ => new NullConstructor()
3939
};
4040
public static IArmor FindIArmor(ShipType shipType, ArmorType armorType) => shipType switch
4141
{
4242
ShipType.CivilShip => armorType switch
4343
{
4444
ArmorType.Armor1 => new CivilArmor1(),
45-
_ => throw new System.NotImplementedException()
45+
_ => new NullArmor()
4646
},
4747
ShipType.WarShip => armorType switch
4848
{
4949
ArmorType.Armor1 => new WarArmor1(),
5050
ArmorType.Armor2 => new WarArmor2(),
5151
ArmorType.Armor3 => new WarArmor3(),
52-
_ => throw new System.NotImplementedException()
52+
_ => new NullArmor()
5353
},
5454
ShipType.FlagShip => armorType switch
5555
{
5656
ArmorType.Armor1 => new FlagArmor1(),
5757
ArmorType.Armor2 => new FlagArmor2(),
5858
ArmorType.Armor3 => new FlagArmor3(),
59-
_ => throw new System.NotImplementedException()
59+
_ => new NullArmor()
6060
},
61-
_ => throw new System.NotImplementedException()
61+
_ => new NullArmor()
6262
};
6363
public static IShield FindIShield(ShipType shipType, ShieldType shieldType) => shipType switch
6464
{
6565
ShipType.CivilShip => shieldType switch
6666
{
6767
ShieldType.Shield1 => new CivilShield1(),
68-
_ => throw new System.NotImplementedException()
68+
_ => new NullShield()
6969
},
7070
ShipType.WarShip => shieldType switch
7171
{
7272
ShieldType.Shield1 => new WarShield1(),
7373
ShieldType.Shield2 => new WarShield2(),
7474
ShieldType.Shield3 => new WarShield3(),
75-
_ => throw new System.NotImplementedException()
75+
_ => new NullShield()
7676
},
7777
ShipType.FlagShip => shieldType switch
7878
{
7979
ShieldType.Shield1 => new FlagShield1(),
8080
ShieldType.Shield2 => new FlagShield2(),
8181
ShieldType.Shield3 => new FlagShield3(),
82-
_ => throw new System.NotImplementedException()
82+
_ => new NullShield()
8383
},
84-
_ => throw new System.NotImplementedException()
84+
_ => new NullShield()
8585
};
8686
public static IWeapon FindIWeapon(ShipType shipType, WeaponType weaponType) => shipType switch
8787
{
8888
ShipType.CivilShip => weaponType switch
8989
{
9090
WeaponType.LaserGun => new CivilLaserGun(),
91-
_ => throw new System.NotImplementedException()
91+
_ => new NullWeapon()
9292
},
9393
ShipType.WarShip => weaponType switch
9494
{
@@ -97,7 +97,7 @@ public static class ModuleFactory
9797
WeaponType.ShellGun => new WarShellGun(),
9898
WeaponType.MissileGun => new WarMissileGun(),
9999
WeaponType.ArcGun => new WarArcGun(),
100-
_ => throw new System.NotImplementedException()
100+
_ => new NullWeapon()
101101
},
102102
ShipType.FlagShip => weaponType switch
103103
{
@@ -106,8 +106,8 @@ public static class ModuleFactory
106106
WeaponType.ShellGun => new FlagShellGun(),
107107
WeaponType.MissileGun => new FlagMissileGun(),
108108
WeaponType.ArcGun => new FlagArcGun(),
109-
_ => throw new System.NotImplementedException()
109+
_ => new NullWeapon()
110110
},
111-
_ => throw new System.NotImplementedException()
111+
_ => new NullWeapon()
112112
};
113113
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Preparation.Interface;
2+
3+
namespace GameClass.GameObj.Modules;
4+
5+
public class NullArmor : IArmor
6+
{
7+
public int ArmorHP => 0;
8+
public int Cost => 0;
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Preparation.Interface;
2+
3+
namespace GameClass.GameObj.Modules;
4+
5+
public class NullConstructor : IConstructor
6+
{
7+
public int ConstructSpeed => 0;
8+
public int Cost => 0;
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Preparation.Interface;
2+
3+
namespace GameClass.GameObj.Modules;
4+
5+
public class NullProducer : IProducer
6+
{
7+
public int ProduceSpeed => 0;
8+
public int Cost => 0;
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using Preparation.Interface;
2+
3+
namespace GameClass.GameObj.Modules;
4+
5+
public class NullShield : IShield
6+
{
7+
public int ShieldHP => 0;
8+
public int Cost => 0;
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using Preparation.Interface;
2+
using Preparation.Utility;
3+
4+
namespace GameClass.GameObj.Modules;
5+
6+
public class NullWeapon : IWeapon
7+
{
8+
public BulletType BulletType => BulletType.Null;
9+
public int Cost => 0;
10+
}

0 commit comments

Comments
 (0)