void IControllable.ProcessInputs(Save.InputSaver.InputSaverEntry Entry) { if (Constants.InputMode == 0) { var Up = Entry.Inputs[DirectionInputs[(int)Direction.UP]].IsDown || Entry.isDpadUpPressed; var Down = Entry.Inputs[DirectionInputs[(int)Direction.DOWN]].IsDown || Entry.isDpadDownPressed; var Right = Entry.Inputs[DirectionInputs[(int)Direction.RIGHT]].IsDown || Entry.isDpadRightPressed; var Left = Entry.Inputs[DirectionInputs[(int)Direction.LEFT]].IsDown || Entry.isDpadLeftPressed; if (Up) { Mdl.CurrentDirection = Direction.UP; } if (Down) { Mdl.CurrentDirection = Direction.DOWN; } if (Left) { Mdl.CurrentDirection = Direction.LEFT; } if (Right) { Mdl.CurrentDirection = Direction.RIGHT; } } }
public void ProcessInputs(Save.InputSaver.InputSaverEntry Entry) { if (!is_init) { return; } if (IM.CurrentMode != InputManager.Mode.DEACTIVATED) { var up = Entry.Inputs["Up"].IsDown; var down = Entry.Inputs["Down"].IsDown; var right = Entry.Inputs["Right"].IsDown; var left = Entry.Inputs["Left"].IsDown; if (up || down || right || left) { if (up) { neighbor = selected_poi.tryNeighbor(POI.DIRECTIONS.UP); } else if (down) { neighbor = selected_poi.tryNeighbor(POI.DIRECTIONS.DOWN); } else if (left) { neighbor = selected_poi.tryNeighbor(POI.DIRECTIONS.LEFT); } else if (right) { neighbor = selected_poi.tryNeighbor(POI.DIRECTIONS.RIGHT); } } } var space = Entry.Inputs["Submit"].IsDown; if (space) { // Get UIWorld and make the scene full screen UI.switchLevelToFullScreen(); if (IM.CurrentMode != InputManager.Mode.DEACTIVATED) { IM.CurrentMode = InputManager.Mode.DEACTIVATED; selected_stage.get_loaded_stage()?.GetComponentInChildren <InputManager>()?.Activate(); } else { IM.CurrentMode = InputManager.Mode.PLAYER; selected_stage.get_loaded_stage()?.GetComponentInChildren <InputManager>()?.DeActivate(); } } }
void Update() { if (!_Activated) { return; } // NOTE(toffa): Saver stuff test Save.InputSaver.InputSaverEntry Entry = new Save.InputSaver.InputSaverEntry(); Entry.Add("Up"); Entry.Add("Down"); Entry.Add("Right"); Entry.Add("Left"); Entry.Add("Break"); Entry.Add("Tick"); Entry.Add("BackTick"); Entry.Add("Restart"); Entry.Add("DPad_Vertical", true); Entry.Add("DPad_Horizontal", true); Entry.Add("SwitchTL"); Entry.Add("Cancel"); Entry.Add("Submit"); // if(Saver) Entry = Saver.Tick(Entry); // Entry.isDpadDownPressed = Entry.Inputs["DPad_Vertical"].AxisValue == 1 && _LastDpadAxisVertical != 1; // Entry.isDpadUpPressed = Entry.Inputs["DPad_Vertical"].AxisValue == -1 && _LastDpadAxisVertical != -1; // Entry.isDpadLeftPressed = Entry.Inputs["DPad_Horizontal"].AxisValue == 1 && _LastDpadAxisHorizontal != 1; // Entry.isDpadRightPressed = Entry.Inputs["DPad_Horizontal"].AxisValue == -1 && _LastDpadAxisHorizontal != -1; _LastDpadAxisHorizontal = Entry.Inputs["DPad_Horizontal"].AxisValue; _LastDpadAxisVertical = Entry.Inputs["DPad_Vertical"].AxisValue; // Set mode according to inputs // IMPORTANT toffa : the collection can change as process inputs could attach or detach gameobjects // so we must use vanilla for and not foreach // we could also copy the collection before calling process inputs, but I guess we want to processInputs // of newly attached object in this frame and not the next one var EndIdx = _Controllees.Count; Lock(); for (int i = 0; i < _Controllees.Count; ++i) { _Controllees[i].ProcessInputs(Entry); } UnLock(); }
void IControllable.ProcessInputs(Save.InputSaver.InputSaverEntry Entry) { var Up = Entry.Inputs["Up"].IsDown || Entry.isDpadUpPressed; var Down = Entry.Inputs["Down"].IsDown || Entry.isDpadDownPressed; var Right = Entry.Inputs["Right"].IsDown || Entry.isDpadRightPressed; var Left = Entry.Inputs["Left"].IsDown || Entry.isDpadLeftPressed; var Submit = Entry.Inputs["Break"].IsDown || Entry.isDpadLeftPressed; if (Up || Down || Right || Left || Submit) { skip_elapsed_time += Time.deltaTime; if (skip_elapsed_time > SKIP_TIMER) { go_next(); } } else { skip_elapsed_time = 0f; } }
/// <summary> /// Every input goes there. If you have another input it goes there! /// This function should NOT HAVE ANY EFFECT if possible, see this as a new "Update" /// This functino should NOT HAVE ANY PHYSICS /// Right now we simply dont get any inputs if /// </summary> /// <param name="Entry"></param> void IControllable.ProcessInputs(Save.InputSaver.InputSaverEntry Entry) { if (!CanTick()) { return; } if (Mdl.IsRewinding) { return; } var Up = Entry.Inputs["Up"].IsDown || Entry.isDpadUpPressed; var Down = Entry.Inputs["Down"].IsDown || Entry.isDpadDownPressed; var Right = Entry.Inputs["Right"].IsDown || Entry.isDpadRightPressed; var Left = Entry.Inputs["Left"].IsDown || Entry.isDpadLeftPressed; var SwitchTL = Entry.Inputs["SwitchTL"].IsDown; var SwitchWorldLevel = Entry.Inputs["Cancel"].IsDown; var ResetWorld = Entry.Inputs["Restart"].IsDown; var Break = Entry.Inputs["Break"].IsDown; if (SwitchWorldLevel) { CurrentStageSelector.UI.switchWorldToFullScreen(); CurrentStageSelector.IM.Activate(); return; } if (ResetWorld) { // TODO (mtn5): Add reset behavior again // oit was broken after coming from Scene based to GameObject based design :( } bool AnyDirection = (Up || Down || Right || Left); bool ForwardTick = (IM.CurrentMode == InputManager.Mode.RECORD && AnyDirection) || (Entry.Inputs["Tick"].IsDown) || (Entry.Inputs["Tick"].Down && Mdl.AutoReplayTick.Ended()); if (ForwardTick) { Mdl.IsGoingBackward = false; Mdl.AutoReplayTick.Restart(); Tick(); } var Obs = TL.GetCursorValue()?.GetObservers(); bool T = Obs != null ? ((Obs.Count != 0) && (Obs[Obs.Count - 1] as BreakValue == null)) : false; bool BackwardTick = Entry.Inputs["BackTick"].IsDown && !TL.IsTimelineAtBeginning(); if (BackwardTick) { Mdl.IsGoingBackward = true; BackTick(); } bool needBreak = (IM.CurrentMode == InputManager.Mode.REPLAY) && (Mdl.Players.Count != 0) && !Mdl.IsRewinding && (AnyDirection || Break); if (needBreak) { // create a new player at current position var CurrentPlayer = Mdl.Players[Mdl.Players.Count - 1]; var GO = AddPlayer(CurrentPlayer.transform.position); IM.Detach(CurrentPlayer.GetComponent <PlayerController>()); CurrentPlayer.GetComponent <PlayerController>().IM = new InputManager(); CurrentPlayer.GetComponent <PlayerController>().IM.CurrentMode = InputManager.Mode.REPLAY; IM.Attach(GO.GetComponent <PlayerController>()); IM.CurrentMode = InputManager.Mode.RECORD; TL.Mode = InputManager.Mode.RECORD; CurrentCamera?.GetComponent <PostFXRenderer>()?.StartAnimation(CurrentPlayer.transform.position, Mdl.Players.Count - 2, Mdl.Players.Count - 1); SwitchToCurrentPlayerTL(); } if (SwitchTL) { SwitchToNextTL(); } }