void OnTriggerEnter(Collider col) { Enemyhp ehp = col.gameObject.GetComponent <Enemyhp>(); if (col.gameObject.tag == "Enemy") { ehp.damage(PlayerDamageValues.Instance.FrostAOEExplodeDamge, AttackType.Frost); //GameObject.FindGameObjectWithTag("Player").GetComponent<FinisherMode>().IncreaseFinisherMeter(PlayerDamageValues.Instance.FlameThrowFinMeterFill); col.gameObject.GetComponent <EnemyMovementController>().HelpKnockback(); } else if (col.gameObject.tag == "TargetDummy") { //GameObject.FindGameObjectWithTag("Player").GetComponent<FinisherMode>().IncreaseFinisherMeter(PlayerDamageValues.Instance.FlameThrowFinMeterFill); ehp.damage(PlayerDamageValues.Instance.FrostAOEExplodeDamge, AttackType.Frost); } }
void Shoot() { if (currentBullet <= 0) { return; } timer = 0f; gunAudio.Play(); gunLight.enabled = true; gunParticles.Stop(); gunParticles.Play(); gunLine.enabled = true; gunLine.SetPosition(0, transform.position); // Set the shootRay so that it starts at the end of the gun and points forward from the barrel. shootRay.origin = transform.position; shootRay.direction = -transform.right; // Perform the raycast against gameobjects on the shootable layer and if it hits something... if (Physics.Raycast(shootRay, out shootHit, range, shootableMask)) { Enemyhp enemyhp = shootHit.collider.GetComponent <Enemyhp>(); if (enemyhp.currentHp != null) { enemyhp.TakeDamage(damagePerShot); } gunLine.SetPosition(1, shootHit.point); } // If the raycast didn't hit anything on the shootable layer... else { // ... set the second position of the line renderer to the fullest extent of the gun's range. gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range); } currentBullet--; }
void OnTriggerEnter(Collider col) { if (col.gameObject.tag.Equals("Enemy")) { if (CurrentAttackType == AttackType.NormalBlade) { finisherObject.IncreaseFinisherMeter(PlayerDamageValues.Instance.NormalAttackFinMeterFill); } else { finisherObject.IncreaseFinisherMeter(PlayerDamageValues.Instance.ElementalSwordAttackFinMeterFill); } Enemyhp e = null; if ((e = col.GetComponent <Enemyhp>()) != null) { if (isHeavy) { e.damage(currentSwordDamage * 1.5f, AttackType.HeavyBlade); } else { e.damage(currentSwordDamage, CurrentAttackType); } Debug.Log(gameObject); } } else if (col.gameObject.tag.Equals("TargetDummy")) { finisherObject.IncreaseFinisherMeter(PlayerDamageValues.Instance.NormalAttackFinMeterFill); Enemyhp e = null; if ((e = col.GetComponent <Enemyhp>()) != null) { if (isHeavy) { e.damage(currentSwordDamage * 2f, AttackType.HeavyBlade); } else { e.damage(currentSwordDamage, CurrentAttackType); } } } }
void Start() { PlayerHp = GameObject.Find("Player").GetComponent <Hpbar>(); anim = GetComponent <Animator>(); zombiehp = GetComponent <Enemyhp>(); }