Skip to content

Commit c922611

Browse files
committed
Redesign PollParams, allow hitting other entities if SamePath
1 parent a9805fa commit c922611

File tree

2 files changed

+345
-318
lines changed

2 files changed

+345
-318
lines changed

CloneDash/Game/Input/PollResult.cs

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,63 @@
11
using Nucleus;
22

3-
namespace CloneDash.Game.Input
3+
namespace CloneDash.Game.Input;
4+
5+
6+
public struct PollParams {
7+
public int AmountOfTimesHit;
8+
public int HitsRemaining;
9+
public PathwaySide Pathway;
10+
}
11+
12+
public struct PollResult
413
{
5-
public struct PollResult
6-
{
7-
public bool Hit;
8-
public DashModelEntity HitEntity;
9-
public double DistanceToHit;
10-
public string Greatness;
11-
12-
public static readonly PollResult Empty = new PollResult() { Hit = false };
13-
14-
public static PollResult Create(DashModelEntity hitEntity, double distanceToHit, string greatness) {
15-
PollResult result = new PollResult();
16-
result.Hit = true;
17-
result.HitEntity = hitEntity;
18-
result.DistanceToHit = distanceToHit;
19-
result.Greatness = greatness;
20-
21-
return result;
22-
}
14+
/// <summary>
15+
/// Did this input hit something?
16+
/// </summary>
17+
public bool Hit;
18+
/// <summary>
19+
/// What did it hit?
20+
/// </summary>
21+
public DashModelEntity HitEntity;
22+
public double DistanceToHit;
23+
public string Greatness;
24+
25+
/// <summary>
26+
/// If true, the input will not be counted, which in this context means that the input will be polled again
27+
/// </summary>
28+
public bool DoNotCount;
29+
30+
public static readonly PollResult Empty = new PollResult() { Hit = false };
31+
32+
public static PollResult Create(DashModelEntity hitEntity, double distanceToHit, string greatness) {
33+
PollResult result = new PollResult();
34+
result.Hit = true;
35+
result.HitEntity = hitEntity;
36+
result.DistanceToHit = distanceToHit;
37+
result.Greatness = greatness;
38+
39+
return result;
40+
}
2341

24-
public bool IsPerfect {
25-
get {
26-
if (!Hit) return false;
42+
public bool IsPerfect {
43+
get {
44+
if (!Hit) return false;
2745

28-
double distance = DistanceToHit;
29-
double pregreat = -HitEntity.PreGreatRange, postgreat = HitEntity.PostGreatRange;
30-
double preperfect = -HitEntity.PrePerfectRange, postperfect = HitEntity.PostPerfectRange;
46+
double distance = DistanceToHit;
47+
double pregreat = -HitEntity.PreGreatRange, postgreat = HitEntity.PostGreatRange;
48+
double preperfect = -HitEntity.PrePerfectRange, postperfect = HitEntity.PostPerfectRange;
3149

32-
return NMath.InRange(distance, preperfect, postperfect);
33-
}
50+
return NMath.InRange(distance, preperfect, postperfect);
3451
}
35-
public bool IsAtLeastGreat {
36-
get {
37-
if (!Hit) return false;
52+
}
53+
public bool IsAtLeastGreat {
54+
get {
55+
if (!Hit) return false;
3856

39-
double distance = DistanceToHit;
40-
double pregreat = -HitEntity.PreGreatRange, postgreat = HitEntity.PostGreatRange;
57+
double distance = DistanceToHit;
58+
double pregreat = -HitEntity.PreGreatRange, postgreat = HitEntity.PostGreatRange;
4159

42-
return NMath.InRange(distance, pregreat, postgreat);
43-
}
60+
return NMath.InRange(distance, pregreat, postgreat);
4461
}
4562
}
4663
}

0 commit comments

Comments
 (0)