public void StartIntroduction() { switch (type) { case IntroductionType.Arrow: activeArrow = Instantiate(prefabIntroArrow, transform); activeArrow.GetComponent <IntroArrow>().PlaceRelative((RectTransform)transform, relativeArrowPosition, introArrowSpacing); break; case IntroductionType.Shake: shakeableObject = transform.GetComponent <ShakeableObject>() ?? gameObject.AddComponent <ShakeableObject>(); shakeableObject.SetRotation(); shakeableObject.Initiate(); break; } }
private void Awake() { shakable = GetComponent <ShakeableObject>(); button = GetComponent <Button>(); if (mailProperty.HasUnPickedUpMail) { shakable.Initiate(); TryStartIntroduction(); } else { gameObject.SetActive(false); } button.onClick.AddListener(PickupMail); }