public override bool Execute(Tutorial t, float time)
        {
            if (Timeout > 0)
            {
                if (time - StartTime > Timeout)
                {
                    return false;
                }
            }

            if (_prefabInstance == null) return false;
            var rt = _prefabInstance.transform as RectTransform;
            if (!rt) return false;
            var pos = Vector2.zero;
            var set = false;
            if (CachedEventInfo.LinkedEntity != null)
            {
                pos = Camera.main.WorldToScreenPoint(CachedEventInfo.LinkedEntity.transform.position);
                set = true;
            }
            if (CachedEventInfo.LinkedSpawner != null)
            {
                pos = Camera.main.WorldToScreenPoint(CachedEventInfo.LinkedSpawner.transform.position);
                set = true;
            }
            if (!set)
            {
                return false;
            }
            rt.anchoredPosition = pos+Offset;
            return true;
        }
 public override void OnCleanup(Tutorial t)
 {
     if (_prefabInstance != null)
     {
         Destroy(_prefabInstance);
     }
 }
Esempio n. 3
0
        protected virtual void CompletedAllTutorials()
        {
            IsActive = false;
            TimeManager.Instance.UnPause();
            narrator.SetActive(false);

            Tutorial.ResetIndex();

            EventManager.Instance.RaiseEvent(new IncreaseMoneyEvent(money));
            Destroy(gameObject);
        }
Esempio n. 4
0
        protected override void CompletedAllTutorials()
        {
            IsActive = false;
            DisableNarrator();

            Tutorial.ResetIndex();
            Destroy(gameObject);

            UserSettings.GameData.RTutorial = true;

            EventManager.Instance.RemoveListener <OpenResearchFacilityEvent>(StartTutorial);
        }
 public override void OnInitialize(Tutorial t, float time)
 {
     if (Timeout > 0)
     {
         StartTime = time;
     }
     if (_prefabInstance == null && Prefab != null)
     {
         _prefabInstance = Instantiate(Prefab);
         _prefabInstance.transform.parent = t.UIAnchor;
     }
 }
Esempio n. 6
0
        private void SetNextTutorial(int currentOrder)
        {
            currentTutorial = GetTutorialByOrder(currentOrder);

            if (!currentTutorial)
            {
                CompletedAllTutorials();
                return;
            }

            currentTutorial.StartTutorial(arrow, this);
        }
        public override bool Execute(Tutorial t, float time)
        {
            if (Timeout > 0)
            {
                if (time - StartTime > Timeout)
                {
                    return false;
                }
            }

            if (_prefabInstance == null || other == null) return false;
            var rt = _prefabInstance.transform as RectTransform;
            if (!rt) return false;
            rt.anchoredPosition = other.anchoredPosition+Offset;
            return true;
        }
Esempio n. 8
0
        static void Main(string[] args)
        {
#if XBOX360
            using (Tutorial game = new Tutorial())
                game.Run();
#else
            while (true)
            {
                bool runInWinForms;
                bool runInXnaGame;

                Type type = TutorialChooser.ChooseTutorial(out runInWinForms, out runInXnaGame);
                if (type == null)
                {
                    break;
                }

                using (Application tutorial = Activator.CreateInstance(type) as Application)
                {
                    if (runInWinForms)
                    {
                        WinFormsExample form = new WinFormsExample();
                        tutorial.Run(form.XenWinFormsHostControl);

                        System.Windows.Forms.Application.Run(form);
                    }
                    else if (runInXnaGame)
                    {
                        XnaGame game = new XnaGame(tutorial);
                        game.Run();
                    }
                    else
                    {
                        tutorial.Run();
                    }
                }
            }
#endif
        }
Esempio n. 9
0
 public abstract void OnInitialize(Tutorial t, float time);
Esempio n. 10
0
 public abstract void OnCleanup(Tutorial t);
Esempio n. 11
0
 public abstract bool Execute(Tutorial t, float time);