Пример #1
0
        public bool StartCombat(DamageDealerComponent damageDealer)
        {
            if (!_readyToCombat)
            {
                return(false);
            }

            PlayerStructure playerStructure = _playerState.GetActivePlayerStructure();

            InteractableComponent interactableComponent = playerStructure.GetInteractableComponent();

            if (interactableComponent is null)
            {
                return(false);
            }
            if (!interactableComponent.CheckIfCanAtack())
            {
                return(false);
            }

            damageDealer.event_AlertAttack.Invoke();
            interactableComponent.SetInteractableState(EnumInteractableState.Atack, this.GetInstanceID());

            // Go to the correct position to attack
            playerStructure.GetMovementMouseComponent().ObjectGoTo(this.transform.position, _colliderToStopMovement.GetInstanceID());

            return(true);
        }
Пример #2
0
        public void Btn_TakeSeed()
        {
            PlayerStructure       playerStructure       = _playerState.GetActivePlayerStructure();
            InteractableComponent interactableComponent = playerStructure.GetInteractableComponent();

            this.IniciateSomeInteraction(EnumInteractableState.TakeSeed, playerStructure, interactableComponent);
        }
Пример #3
0
        public bool PickUp()
        {
            if (_playerState.PlayerIsDoingSomeAction)
            {
                return(false);
            }

            _playerState.GetActivePlayerStructure().GetMovementMouseComponent().ObjectGoTo(this.transform.position, _radioToPickup);
            _playerState.GetActivePlayerStructure().GetInteractableComponent().SetInteractableState(Interactable.EnumInteractableState.PickupItem, this.GetInstanceID());

            return(true);
        }
Пример #4
0
        private void ManageMouseOver()
        {
            InteractableComponent interactableComponent = _playerStateManager.GetActivePlayerStructure().GetInteractableComponent();

            if (interactableComponent is null)
            {
                return;
            }

            this.ManageMouseClick((hitUI) =>
            {
            },
                                  (hit) =>
            {
                IPlantable plantable = hit.collider.gameObject.GetComponent <IPlantable>();
                plantable?.MouseOver(true);
            });
        }