private static DirectionalInputState getNewInputState(KeyBindingsController bindings, KeyAction action, MoveDirection direction) { return(new DirectionalInputState() { at = Stopwatch.GetTimestamp(), isPressed = false, direction = direction, key = bindings.GetKey(action) }); }
public void Init( KinimaticMotorController motorController, CameraController cameraController, HauntController hauntController, KeyBindingsController keyBindings, BarrierController barrierController, ActionLockController actionLockController ) { var body = GetComponentInChildren <Rigidbody>(); this.actionLockController = actionLockController; directionInput = new InputDirectionController(keyBindings); motor = motorController.GetMotor(motorConfig, body, directionInput); motorAnimator = new MotorAnimator(directionInput, GetComponentInChildren <Animator>(), walkStateName, idleStateName); cameraController.Follow(transform); haunter = new Haunter() { root = transform }; hauntController?.AddHaunter(haunter); interactKey = keyBindings.GetKey(KeyAction.Interact); dimmer = new ProximityDimmer() { root = transform, radius = dimRadius }; builder = new BarrierBuilder() { root = transform }; barrierController?.SetBuilder(builder); }
public InputDirectionController(KeyBindingsController keyBindings) { inputStates = new List <DirectionalInputState>() { getNewInputState(keyBindings, KeyAction.MoveForward, MoveDirection.Forward), getNewInputState(keyBindings, KeyAction.MoveBack, MoveDirection.Backward), getNewInputState(keyBindings, KeyAction.MoveLeft, MoveDirection.Left), getNewInputState(keyBindings, KeyAction.MoveRight, MoveDirection.Right), }; }
public void Start() { actionLock = new ActionLockController(); barrierController = GetComponent <BarrierController>(); fearController = GetComponent <FearController>(); keyBindings = GetComponent <KeyBindingsController>(); cameraController = GetComponent <CameraController>(); motorController = GetComponent <KinimaticMotorController>(); houseController = GetComponent <HouseController>(); hauntController = GetComponent <HauntController>(); pathController = GetComponent <NodePathController>(); barrierController.Init(actionLock); fearController.Init(); keyBindings.Init(); cameraController.Init(actionLock); motorController.Init(); hauntController.Init(actionLock); houseController.Init(motorController, pathController, hauntController, barrierController); ui = GameObject.Instantiate(uiPrefab, transform); ui.OnEndOfNight += HandleEndOfNight; ui.Init(fearController, fearTarget, actionLock); houseController.Generate(); var invShuffle = new ShuffleSet <GameObject>(investigatorModels); var roomShuffle = new ShuffleSet <Vector2Int>(houseController.GetNonStartingRooms()); var rotationIncrement = 360.0f / investigatorCount; for (int i = 0; i < investigatorCount; i++) { var rotation = i * rotationIncrement; var offset = Quaternion.Euler(0, rotation, 0) * (Vector3.right * offsetDistance); SpawnInvestigator(invShuffle, offset); } SpawnPlayer(); }
private void SetKeyboardInputs() { KeyBindingsController.Set(Model.SelectedAppConfigs?.SelectMany(x => x.Sections).SelectMany().OfType <PythonAppConfigKeyValue>()); }
private void SetKeyboardInputs() { KeyBindingsController.Set(Model.MainModel.SelectedPage?.Config?.Sections.SelectMany().OfType <PythonAppConfigKeyValue>()); }