예제 #1
0
 /// <summary>
 /// Конструктор
 /// </summary>
 /// <param name="questStorage">Прослойка для получения данных о квестах</param>
 public QuestLogController(IQuestStorage questStorage)
 {
     _questStorage = questStorage;
     _quests       = _questStorage.LoadQuestLog();
     EventManager.StartListening(GameEventTypes.QuestAccepted, OnQuestAccept);
     EventManager.StartListening(GameEventTypes.NpcDie, OnNpcDie);
     EventManager.StartListening(GameEventTypes.AreaEnter, OnAreaEnter);
     EventManager.StartListening(GameEventTypes.Saving, OnProgressSaving);
     EventManager.StartListening(GameEventTypes.QuestAbandoned, OnQuestAbandon);
     EventManager.StartListening(GameEventTypes.QuestReported, OnQuestReport);
     EventManager.StartListening(GameEventTypes.ItemAcquired, OnItemAcquired);
     EventManager.StartListening(GameEventTypes.DialogStarted, OnDialogEnter);
     EventManager.StartListening(GameEventTypes.ItemUsed, OnItemUse);
     EventManager.StartListening(GameEventTypes.ObjectUsed, OnObjectUse);
     EventManager.StartListening(GameEventTypes.DialogAnswerSelect, OnDialogAnswerSelect);
 }
예제 #2
0
        private void Awake()
        {
            GetStartScript = this;

            //Init non-unity systems
            QuestRepository.Init();
            ItemTemplateRepository.Init();

            _questStorage = new DbQuestStorage();
            _itemStorage  = new DbItemStorage();

            //Get objects
            var Player         = GameObject.FindGameObjectWithTag("Player");
            var CameraCenter   = GameObject.FindGameObjectWithTag("CameraCenter").transform;
            var PlayerAnimator = GameObject.FindGameObjectWithTag("PlayerAnimator");

            //Создаем контроллеры
            AnimController   = new AnimController(PlayerAnimator);
            InputController  = new InputController();
            CameraController = new CameraController(Camera.main.GetComponent <CameraModel>(), CameraCenter, Camera.main,
                                                    InputController);
            MovementController = new MovementController(Player.transform, Player.GetComponent <CharController>());
            StaminaController  = new StaminaController(ref Player.GetComponent <StaminaModel>().Stamina,
                                                       Player.GetComponent <StaminaModel>(), InputController, MovementController, AnimController);
            // enemyAttackController = new EnemyAttackController(targetDetector);
            HealthController = new HealthController(ref Player.GetComponent <HealthModel>().health,
                                                    Player.GetComponent <HealthModel>());
            QuestLogController  = new QuestLogController(_questStorage);
            InventoryController = new InventoryController(_itemStorage);

            //Находим необходимые контроллеры которые висят на объектах
            SwordStartController = FindObjectOfType <SwordStartController>();

            #region Добавляем контроллеры в коллекцию

            _allControllers.Add(InputController);
            _allControllers.Add(CameraController);
            _allControllers.Add(MovementController);
            _allControllers.Add(StaminaController);
            _allControllers.Add(AnimController);
            // AllControllers.Add(enemyAttackController);
            _allControllers.Add(HealthController);
            _allControllers.Add(QuestLogController);
            _allControllers.Add(InventoryController);

            #endregion
        }
예제 #3
0
 public QuestModel(IQuestStorage questStorage, GameContext context)
 {
     Context      = context;
     QuestStorage = questStorage;
     QuestStorage.LoadGame("TestSave.bytes");
     _quests         = QuestStorage.GetAllActiveQuests();
     _completedQuest = QuestStorage.GetAllCompletedQuests();
     ActiveQuests    = QuestStorage.GetAllActiveQuestsById();
     CompletedQuests = QuestStorage.GetAllCompletedQuestsById();
     Services.SharedInstance.EventManager.StartListening(GameEventTypes.QuestAccepted, OnQuestAccept);
     Services.SharedInstance.EventManager.StartListening(GameEventTypes.NpcDie, OnNpcDie);
     Services.SharedInstance.EventManager.StartListening(GameEventTypes.AreaEnter, OnAreaEnter);
     Services.SharedInstance.EventManager.StartListening(GameEventTypes.Saving, OnProgressSaving);
     Services.SharedInstance.EventManager.StartListening(GameEventTypes.QuestAbandoned, OnQuestAbandon);
     Services.SharedInstance.EventManager.StartListening(GameEventTypes.QuestReported, OnQuestReport);
     Services.SharedInstance.EventManager.StartListening(GameEventTypes.DialogStarted, OnDialogEnter);
     Services.SharedInstance.EventManager.StartListening(GameEventTypes.ObjectUsed, OnObjectUse);
     Services.SharedInstance.EventManager.StartListening(GameEventTypes.DialogAnswerSelect, OnDialogAnswerSelect);
     //  EventManager.StartListening(GameEventTypes.ItemAcquired, OnItemAcquired);
     //  EventManager.StartListening(GameEventTypes.ItemUsed, OnItemUse);
     // не удалять, события для предметов
 }