protected virtual void EnemyHit(Collision other) { Vector3 hitSpeed = other.relativeVelocity; HostileResourceManager hostileResourceManager = other.gameObject.GetComponent <HostileResourceManager>(); if (hostileResourceManager == null) { hostileResourceManager = other.gameObject.GetComponentInParent <HostileResourceManager>(); } if (other.collider.name == "CritSpot") { Debug.Log(hostileResourceManager); onHitSoundSource.clip = onHitSounds[2]; onHitSoundSource.Play(); hostileResourceManager.GotHitOnCritSpot(baseDamage, other.contacts[0].point, hitSpeed); SpawnOnHitEffect(other.gameObject.transform, other.contacts[0], bleedEffect[1], hitSpeed); SpawnOnHitEffect(other.gameObject.transform, other.contacts[0], bleedEffect[3], hitSpeed); playerTideComboManager.AddCombo(); playerAimModule.critHit = true; playerAimModule.EnemyHit = true; return; } playerAimModule.EnemyHit = true; SpawnOnHitEffect(other.gameObject.transform, other.contacts[0], bleedEffect[0], hitSpeed); SpawnOnHitEffect(other.gameObject.transform, other.contacts[0], bleedEffect[2], hitSpeed); onHitSoundSource.clip = onHitSounds[1]; onHitSoundSource.Play(); hostileResourceManager.GotHit(baseDamage, other.contacts[0].point, hitSpeed); // playerTideComboManager.ResetCombo(); }
private void AreaDamage() { if (!gameObject.GetComponent <SphereCollider>().enabled) { gameObject.GetComponent <SphereCollider>().enabled = true; } influencedGameObjects = UpdateInfluenceList(); foreach (GameObject influencedGameObject in influencedGameObjects) { if (influencedGameObject.GetComponent <HostileResourceManager>() && influencedGameObject.GetComponent <HostileResourceManager>().enabled == true) { HostileResourceManager hostileResource = influencedGameObject.GetComponent <HostileResourceManager>(); hostileResource.CurrentHealth -= 2.5f; } } influencedGameObjects = UpdateInfluenceList(); }
protected override void EnemyHit(Collision other) { Vector3 hitSpeed = other.relativeVelocity; HostileResourceManager hostileResourceManager = other.gameObject.GetComponent <HostileResourceManager>(); //CritHit if (hostileResourceManager == null) { hostileResourceManager = other.gameObject.GetComponentInParent <HostileResourceManager>(); } hostileResourceManager.CurrentArmor -= 100; if (other.collider.name == "CritSpot") { onHitSoundSource.clip = onHitSounds[2]; onHitSoundSource.Play(); playerTideComboManager.AddCombo(); SpawnOnHitEffect(other.gameObject.transform, other.contacts[0], bleedEffect[1], hitSpeed); SpawnOnHitEffect(other.gameObject.transform, other.contacts[0], bleedEffect[3], hitSpeed); playerAimModule.critHit = true; playerAimModule.EnemyHit = true; if (hostileResourceManager.CurrentArmor != 0) { hostileResourceManager.CurrentArmor -= hostileResourceManager.maxArmor * 0.5f; return; } hostileResourceManager.GotHitOnCritSpot(baseDamage, other.contacts[0].point, hitSpeed); return; } //NormalHit playerAimModule.EnemyHit = true; SpawnOnHitEffect(other.gameObject.transform, other.contacts[0], bleedEffect[0], hitSpeed); SpawnOnHitEffect(other.gameObject.transform, other.contacts[0], bleedEffect[2], hitSpeed); onHitSoundSource.clip = onHitSounds[1]; onHitSoundSource.Play(); if (hostileResourceManager.CurrentArmor != 0) { hostileResourceManager.CurrentArmor -= hostileResourceManager.maxArmor * 0.34f; } hostileResourceManager.GotHit(baseDamage, other.contacts[0].point, hitSpeed); }
protected override void Initialize() { base.Initialize(); linkedResourceManager = transform.root.GetComponent <HostileResourceManager>(); }