コード例 #1
0
        public void OnMove(InputAction.CallbackContext context)
        {
            if (!GlobalInstanceManager.GetStateManager().CanMove)
            {
                return;
            }

            GlobalInstanceManager.GetStateManager().HasMoved = true;
            Vector2 movement  = context.ReadValue <Vector2>();
            float   movementX = movement.x;

            if (movementX == 0)
            {
                StopMoving();

                return;
            }

            if (movementX > 0)
            {
                MoveEast();
            }
            else
            {
                MoveWest();
            }
        }
コード例 #2
0
 private void DeactivateUiAndStartPlaying()
 {
     GlobalInstanceManager.GetAudioManager().FadeInCaveAmbience();
     ui.gameObject.SetActive(false);
     eventSystem.gameObject.SetActive(false);
     GlobalInstanceManager.GetFlowManager().StartPlaying();
 }
コード例 #3
0
        public bool IsCleared()
        {
            StateManager stateManager = GlobalInstanceManager.GetStateManager();
            PropertyInfo propertyInfo = stateManager.GetType().GetProperty(stateName);

            return(!(propertyInfo is null) && (bool)propertyInfo.GetValue(stateManager) == expectedValue);
        }
コード例 #4
0
        private IEnumerator StartOfTheGame()
        {
            yield return(new WaitForSeconds(waitBeforeHint));

            GlobalInstanceManager.GetMainCharacter().GetComponent <MessageManager>()
            .ShowMessage(
                "Use the <color=#FFF02D>arrow keys</color> to move. <color=#FFF02D><space bar></color> to jump. <color=#FFF02D>W</color> to pull boxes");
        }
コード例 #5
0
        private void Start()
        {
            _rigidbody = GetComponent <Rigidbody2D>();

            if (GlobalInstanceManager.GetMainCharacter() == null)
            {
                return;
            }

            _playerMovement = GlobalInstanceManager.GetMainCharacter().GetComponent <PlayerMovement>();
        }
コード例 #6
0
ファイル: JobInfo.cs プロジェクト: KribKing/DownLoadExe
        public virtual IConfigUIInterface Config()
        {
            if (this.AddinsInfo == null || string.IsNullOrEmpty(this.AddinsInfo.ConfigUI))
            {
                return(null);
            }
            IConfigUIInterface ui = GlobalInstanceManager <IConfigUIInterface> .ReflectInstance(this.AddinsInfo.ConfigUI.Split(':')[0], this.AddinsInfo.ConfigUI.Split(':')[1]);

            ui.SetJobInfo(this);
            return(ui);
        }
コード例 #7
0
        private void Start()
        {
            _debug = GlobalInstanceManager.GetDebugStateManager();

            if (_debug.skipTitleScreen)
            {
                DeactivateUiAndStartPlaying();
            }
            else
            {
                StartCoroutine(StartUI());
            }
        }
コード例 #8
0
        private void Start()
        {
            if (!GetComponent <CharacterManager>().isMain)
            {
                return;
            }

            GlobalInstanceManager.GetStateManager().StateChanged += OnCannotMove;

            InputManager.OnMove(OnMove);
            InputManager.OnJump(OnJump);
            InputManager.OnPull(OnPull);
        }
コード例 #9
0
        private IEnumerator EndGameSequence()
        {
            float     gameTime  = GetGameTime();
            UIManager uiManager = GlobalInstanceManager.GetGameManager().GetComponentInChildren <UIManager>();

            GlobalInstanceManager.GetStateManager().CanMove = false;
            GlobalInstanceManager.GetMainCharacter().GetComponent <CharacterController2D>().MakeSureFacing(true);
            yield return(new WaitForSeconds(5));

            yield return(uiManager.ShowGameTime(gameTime));

            GlobalInstanceManager.Reload();
            SceneManager.LoadScene(0);
        }
コード例 #10
0
        public void OnPull(InputAction.CallbackContext context)
        {
            if (!GlobalInstanceManager.GetStateManager().CanMove)
            {
                return;
            }

            if (context.canceled)
            {
                _isTryingToPull = false;

                return;
            }

            _isTryingToPull = true;
        }
コード例 #11
0
        public void OnRecord(InputAction.CallbackContext context)
        {
            if (!GlobalInstanceManager.GetStateManager().CanMove)
            {
                return;
            }

            if (!GlobalInstanceManager.GetStateManager().CanUsePower)
            {
                return;
            }

            if (!context.performed)
            {
                return;
            }

            if (_isRecording)
            {
                _forceRecordingEnd = true;
                return;
            }

            if (slots <= 0)
            {
                return;
            }

            slots--;

            _isRecording        = true;
            _startedRecordingAt = Time.fixedTime;
            _progressManager.FadeInAccent();

            Recording recording = new Recording();

            recording.AddEvent(new RecordingEvent()
            {
                Position           = transform.position,
                Velocity           = GetComponent <Rigidbody2D>().velocity,
                HorizontalMovement = GetComponent <PlayerMovement>().GetHorizontalMovement(),
                EventType          = RecordingEventType.Appear
            });
            _currentRecording = recording;
        }
コード例 #12
0
        public void OnJump(InputAction.CallbackContext context)
        {
            if (!GlobalInstanceManager.GetStateManager().CanMove)
            {
                return;
            }

            if (context.performed)
            {
                GlobalInstanceManager.GetStateManager().HasJumped = true;
                JumpNow();
            }

            if (context.canceled)
            {
                StopHoldingJump();
            }
        }
コード例 #13
0
        public IEnumerator GetDialogue(SpeechBubbleManager npc, SpeechBubbleManager main)
        {
            if (!_hasPresented)
            {
                _hasPresented = true;
                yield return(GetFirstDialogue(npc, main));
            }

            IEnumerable <NpcManager> managers = GlobalInstanceManager.GetGameManager()
                                                .GetComponentsInChildren <NpcManager>()
                                                .Where(manager => manager.needToBeSaved);
            IEnumerable <NpcManager> npcManagers = managers.ToList();
            int total = npcManagers.Count();
            int saved = npcManagers.Count(manager => manager.IsSaved());

            yield return(npc.Say(
                             $"You have saved <color=#FFF02D>{saved}</color> out of <color=#FFF02D>{total}</color> prisoners.", 5f));

            if (saved == 0)
            {
                yield return(npc.Say("Better get started on that, what do you think?", 4f));
            }

            if (saved == total)
            {
                yield return(npc.Say("Good job on saving everyone!", 3f, 0, 0, VoiceTone.Angry));
            }

            IEnumerable <HiddenPassageManager> passages = GlobalInstanceManager.GetGameManager()
                                                          .GetComponentsInChildren <HiddenPassageManager>();
            const int totalPassages = 7;
            int       foundPassages = totalPassages - passages.Count();

            yield return(npc.Say(
                             $"You have found <color=#FFF02D>{foundPassages}</color> out of <color=#FFF02D>{totalPassages}</color> hidden passages.",
                             5f));

            if (totalPassages == foundPassages)
            {
                yield return(npc.Say("Good job on finding every hidden passage!", 3f));
            }

            yield return(npc.Say("See you next time!", 2f));
        }
コード例 #14
0
        public void Invoke()
        {
            switch (actionType)
            {
            case ItemActionType.Take:
                _inventoryManager.TakeItem(new InventoryItem()
                {
                    Name = itemName
                });
                GlobalInstanceManager.GetMainCharacter().GetComponent <MessageManager>()
                .ShowMessage(youFoundText);
                StartCoroutine(FadeOutItem());
                break;

            case ItemActionType.Drop:
                _inventoryManager.DropItem(itemName);
                break;

            default:
                return;
            }
        }
コード例 #15
0
        public void InteractNow()
        {
            if (!ShouldBeAllowedToInteract())
            {
                return;
            }

            SetCanvasActiveStatus(false);
            _hasInteracted = true;

            if (requireCharacterToLook)
            {
                CharacterController2D characterController =
                    GlobalInstanceManager.GetMainCharacter().GetComponent <CharacterController2D>();
                characterController.MakeSureFacing(faceRightWhenStandingInPosition);
            }

            onInteract.Invoke();
            _gameActions.Invoke();

            StartCoroutine(Animate(0));
            StartCoroutine(AnimateMessagePanel(0));
        }
コード例 #16
0
        public void Init()
        {
            if (GlobalInstanceManager <AddinsSetting> .Intance.Default == null || GlobalInstanceManager <AddinsSetting> .Intance.Default.Count <= 0)
            {
                return;
            }
            foreach (AddinsInfo ai in GlobalInstanceManager <AddinsSetting> .Intance.Default)
            {
                if (!ai.IsUse)
                {
                    continue;
                }
                ITaskStarterInterface task = GlobalInstanceManager <ITaskStarterInterface> .ReflectInstance(ai.AssemblyName, ai.TaskStarter);

                IJobSettingInterface <JobInfo> setting = GlobalInstanceManager <IJobSettingInterface <JobInfo> > .ReflectInstance(ai.AssemblyName, ai.SettingInterface);

                setting.Init();
                JobInfo baseJob = GlobalInstanceManager <JobInfo> .ReflectInstance(ai.AssemblyName, ai.JobInfo);

                baseJob.TaskStarter      = task;
                baseJob.SettingInterface = setting;
                baseJob.AddinsInfo       = ai;
                this.BaseJob.Add(baseJob);
                List <JobInfo> list = setting.Default;
                if (list == null)
                {
                    continue;
                }
                foreach (var item in list)
                {
                    item.AddinsInfo  = ai;
                    item.TaskStarter = task;
                    this.JobInfoDic.Add(item.GuId, item);
                }
            }
        }
コード例 #17
0
        public void Generate()
        {
            Start();

            foreach (BlockManager blockManager in GlobalInstanceManager.GetGameManager().gameObject
                     .GetComponentsInChildren <BlockManager>())
            {
                Vector3 position = blockManager.gameObject.transform.position;
                float   blockX   = position.x;
                float   blockY   = position.y;
                ColorableGridSection gridSection =
                    sections.First(section =>
                                   blockX >= section.originX && blockX <= section.targetX && blockY >= section.originY &&
                                   blockY <= section.targetY);

                if (gridSection != null)
                {
                    blockManager.colorScheme = blockManager.primaryOverride
                        ? gridSection.colorScheme
                        : gridSection.secondaryColorScheme;
                }

                blockManager.tint = _assetManager.GetMainColor(blockManager.colorScheme);

                EditorUtility.SetDirty(blockManager);
                blockManager.CreateBlockSprites();
            }

            foreach (ColorableGridSection gridSection in sections)
            {
                for (int i = gridSection.originX; i < gridSection.targetX; i++)
                {
                    for (int j = gridSection.originY; j < gridSection.targetY; j++)
                    {
                        Erase(i, j);

                        if (!HasTile(i, j))
                        {
                            if (HasTile(i, j, background))
                            {
                                Vector3Int position = new Vector3Int(i, j, 0);

                                if (Random.Range(0, 20) > 18)
                                {
                                    int variant = Random.Range(1, 13);
                                    decalLight.SetTile(position,
                                                       _assetManager.GetDecalTile(gridSection.backgroundColorScheme, true, variant));
                                    decalDark.SetTile(position,
                                                      _assetManager.GetDecalTile(gridSection.backgroundColorScheme, false, variant));
                                }

                                color.SetTile(position,
                                              _assetManager.GetMainColorTile(gridSection.backgroundColorScheme));
                            }

                            continue;
                        }

                        Add(i, j, gridSection.colorScheme, gridSection);
                    }
                }
            }
        }
コード例 #18
0
 private void Start()
 {
     _assetManager = GlobalInstanceManager.GetAssetManager();
 }
コード例 #19
0
 public static void GenerateTilesAndShadows()
 {
     GlobalInstanceManager.GetAssetManager().SetAndUpdate();
     ShadowCaster2DGenerator.GenerateShadowCasters();
 }
コード例 #20
0
 private void Awake()
 {
     _stateManager  = GlobalInstanceManager.GetStateManager();
     _mainCharacter = GlobalInstanceManager.GetMainCharacter();
     _debug         = GlobalInstanceManager.GetDebugStateManager();
 }
コード例 #21
0
 public bool IsCleared()
 {
     return(GlobalInstanceManager.GetInventoryManager().HasItem(itemName));
 }
コード例 #22
0
 private void Start()
 {
     _inventoryManager = GlobalInstanceManager.GetInventoryManager();
 }
コード例 #23
0
        private IEnumerator GetFirstDialogue(SpeechBubbleManager npc, SpeechBubbleManager main)
        {
            IEnumerable <NpcManager> managers = GlobalInstanceManager.GetGameManager()
                                                .GetComponentsInChildren <NpcManager>()
                                                .Where(manager => manager.needToBeSaved);
            IEnumerable <NpcManager> npcManagers = managers.ToList();
            int  total            = npcManagers.Count();
            int  saved            = npcManagers.Count(manager => manager.IsSaved());
            bool hasSavedEveryone = total == saved;

            yield return(npc.Say("Congratulations, you have almost reached the exit.", 3f));

            yield return(npc.Say("Unfortunately, it seems there is no way to open this door.", 5f));

            yield return(main.Say("Are you the warden of this prison?", 3f));

            yield return(npc.Say("Am I? Well. Yes.", 3f));

            yield return(npc.Say("And so are you.", 3f));

            yield return(npc.Say("And so is everyone here.", 3f));

            yield return(npc.Say("Each prisoner, warden of a prison called <color=#FFF02D>self</color>.", 5f));

            yield return(npc.Say("Curious, right?", 2f));

            yield return(main.Say("I am not sure I understand.", 3f));

            yield return(npc.Say("You might, in time.", 3f));

            yield return(npc.Say("Still, in your shoes, I would be very proud of myself.", 5f));

            yield return(npc.Say("You managed to exit your cell. Alone.", 4f));

            yield return(main.Say("I had help. Someone throw a magical lantern (and a rock) right at me.", 5f));

            yield return(npc.Say("I will repeat. You managed to exit your cell... alone.", 5f));

            yield return(npc.Say("You managed to bring yourself here.", 4f));

            yield return(npc.Say("You maybe didn't realize: that was already the most important step.", 5f));

            yield return(npc.Say("While, this exit here? Just well-deserved joy.", 4f));

            yield return(main.Say("What about the other prisoners? They were less lucky.", 5f));

            if (hasSavedEveryone)
            {
                yield return(npc.Say("You <i>did</i> save everyone.", 3f));

                yield return(npc.Say("Wouldn't you say, in this case, they were the luckiest ones?", 5f));
            }
            else
            {
                yield return(npc.Say("You could have saved everyone. But you didn't.", 4f));

                yield return(npc.Say("I expect you'll be thinking about that on your way out.", 5f));
            }

            yield return(main.Say("What about this door, then?", 4f));

            yield return(npc.Say("It won't open.", 2f));

            yield return(main.Say("I... I don't accept that.", 3f));

            yield return(npc.Say("You don't, uh?", 2f));

            yield return(npc.Say("In the face of this insurmountable obstacle, you do not budge?", 5f));

            yield return(npc.Say("When given all the wrong cards, do you not give up the game?", 5f));

            yield return(npc.Say("Do you want to get out, even when everything screams at you, that you cannot?", 6f));

            yield return(new WaitForSeconds(2f));

            yield return(main.Say("You already know the answer to that.", 4f));

            yield return(main.Say("I will chew my way out, if necessary.", 4f));

            yield return(npc.Say("I see.", 1f));

            yield return(npc.Say("It was not easy. Others had given up.", 4f));

            yield return(npc.Say("But you had something in you that made the impossible, possible.", 5f));

            yield return(npc.Say("If there is anything you should remember from this journey, let it be this:", 5f));

            yield return(npc.Say("That power means nothing, if you only use it for yourself.", 4f));

            lastDoor.StartOpening();

            yield return(npc.Say("Welcome back to the outside, friend.", 4f));

            yield return(main.Say("What about this lantern?", 3f, 1f, 0, VoiceTone.Question));

            yield return(npc.Say("I'll take it.", 2f));

            GlobalInstanceManager.GetStateManager().HasLantern  = false;
            GlobalInstanceManager.GetStateManager().CanUsePower = false;

            yield return(npc.Say("This lantern has more to offer.", 4f, 1f));

            yield return(npc.Say("I know what to do with it. As for you...", 4f));

            yield return(npc.Say("You should go now.", 3f));

            _hasPresented = true;
        }
コード例 #24
0
        private IEnumerator FirstDialogue(SpeechBubbleManager npc, SpeechBubbleManager main)
        {
            void OnDone()
            {
                _speechState = 1;
                GlobalInstanceManager.GetStateManager().CanUsePower = true;
            }

            if (GlobalInstanceManager.GetDebugStateManager().elbertSkipFirstDialogue)
            {
                yield return(npc.Say("Blah blah blah", 1f));

                OnDone();
                yield break;
            }

            yield return(npc.Say("Oh, hi. Was it you that opened the door?", 5f));

            yield return(main.Say("Yes", 3f));

            yield return(npc.Say("Well, we're both trapped now", 3f));

            yield return(main.Say("...", 1f, 1f));

            yield return(npc.Say("Unless you happened to find a magical lantern on your way here?", 5f));

            yield return(main.Say("I do have a lantern with me. Is it really magical?", 4f));

            yield return(npc.Say("A message should have appeared telling you so", 4f));

            yield return(main.Say("You mean, when I took it?", 2f));

            yield return(npc.Say("Yup.", 2f));

            npc.SayNow("It did not appear, right?", 3f);
            npc.SayNow("...Great.", 4f, 2.5f, 0, VoiceTone.Angry);
            yield return(main.Say("Nope", 4.5f, 1f));

            yield return(new WaitForSeconds(2f));

            yield return(npc.Say("*whistles*", 2f));

            yield return(new WaitForSeconds(3f));

            GlobalInstanceManager.GetMainCharacter().GetComponent <MessageManager>()
            .ShowMessage(
                "You found a <color=#FFF02D>magical lantern</color>!");
            yield return(npc.Say("This game is already <b>falling apart</b>", 3f, 3f));

            yield return(npc.Say("Make sure you read the instructions carefully.", 4f));

            yield return(new WaitForSeconds(2f));

            npc.SayNow("Anytime now", 3f);
            yield return(new WaitForSeconds(.8f));

            GlobalInstanceManager.GetMainCharacter().GetComponent <MessageManager>()
            .ShowMessage(
                "Press <color=#FFF02D>q</color> to start recording");
            yield return(npc.Say("...There you go", 1.5f, 1f));

            yield return(npc.Say("Let me elaborate. Press \"q\" to start recording.", 6f, 4f));

            yield return(npc.Say("The lantern will record everything you do, and then create a clone.", 6f));

            yield return(npc.Say("The clone will move (as you did while recording) for a few times.", 5f));

            yield return(npc.Say("You can probably think of a way to use this power to get out.", 5f));

            yield return(npc.Say("Maybe you can find a way to save me?", 4f));

            yield return(npc.Say("The platform is too high for me. I'm sure you'll find a way.", 5f));

            OnDone();
        }