-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Record usable target movement direction
- Loading branch information
1 parent
52bd286
commit 458a938
Showing
4 changed files
with
22 additions
and
4 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
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 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,22 +1,31 @@ | ||
using Neuro.Recording.Common; | ||
using Vector2 = UnityEngine.Vector2; | ||
|
||
namespace Neuro.Recording.LocalPlayer; | ||
|
||
public partial class UsableData | ||
{ | ||
public static UsableData Create(IUsable usable) | ||
{ | ||
if (usable == null) return new UsableData() { Type = UsableType.NoneUsableType }; | ||
if (usable == null) return new UsableData() {Type = UsableType.NoneUsableType}; | ||
|
||
UsableData data = new() | ||
{ | ||
Type = usable.GetTypeForMessage() | ||
}; | ||
|
||
if (data.Type is not (UsableType.Ladder or UsableType.FlyingPlatform)) return data; | ||
switch (data.Type) | ||
{ | ||
case UsableType.Ladder: | ||
Ladder ladder = usable.Cast<Ladder>(); | ||
data.Direction = ladder.Destination.transform.position.y > ladder.transform.position.y ? Vector2.up : Vector2.down; | ||
break; | ||
|
||
//TODO: Get the target movement direction | ||
case UsableType.FlyingPlatform: | ||
data.Direction = usable.Cast<PlatformConsole>().Platform.IsLeft ? Vector2.right : Vector2.left; | ||
break; | ||
} | ||
|
||
return data; | ||
} | ||
} | ||
} |
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