private void Awake() { _currentHealth = _healthConfigSO.MaxHealth; if (_setHealthBar != null) { _setHealthBar.RaiseEvent(_currentHealth); } }
[SerializeField] private GameResultChannelSO _gameResultEvent; //picked up by UI Manager private void Start() { _cc = GetComponent <CharacterController>(); _playerController = GetComponent <PlayerController>(); _animalSoundManager = GetComponent <AnimalSoundsManager>(); _currentHealth = MAX_HEALTH; _changeHealthUIEvent.RaiseEvent(_currentHealth); _currentCheckpoint = transform.position; }
public void ButtonClicked() { int idType = (int)_currentType; Debug.Log(idType); _buttonClickedEvent.RaiseEvent(idType); }
void UseItem(ItemSO itemToUse) { if (itemToUse.HealthResorationValue > 0) { _restoreHealth.RaiseEvent(itemToUse.HealthResorationValue); } _useItemEvent.RaiseEvent(itemToUse); UpdateInventory(); }
public void Init(CameraController controller, Vector3 rebirthVector) { SetCameraController(controller); _abilities.SetRebirthPoint(_rebirthVector = rebirthVector); _abilities.RebirthCharacter(); _inflictDamageEvent.OnEventRaised += ReceiveDamage; _inflictHealingEvent.RaiseEvent(3); }
public void Attack(Damageable damageableTemp) { if (CanAttack(_itemStatus.ItemState, damageableTemp)) { //damageable.ReceiveAnAttack(_attackConfigSO.AttackStrength); _inflictDamageEvent.RaiseEvent(_attackConfigSO.AttackStrength); damageableTemp.ResetGetHit(_attackConfigSO.AttackReloadDuration); } }
// void Update() {} // void FixedUpdate() {} void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == tagToDetect) { if (pickupEvent != null) { pickupEvent.RaiseEvent(gameObject.GetInstanceID()); } } }
/// <summary> Resets this hand by clearing card data. Warning! Will set CurrentlySelected to null. </summary> public void ResetHand() { for (int i = 0; i < _cards.Count; i++) { _cards[i] = null; } _selected = _cards[0]; _selectedIndex = 0; // Update the player visuals to reflect equipment changes if (PlayerVisuals != null) { PlayerVisuals.RaiseEvent(); } if (UICurrentCardChange != null) { UICurrentCardChange.RaiseEvent(_selectedIndex); } }
public void restoreHealth(int healthToAdd) { if (IsDead) { return; } _currentHealth += healthToAdd; if (_restoreHealth != null) { _restoreHealth.RaiseEvent(healthToAdd); } }
private void OnTriggerEnter(Collider other) { if (other.transform.tag == "Collectable") { collectableCount++; _changeScoreUIEvent.RaiseEvent(collectableCount); _animalSoundManager.PlayFishPickup(); Destroy(other.gameObject); } }
/* --------------------------------------- */ /* ---------------- Public --------------- */ /* --------------------------------------- */ /// <summary> Only used for shooting weapon cards. </summary> public void FireProjectile() { // Cant shoot if player not holding a gun if (pHand.CurrentlySelected == null) { return; } // If currently selected card is not of type "weapon" don't do anything if (pHand.CurrentlySelected.CardType != ItemType.weapon) { return; } // Type conversion to WeaponCardSO since not all cards can shoot... WeaponCardSO weaponCardRefr = pHand.CurrentlySelected as WeaponCardSO; /* * Might modify how projectile timing works. This currently allows for "full auto" weapon types * without instantiating like hundreds of projectiles in a fraction of a second since this function * could theoretically be called every single frame */ if ((Time.time - timeSinceLastAttack) >= weaponCardRefr.ROF) { // Cache time last fired weapon timeSinceLastAttack = Time.time; // Spawn the projectile to fire ProjectileHandler refr = LeanPool.Spawn <ProjectileHandler>(_projComponentRefr, _projSpawnLocation.position, _projSpawnLocation.rotation, _projParentObject.transform); // Set the ProjectileData for the spawned projectile refr._projData = weaponCardRefr.ProjectileData; if (UpdateProjectileData != null) { UpdateProjectileData.RaiseEvent(refr.gameObject.GetInstanceID()); } // Activate necessary events if (KnockbackEvent != null) { KnockbackEvent.RaiseEvent(); } if (CameraShakeEvent != null) { CameraShakeEvent.RaiseEvent(weaponCardRefr._camShakePreset); } } }
public void ReceiveAnAttack(int damage) { if (IsDead) { return; } if (_inflictDamage != null) { _inflictDamage.RaiseEvent(damage); } _currentHealth -= damage; GetHit = true; if (_currentHealth <= 0) { IsDead = true; if (OnDie != null) { OnDie.Invoke(); } } }
public void CollectableGathered() { _playerScore++; _playerScoreUI.RaiseEvent(_playerScore); }
public void Heal(Damageable damageable) { _inflictHealingEvent.RaiseEvent(_healingConfigSO.HealingStrength); }