Example #1
0
        private void IniciateSomeInteraction(EnumInteractableState interactionState, PlayerStructure playerStructure, InteractableComponent interactableComponent)
        {
            if (interactableComponent is null)
            {
                return;
            }

            interactableComponent.SetInteractableState(interactionState, this.GetInstanceID());
            playerStructure.GetMovementMouseComponent().ObjectGoTo(this.transform.position, _radioToInteract);
        }
Example #2
0
        public void SetInteractableState(EnumInteractableState interactableState, int instanceId)
        {
            if (!ValidateIfPlayerCanDoThings(interactableState))
            {
                return;
            }

            _currentInteractableState = interactableState;
            _interactableInstanceId   = instanceId;
        }
Example #3
0
        protected override void SetInitialValues()
        {
            _inputManager             = GameObject.FindObjectOfType <InputManager>();
            _playerStateManager       = GameObject.FindObjectOfType <PlayerStateManager>();
            _uiManager                = GameObject.FindObjectOfType <UIManager>();
            _animator                 = this.GetComponent <Animator>();
            _currentInteractableState = EnumInteractableState.Nothing;
            _stomachComponent         = this.GetComponent <StomachComponent>();

            _animatorVariables = new InteractableAnimatorVariables();
        }
Example #4
0
        private bool ValidateIfPlayerCanDoThings(EnumInteractableState interactableState)
        {
            if (!_canPickupItem && interactableState == EnumInteractableState.PickupItem)
            {
                Debug.LogError("You cannot pickup any item!");
                return(false);
            }

            if (!_canPlant && interactableState == EnumInteractableState.Plant)
            {
                Debug.LogError("You cannot plant any item!");
                return(false);
            }

            if (!_canTakeSeed && interactableState == EnumInteractableState.TakeSeed)
            {
                Debug.LogError("You cannot take this seed!");
                return(false);
            }

            if (!_canTakePlant && interactableState == EnumInteractableState.TakeFlower)
            {
                Debug.LogError("You cannot take this flower!");
                return(false);
            }

            if (!_canEat && interactableState == EnumInteractableState.EatFlower)
            {
                Debug.LogError("You cannot eat Flower!");
                return(false);
            }
            ;

            if (!_canAttack && interactableState == EnumInteractableState.Atack)
            {
                Debug.LogError("You cannot Atack!");
                return(false);
            }

            return(true);
        }
Example #5
0
 public void RemoveInteractableState()
 {
     _currentInteractableState = EnumInteractableState.Nothing;
     _interactableInstanceId   = null;
     _animatorVariables.ResetAuxiliarObjects();
 }