public void Init( KinimaticMotorController motorController, NodePathController nodePath, HauntController hauntController, HouseController house, FearController fearController, BarrierController barrierController, ActionLockController actionLockController, CameraController cameraController ) { this.cameraController = cameraController; this.actionLockController = actionLockController; actionLockController.OnLock += HandleActionLock; var body = GetComponent <Rigidbody>(); pather = new PathDirectionController(transform, nodePath.GetRoute, finalOffset); motor = motorController.GetMotor(motorConfig, body, pather); animator = modelRoot.GetComponentInChildren <Animator>(); motorAnimator = new MotorAnimator(pather, animator, walkStateName, idleStateName); var hauntResponder = new HauntResponder() { root = transform }; hauntResponder.onRespond += HandleHaunt; hauntController?.AddResponder(hauntResponder); this.house = house; foreach (var reaction in reactions) { reactionMap[reaction.haunt] = reaction; } fearActor = new FearActor() { house = house, root = transform, maxFear = maxFear }; fearActor.OnScared += HandleScared; fearActor.OnPanic += HandlePanic; fearActor.OnCuriouse += HandleCuriouse; fearController?.AddActor(fearActor); blockable = new BarrierBlockable() { root = transform }; blockable.OnBlock += HandleBlock; blockable.OnUnblock += HandleUnblock; barrierController?.AddBlockable(blockable); currentBlockAnim = breakDownAnim; ui.Init(reactions, fearActor, hauntController); entrance = house.GetEntrance(); }
public void Init(FearController fearController, float fearTarget, ActionLockController actionLock) { this.actionLockController = actionLock; this.fearTarget = fearTarget; this.fearController = fearController; progressionTick.rotation = Quaternion.Euler(0, 0, 0); targetRotation = 0; lastRotation = 0; welcome.SetActive(true); escapeFail.SetActive(false); lowFearEnd.SetActive(false); midFearEnd.SetActive(false); highFearEnd.SetActive(false); restart.SetActive(false); tickDial = new Dial(progressionTick, tickSpeed, -180, actionLockController); fearDial = new Dial(fearTick, tickSpeed, 180, actionLockController); }
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 Awake() { instance = this; }
private void Awake() { instance = this; slider = GameObject.FindWithTag("UI").transform.GetChild(2).GetChild(8).gameObject; }