Skip to content

Commit 805f4e5

Browse files
Create SetGravityMethod.cs
1 parent f8c4ca1 commit 805f4e5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using SER.ArgumentSystem.Arguments;
2+
using SER.ArgumentSystem.BaseArguments;
3+
using SER.MethodSystem.BaseMethods;
4+
5+
namespace SER.MethodSystem.Methods.PlayerMethods;
6+
7+
public class SetGravityMethod : SynchronousMethod
8+
{
9+
public override string Description => "Changes player gravity.";
10+
11+
public override Argument[] ExpectedArguments { get; } =
12+
[
13+
new PlayersArgument("players"),
14+
new FloatArgument("gravity")
15+
];
16+
17+
public override void Execute()
18+
{
19+
var players = Args.GetPlayers("players");
20+
var gravity = Args.GetFloat("gravity");
21+
22+
players.ForEach(plr => plr.Gravity = new(0, -gravity, 0));
23+
}
24+
}

0 commit comments

Comments
 (0)