//! Called by unity engine on start up to initialize variables. public void Start() { playerController = GetComponent <PlayerController>(); machineInteraction = new MachineInteraction(playerController, this); storageInteraction = new StorageInteraction(playerController, this); blockInteraction = new BlockInteraction(playerController, this); }
private void Start() { Cursor.lockState = CursorLockMode.Locked; inputs = GetComponent <PlayerInputs>(); movements = GetComponent <PlayerMovement>(); interactions = GetComponent <BlockInteraction>(); display = GetComponent <PlayerUIDisplay>(); }
protected override void Start() { base.Start(); m_InputActions.Enable(); m_MoveAction = m_InputActions["Player/Move"]; m_RunAction = m_InputActions["Player/Run"]; m_LookAction = m_InputActions["Player/Look"]; m_JumpAction = m_InputActions["Player/Jump"]; m_FlyAction = m_InputActions["Player/Fly"]; m_FlyDownAction = m_InputActions["Player/Fly Down"]; m_CursorStateAction = m_InputActions["Player/Cursor State"]; m_Camera = GetComponentInChildren <Camera>(); m_CameraTransform = m_Camera.GetComponent <Transform>(); m_FluidInteractor = GetComponent <FluidInteractor>(); m_FirstPersonLook.Initialize(m_Transform, m_CameraTransform, true); m_HeadBob.Initialize(m_CameraTransform); m_JumpBob.Initialize(); m_OriginalCameraPosition = m_CameraTransform.localPosition; m_StepCycle = 0f; m_NextStep = m_StepCycle * 0.5f; m_RunAction.performed += SwitchRunMode; m_JumpAction.performed += SwitchJumpMode; m_FlyAction.performed += SwitchFlyMode; m_FlyDownAction.performed += SwitchFlyDownMode; m_CursorStateAction.performed += SwitchCursorState; BlockInteraction interaction = GetComponent <BlockInteraction>(); interaction.Initialize(m_Camera, this); interaction.enabled = true; }