private void UpdateMiniMap() { if (!_miniMapList.Any()) { return; } List <PlayerStructureCollidingWIhtMapDTO> playerCollidingWithList = this.GetAllPlayerPositions(); foreach (MiniMapDTO miniMap in _miniMapList) { // => Update the Player Status List <PlayerStructureCollidingWIhtMapDTO> currentPlayerCollidingWithList = playerCollidingWithList.Where(e => e.MapInstanceId == miniMap.MapComponent.GetInstanceID()).ToList(); if (currentPlayerCollidingWithList.Any()) { List <int?> playersInstanceIdInMap = currentPlayerCollidingWithList.Select(e => e.PlayerStructureInstanceId).ToList(); List <PlayerStructure> playersInMap = _playerStructueList.Where(e => playersInstanceIdInMap.Contains(e.GetInstanceID())).ToList(); miniMap.HasPlayer = playersInMap.Any(e => e.IsMainPlayer); miniMap.HasPoop = playersInMap.Any(e => !e.IsMainPlayer); } else { miniMap.HasPlayer = false; miniMap.HasPoop = false; } // => Update the Map HP DamageTakerComponent damageTakerComponent = miniMap.MapComponent.GetComponent <DamageTakerComponent>(); miniMap.HpPercentage = damageTakerComponent.HealthPercenage; _miniMapDrawerComponent.DrawMiniMap(miniMap); } }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { _isAttacking = false; _damageDealerComponent = animator.GetComponentInParent <DamageDealerComponent>(); _interactableComponent = animator.GetComponentInParent <InteractableComponent>(); _damageTakerComponent = animator.GetComponentInParent <DamageTakerComponent>(); }
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() { _hasTurnedIntoAMob = false; _damageDealerComponent = this.GetComponent <DamageDealerComponent>(); _mobAnimator = this.GetComponent <Animator>(); _damageTakerComponent = this.GetComponent <DamageTakerComponent>(); }
public void StartAtackAnimation(DamageTakerComponent damageTakerComponent) { if (!_canDealDamage) { return; } _enemyDamageTaker = damageTakerComponent; if (_animator != null) { _animator.SetTrigger(_animatorVariables.Attack); } }
private void Attack(Collider2D collision) { DamageTakerComponent damageTakerComponent = collision.gameObject.GetComponentInParent <DamageTakerComponent>(); if (damageTakerComponent == null) { return; } if (damageTakerComponent.GetInstanceID() != _interactableInstanceId) { return; } DamageDealerComponent damageDealer = this.GetComponent <DamageDealerComponent>(); damageTakerComponent.StartDefenseOperation(damageDealer); }
protected override void SetInitialValues() { _animator = this.GetComponent <Animator>(); _damageTaker = this.GetComponentInParent <DamageTakerComponent>(); _animatorVariables = new MapAnimatorVariables(); }
protected override void SetInitialValues() { _damageDealerComponent = this.GetComponentInChildren <DamageDealerComponent>(); _bossAnimator = this.GetComponent <Animator>(); _damageTakerComponent = this.GetComponent <DamageTakerComponent>(); }