Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

68 linhas
1.9 KiB

  1. using System;
  2. using CIGEnums;
  3. using SUISS.Core;
  4. using UnityEngine;
  5. namespace CIG
  6. {
  7. public class CurrencyAnimationSource : MonoBehaviour
  8. {
  9. private void Start()
  10. {
  11. SingletonMonobehaviour<CurrencyAnimator>.Instance.RegisterCurrencySource(this);
  12. }
  13. private void OnDestroy()
  14. {
  15. this.Deinit();
  16. if (SingletonMonobehaviour<CurrencyAnimator>.IsAvailable)
  17. {
  18. SingletonMonobehaviour<CurrencyAnimator>.Instance.UnregisterCurrencySource(this);
  19. }
  20. }
  21. public void Init(object animationReference)
  22. {
  23. this.AnimationSource = animationReference;
  24. }
  25. public void Deinit()
  26. {
  27. this.AnimationSource = null;
  28. }
  29. public CurrencyAnimType CurrencyType
  30. {
  31. get
  32. {
  33. return this._currencyType;
  34. }
  35. }
  36. public CurrencyAnimPositionType PositionType
  37. {
  38. get
  39. {
  40. return this._positionType;
  41. }
  42. }
  43. public Vector3 Position
  44. {
  45. get
  46. {
  47. return base.transform.position;
  48. }
  49. }
  50. public object AnimationSource { get; private set; }
  51. [SerializeField]
  52. private CurrencyAnimType _currencyType;
  53. [SerializeField]
  54. [Tooltip("Raw Position uses transform.position and directly uses it to set the flying currency's position.\r\nUse this when the CurrencyAnimationSource is seen by the same camera as the CurrencyAnimator\r\n\r\nScreen Position uses transform.position, converts it through the UI Camera to a World Position which is used to set the flying currency's position.\r\nUse this when the CurrencyAnimationSource's position is originating from a click/drag/pointer event's screen position.\r\n\r\nWorld Position uses transform.position, converts it through the World Camera to a Screen Position to then convert it through the UI Camera to a World Position which is used to set the flying currency's position.\r\nUse this when the CurrencyAnimationSource is seen by the World Camera (e.g. a building).\r\n")]
  55. private CurrencyAnimPositionType _positionType;
  56. }
  57. }