{"id":21046241,"url":"https://github.com/alfredo1995/dotween","last_synced_at":"2025-03-13T22:22:35.090Z","repository":{"id":192868520,"uuid":"687629992","full_name":"alfredo1995/dotween","owner":"alfredo1995","description":"DOTween is a fast, efficient, fully type-safe object-oriented animation engine.","archived":false,"fork":false,"pushed_at":"2025-01-14T16:58:49.000Z","size":1943,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-23T22:01:43.446Z","etag":null,"topics":["animation","csharp","dotween","unity"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alfredo1995.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-05T17:09:30.000Z","updated_at":"2025-01-14T16:58:52.000Z","dependencies_parsed_at":"2024-12-11T07:31:20.952Z","dependency_job_id":null,"html_url":"https://github.com/alfredo1995/dotween","commit_stats":null,"previous_names":["alfredo1995/collected-coin-anim-dotween","alfredo1995/object-oriented-animation-dotween","alfredo1995/dotween"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfredo1995%2Fdotween","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfredo1995%2Fdotween/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfredo1995%2Fdotween/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alfredo1995%2Fdotween/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alfredo1995","download_url":"https://codeload.github.com/alfredo1995/dotween/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243490115,"owners_count":20299072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["animation","csharp","dotween","unity"],"created_at":"2024-11-19T14:28:38.763Z","updated_at":"2025-03-13T22:22:35.051Z","avatar_url":"https://github.com/alfredo1995.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Collected Item Move to Counter on HUD by DOTween \n  \n\nImport the DOTween library \n\n \t https://assetstore.unity.com/packages/tools/animation/dotween-hotween-v2-27676\n\nPrepare the scene\n\n\t* Create a carvas\n\t* Create 1 empty gameobject \u003e add img component \u003e (FondoScore) representing the background of the score\n\t* Create 1 empty gameobject \u003e add img component \u003e (Score) Attach coin sprite (Score icon) representing the score icon \u003e add text component as well\n\t* Create 1 empty gameobject \u003e add img component \u003e (BotaoPontuacao) Add button \u003e represented by the button \u003e add text component as well\n\n\t* Create 1 empty gameobject \u003e add img component \u003e (StackCoins) Attach coin sprite and present the coins \u003e duplicate \n\t* In duplicate coins, reset the scale of x, y and z and gameObject (PilhaCoedas) that is grouping the coins, disable this component \n\nCollected Item Move to Counter on HUD | Movimentação de item coletado para contador no HUD | DOTween\n\n\t* Nas moedas duplicas, zerar a scala do x, y e z e gameObject (PilhaMoedas) que esta agrupando as moeda, desativar esse componente \n\n\nCriar script para manipular as animações das moedas(gameobjetos)\n\t\n\tusing TMPro;\n\tusing UnityEngine;\n\tusing DG.Tweening;\n\n\n\tpublic class AniCoin: MonoBehaviour\n\t{\n  \t  [SerializeField] private GameObject pilhaMoedas; // Referência ao objeto contendo as moedas empilhadas\n  \t  [SerializeField] private TextMeshProUGUI pontuacao; // Referência ao componente de texto para exibir a pontuação\n\t    [SerializeField] private Vector3[] inicialPos; // Armazena as posições iniciais das moedas\n  \t  [SerializeField] private Quaternion[] inicialRot; // Armazena as rotações iniciais das moedas\n   \t [SerializeField] private int moedasColetaveis; // Quantidade de moedas coletáveis\n\n    public void Start()\n    {\n        // Inicialização das posições e rotações iniciais das moedas\n        inicialPos = new Vector3[moedasColetaveis];\n        inicialRot = new Quaternion[moedasColetaveis];\n\n        // Loop para armazenar as posições e rotações iniciais de cada moeda\n        for (int i = 0; i \u003c pilhaMoedas.transform.childCount; i++)\n        {\n            inicialPos[i] = pilhaMoedas.transform.GetChild(i).position;\n            inicialRot[i] = pilhaMoedas.transform.GetChild(i).rotation;\n        }\n    }\n\n    public void Reset()\n    {\n        // Loop para restaurar as posições e rotações iniciais das moedas\n        for (int i = 0; i \u003c pilhaMoedas.transform.childCount; i++)\n        {\n            pilhaMoedas.transform.GetChild(i).position = inicialPos[i];\n            pilhaMoedas.transform.GetChild(i).rotation = inicialRot[i];\n        }\n    }\n\n    public void Recompensa(int moedasColetaveis)\n    {\n        Reset(); // Restaura as posições e rotações iniciais das moedas\n\n        var delay = 0f; // Inicializa o atraso para a animação das moedas\n\n        pilhaMoedas.SetActive(true); // Ativa o objeto contendo as moedas empilhadas\n\n        // Loop para animar cada moeda individualmente\n        for (int i = 0; i \u003c pilhaMoedas.transform.childCount; i++)\n        {\n            // Animação de escala da moeda\n            pilhaMoedas.transform.GetChild(i).DOScale(endValue: 1f, duration: 0.3f)\n                .SetDelay(delay).SetEase(Ease.OutBack);\n\n            // Animação de posição usando ancoragem\n            pilhaMoedas.transform.GetChild(i).GetComponent\u003cRectTransform\u003e()\n                .DOAnchorPos(endValue: new Vector2(x: 305f, y: 603f), duration: 1f)\n                .SetDelay(delay + 0.5f).SetEase(Ease.OutBack);\n\n            // Outra animação de escala da moeda\n            pilhaMoedas.transform.GetChild(i).DOScale(endValue: 1f, duration: 0.3f)\n                .SetDelay(delay + 1f).SetEase(Ease.OutBack);\n\n            delay += 0.2f; // Incrementa o atraso para a próxima moeda\n\t\n\t    StartCoroutine(routine: ContadorMoedas(moedasColetaveis: 7));\n\t\t\n        }    }   }\n\n\n\n\t          IEnumerator ContadorMoedas(int moedasColetaveis)\n   \t         {\n       \t         yield return new WaitForSecondsRealtime(time: 1f);\n\n       \t         var timer = 0f;\n\n        \t for (int i = 0; i \u003c moedasColetaveis; i++)\n      \t         {\n          \t PlayerPrefs.SetInt(\"moeda\", PlayerPrefs.GetInt(key: \"moeda\") + moedasColetaveis);\n\n       \t         pontuacao.text = PlayerPrefs.GetInt(key: \"moeda\").ToString();\n\n          \t timer += 0.1f;\n\n         \t yield return new WaitForSecondsRealtime(timer);\n                } }\n \n \n \n \n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falfredo1995%2Fdotween","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falfredo1995%2Fdotween","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falfredo1995%2Fdotween/lists"}