{"action":"created","issue":{"url":"https://api.github.com/repos/sschmid/Entitas-CSharp/issues/145","repository_url":"https://api.github.com/repos/sschmid/Entitas-CSharp","labels_url":"https://api.github.com/repos/sschmid/Entitas-CSharp/issues/145/labels{/name}","comments_url":"https://api.github.com/repos/sschmid/Entitas-CSharp/issues/145/comments","events_url":"https://api.github.com/repos/sschmid/Entitas-CSharp/issues/145/events","html_url":"https://github.com/sschmid/Entitas-CSharp/issues/145","id":171056913,"number":145,"title":"Tweening In Entitas","user":{"login":"srivello","id":172748,"avatar_url":"https://avatars.githubusercontent.com/u/172748?v=3","gravatar_id":"","url":"https://api.github.com/users/srivello","html_url":"https://github.com/srivello","followers_url":"https://api.github.com/users/srivello/followers","following_url":"https://api.github.com/users/srivello/following{/other_user}","gists_url":"https://api.github.com/users/srivello/gists{/gist_id}","starred_url":"https://api.github.com/users/srivello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srivello/subscriptions","organizations_url":"https://api.github.com/users/srivello/orgs","repos_url":"https://api.github.com/users/srivello/repos","events_url":"https://api.github.com/users/srivello/events{/privacy}","received_events_url":"https://api.github.com/users/srivello/received_events","type":"User","site_admin":false},"labels":[{"id":86821495,"url":"https://api.github.com/repos/sschmid/Entitas-CSharp/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-14T12:44:06Z","updated_at":"2016-11-06T10:52:29Z","closed_at":"2016-08-22T23:43:10Z","body":"In my EntitasCoverShooter project I tween position of some Entities. NOTE: This project is still incomplete as of August 13, 2016.\n\nWhen 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.\n\nAs a side note, outside the scope of this post...\n- I use the 3rdParty [HOTween](http://hotween.demigiant.com/). I like it :)\n- I use `UnityEngineReplacementUtility` as an an experimental approach to include NO `UnityEngine` namespace types in my Entitas `Components` and `Systems`. Its working well so far. I mention it since its included in the snippet below, but not to generate discussion on it.\n- My personal approach to Entias is to store data in `Components`, the process data in `Systems`, and to update `GameObjects` only in `Controllers`. The example below follows that convention.\n\nIn the [ViewController.cs](https://github.com/RivelloMultimediaConsulting/EntitasCoverShooter/blob/55100ff54eb8de7aabe3deb2565be273145074dd/unity/Assets/RMC/Common/Scripts/Runtime/Entitas/Controllers/Singletons/ViewController.cs) I do this;\n\n```\nif (!entity.position.useTween)\n{\n    ((GameObject)entity.view.gameObject).transform.position = UnityEngineReplacementUtility.Convert(entity.position.position);\n\n}\nelse\n{\n    ((GameObject)entity.view.gameObject).transform.DOMove(UnityEngineReplacementUtility.Convert(entity.position.position), 0.3f);\n}\n```\n\nQuestions\n1. What alternative approaches can there be to handle games with entities that sometimes tween and sometimes do not tween?\n"},"comment":{"url":"https://api.github.com/repos/sschmid/Entitas-CSharp/issues/comments/258673249","html_url":"https://github.com/sschmid/Entitas-CSharp/issues/145#issuecomment-258673249","issue_url":"https://api.github.com/repos/sschmid/Entitas-CSharp/issues/145","id":258673249,"user":{"login":"kicholen","id":6575038,"avatar_url":"https://avatars.githubusercontent.com/u/6575038?v=3","gravatar_id":"","url":"https://api.github.com/users/kicholen","html_url":"https://github.com/kicholen","followers_url":"https://api.github.com/users/kicholen/followers","following_url":"https://api.github.com/users/kicholen/following{/other_user}","gists_url":"https://api.github.com/users/kicholen/gists{/gist_id}","starred_url":"https://api.github.com/users/kicholen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kicholen/subscriptions","organizations_url":"https://api.github.com/users/kicholen/orgs","repos_url":"https://api.github.com/users/kicholen/repos","events_url":"https://api.github.com/users/kicholen/events{/privacy}","received_events_url":"https://api.github.com/users/kicholen/received_events","type":"User","site_admin":false},"created_at":"2016-11-06T10:52:29Z","updated_at":"2016-11-06T10:52:29Z","body":"I think I'v [implemented](https://github.com/kicholen/SpaceShooter/blob/master/Assets/Source/Src/System/Tween/TweenSystem.cs) sth similar to your idea of TweenClass it's not great, syntax could be much smaller but it gets the job done. The idea was taken from [universalTweenEngine](http://www.aurelienribon.com/blog/projects/universal-tween-engine/), it would be easy to modify accessors in a way that ReacitveSystems would work as well. \r\n`e.AddTween(true, new List<Tween>());\r\n            e.tween.AddTween(e.position, EaseTypes.quadIn, PositionAccessorType.X, timeLimit)\r\n                .From(e.position.pos.x + offset)\r\n                .To(e.position.pos.x)`"}}
{"actor":{"display_login":"kicholen"}}