private void Update() { //laser collided with source if (frame < 0) { Debug.Log(source.name + " was killed by own laser."); source.ClearActions(); source.Kill(); frame = 0; gameObject.SetActive(false); return; } //laser collided with target if (Vector3.Dot(destination - transform.position, direction) <= 0) { Debug.Log(source.name + "'s laser damaged " + target.name + " for " + DAMAGE_AMOUNT + " points of damage."); target.Damage(DAMAGE_AMOUNT); frame = 0; gameObject.SetActive(false); } else { //move laser frame += mult; transform.position += mult * direction; } }
protected override bool AttackAction(AEntity entity) { if (!RotateAction(entity.gameObject.transform.position)) { return(false); } if (currentAttackFrame == -1) { Debug.Log("Boss is attacking"); animator.SetTrigger("Attack1Trigger"); currentAttackFrame = 0; audioSource.Play(); return(false); } else if (currentAttackFrame < TOTAL_ATTACK_FRAMES) { if (currentAttackFrame == ATTACK_POINT1 || currentAttackFrame == ATTACK_POINT2) { entity.Damage(DAMAGE_ON_ATTACKED_ENTITY); } currentAttackFrame++; return(false); } else { currentAttackFrame = -1; return(true); } }
void Update() { if (testSubject.GetStatus() == AEntity.Status.Dead || testSubject.GetStatus() == AEntity.Status.Dead) { return; } float collisionDistance = player.CalculateWeaponPenetration(testSubject); if (debugText) { debugText.text = collisionDistance.ToString(); } if (collisionDistance > 0) { testSubject.Damage(testDamage); } }