Tweening In Entitas
See original GitHub issueIn my EntitasCoverShooter project I tween position of some Entities. NOTE: This project is still incomplete as of August 13, 2016.
When I process the entities which have a PositionComponent, I check a custom useTween property. The result is good. Entities can tween or not tween the position and the system respects it. This solution was inspired by another Entitas sample project. I forget which one 😃 For now, I do all tweens at the same duration of 0.3f, but of course that could be stored in the component too.
As a side note, outside the scope of this post…
- I use the 3rdParty HOTween. I like it 😃
- I use
UnityEngineReplacementUtilityas an an experimental approach to include NOUnityEnginenamespace types in my EntitasComponentsandSystems. Its working well so far. I mention it since its included in the snippet below, but not to generate discussion on it. - My personal approach to Entias is to store data in
Components, the process data inSystems, and to updateGameObjectsonly inControllers. The example below follows that convention.
In the ViewController.cs I do this;
if (!entity.position.useTween)
{
((GameObject)entity.view.gameObject).transform.position = UnityEngineReplacementUtility.Convert(entity.position.position);
}
else
{
((GameObject)entity.view.gameObject).transform.DOMove(UnityEngineReplacementUtility.Convert(entity.position.position), 0.3f);
}
Questions
- What alternative approaches can there be to handle games with entities that sometimes tween and sometimes do not tween?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Tweening In Entitas · Issue #145
When I process the entities which have a PositionComponent , I check a custom useTween property. The result is good. Entities can tween...
Read more >Did you ever embrace ECS? When did it click for you?
For my hobby project, a Secret of Mana style ARPG, using Entitas' ECS has made it a lot easier to manage by breaking...
Read more >CorundumGames.Codegen 0.1.3
Tweening.Plugins.Options; using Entitas; using UnityEngine; // This component is hand-written [Game] public sealed class ...
Read more >C# (CSharp) Entitas Entity.RemoveTween Examples
These are the top rated real world C# (CSharp) examples of Entitas.Entity.RemoveTween extracted from open source projects. You can rate examples to help...
Read more >ECS or Why Should I Bother Making My Game Efficient
Entitas is just a recall to your topic, go full or hybrid. ... I'm looking at 4ms in costs from running tweens on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Okay, thanks for the answer, I will see how I will go about it and keep you guys updated 😃
I would say it is a question of flexibility. By providing abstractions and hiding the state you can implement a very clean way of using the system. However it will push user into certain way of solving the problem. By exposing the state as components you can enable things like complex animation morphing. The developer who knows the animation of the game can write custom systems which can evaluate current animation state and decide how to proceed.