-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start implementing timeline editor for sprite...
- Loading branch information
1 parent
aab51bb
commit cd4e615
Showing
13 changed files
with
146 additions
and
21 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,8 @@ | ||
using Bang.Components; | ||
|
||
namespace Murder.Editor.Components | ||
{ | ||
internal readonly struct CustomTimeComponent : IComponent | ||
{ | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Bang.Components; | ||
using Murder.Attributes; | ||
using Murder.Editor.Utilities; | ||
using Murder.Utilities.Attributes; | ||
|
||
namespace Murder.Editor.Components | ||
{ | ||
[RuntimeOnly] | ||
[DoNotPersistOnSave] | ||
internal class TimelineEditorComponent : IComponent | ||
{ | ||
public readonly TimelineEditorHook Hook = new(); | ||
|
||
public TimelineEditorComponent() { } | ||
|
||
public void Subscribe(Action _) { } | ||
|
||
public void Unsubscribe(Action _) { } | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Bang.Contexts; | ||
using Bang.Entities; | ||
using Bang.Systems; | ||
using Murder.Components; | ||
using Murder.Editor.Components; | ||
using Murder.Editor.Utilities; | ||
using Murder.Editor.Utilities.Attributes; | ||
|
||
namespace Murder.Editor.Systems.Editor; | ||
|
||
[SpriteEditor] | ||
[Filter(typeof(EditorComponent))] | ||
internal class TimelineSystem : IUpdateSystem | ||
{ | ||
public void Update(Context context) | ||
{ | ||
if (!context.HasAnyEntity || | ||
context.Entity.TryGetComponent<EditorComponent>() is not EditorComponent component || | ||
component.EditorHook is not TimelineEditorHook hook) | ||
{ | ||
return; | ||
} | ||
|
||
if (context.World.GetEntitiesWith(typeof(SpriteComponent)).FirstOrDefault() is not Entity entity) | ||
{ | ||
return; | ||
} | ||
|
||
SpriteComponent sprite = entity.GetSprite(); | ||
|
||
hook.TimeSinceAnimationStarted = Game.Now - sprite.AnimationStartedTime; | ||
} | ||
} |
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
8 changes: 1 addition & 7 deletions
8
src/Murder.Editor/Utilities/Attributes/DialogueEditorAttribute.cs
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
6 changes: 6 additions & 0 deletions
6
src/Murder.Editor/Utilities/Attributes/SpriteEditorAttribute.cs
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,6 @@ | ||
namespace Murder.Editor.Utilities.Attributes | ||
{ | ||
public class SpriteEditorAttribute : Attribute | ||
{ | ||
} | ||
} |
File renamed without changes.
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,6 @@ | ||
namespace Murder.Editor.Utilities; | ||
|
||
internal class TimelineEditorHook : EditorHook | ||
{ | ||
public float TimeSinceAnimationStarted = 0; | ||
} |
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