protected override void SetInitialValues() { _animatorVariables = new PlayerAnimatorVariables(); _cinemachine = GameObject.FindObjectOfType <CinemachineVirtualCamera>(); _uIManager = GameObject.FindObjectOfType <UIManager>(); _playerStateManage = GameObject.FindObjectOfType <PlayerStateManager>(); _activePlayerUI = GameObject.FindObjectOfType <ActivePlayersUIComponent>(); _animator = this.GetComponent <Animator>(); _audioComponent = this.GetComponent <AudioComponent>(); _damageDealerComponent = this.GetComponent <DamageDealerComponent>(); _damageTakerComponent = this.GetComponent <DamageTakerComponent>(); _miniMapComponent = GameObject.FindObjectOfType <MiniMapComponent>(); if (_canMoveByClick) { _movementMouseComponent = this.GetComponent <MovementMouseComponent>(); } if (_canInteract) { _interactableComponent = this.GetComponent <InteractableComponent>(); } if (_canPoop) { _stomachComponent = this.GetComponent <StomachComponent>(); } }
protected override void SetInitialValues() { _playerStructure = this.GetComponent <PlayerStructure>(); _inputManager = GameObject.FindObjectOfType <InputManager>(); _poopList = Resources.LoadAll <PoopScriptable>("ScriptableObjects/Poops"); _stomachUIComponent = GameObject.FindObjectOfType <StomachUIComponent>(); StomachItemList = new List <StomachItemDTO>(); _isPooping = false; _animator = this.GetComponent <Animator>(); _movementMouseComponent = this.GetComponent <MovementMouseComponent>(); _animatorVariables = new StomachAnimatorVariables(); _playerStateManager = GameObject.FindObjectOfType <PlayerStateManager>(); }
private void ManageMouseConinuousLeftClick() { if (_inputManager.MouseLeftButton == 1) { List <IInteractable> interactableList = new List <IInteractable>(); List <Button> buttonList = new List <Button>(); _canMove = true; bool hitSomeUIComponent = false; Vector2 mousePosition = this.ManageMouseClick( (hitUI) => { hitSomeUIComponent = true; }, (hit) => { buttonList.AddRange(hit.collider.gameObject.GetComponents <Button>()); interactableList.AddRange(hit.collider.gameObject.GetComponents <IInteractable>().Where(e => e.PlayerInteractWith).ToList()); }); if (hitSomeUIComponent || HasItemUnderTheCursor) { return; } IInteractable interactableChoice = interactableList.OrderBy(e => e.Order()).FirstOrDefault(); _canMove = interactableChoice is null && _canMove; _canMove = !buttonList.Any() && _canMove; MovementMouseComponent movementMouseComponent = _playerStateManager.GetActivePlayerStructure().GetMovementMouseComponent(); if (_canMove) { movementMouseComponent.ObjectGoToWalkContinuous(mousePosition); } } }