Example #1
0
    public override void DoBasicAttack()
    {
        GameObject magicBoltInstance = Instantiate(magicBolt, movement.transform.position + movement.transform.right * 0.5f + movement.transform.forward * 1.5f + movement.transform.up * 1.1f,
                                                   Quaternion.LookRotation(movement.transform.forward, new Vector3(0.0f, 1.0f, 0.0f))) as GameObject;
        DamageProjectile script = magicBoltInstance.GetComponent <DamageProjectile>();

        script.SetDirection(movement.transform.forward);
    }
    private void SpawnArrow()
    {
        GameObject movingArrow = Instantiate(arrow, transform.position + transform.forward + transform.up * 1.7f,
                                             Quaternion.LookRotation(transform.forward, new Vector3(1.0f, 0.0f, 0.0f)) * Quaternion.Euler(90.0f, 0.0f, 0.0f)) as GameObject;
        DamageProjectile script = movingArrow.GetComponent <DamageProjectile>();

        script.SetDirection(transform.forward);
        script.SetDamage(damage);
    }
Example #3
0
    public void SpawnArrow()
    {
        GameObject movingArrow = Instantiate(arrow, playerMovement.transform.position + playerMovement.transform.forward * 0.7f + playerMovement.transform.up * 1.35f,
                                             Quaternion.LookRotation(playerMovement.transform.forward, new Vector3(1.0f, 0.0f, 0.0f)) * Quaternion.Euler(90.0f, 0.0f, 0.0f)) as GameObject;
        DamageProjectile script = movingArrow.GetComponent <DamageProjectile>();

        script.SetDamage(baseDamage);
        script.SetSpeed(arrowSpeed);
        script.SetDirection(playerMovement.transform.forward);
    }
Example #4
0
    private void Damage(DamageProjectile damageProjectile)
    {
        healthEnemy -= damageProjectile.GetDamage();
        damageProjectile.Hit();

        if (healthEnemy <= 0)
        {
            DieEnemy();
        }
    }
Example #5
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        DamageProjectile damageProjectile = other.GetComponent <DamageProjectile>();

        if (!damageProjectile)
        {
            return;
        }
        Damage(damageProjectile); //ProcessHit
    }
Example #6
0
    public override void DoAttack()
    {
        Vector3    arrowDirection = target.position - position.position;
        GameObject movingArrow    = Instantiate(arrow, position.position + position.forward * 0.7f + position.up * 1.5f,
                                                Quaternion.LookRotation(arrowDirection, new Vector3(1.0f, 0.0f, 0.0f)) * Quaternion.Euler(90.0f, 0.0f, 0.0f)) as GameObject;
        DamageProjectile script = movingArrow.GetComponent <DamageProjectile>();

        script.SetDamage(damage);
        script.SetDirection(movingArrow.transform.up);
    }
Example #7
0
    private void Damage(DamageProjectile damageProjectile)
    {
        healthMeteorite -= damageProjectile.GetDamage();
        damageProjectile.Hit();

        if (healthMeteorite <= 0)
        {
            DieMeteorite();
        }
    }
Example #8
0
    public override void DoAttack()
    {
        Vector3    spellDirection   = target.position - position.position;
        GameObject fireballInstance = Instantiate(fireball, position.position + position.forward * 2.0f + position.up * 1.1f,
                                                  Quaternion.LookRotation(spellDirection, new Vector3(0.0f, 1.0f, 0.0f))) as GameObject;
        DamageProjectile script = fireballInstance.GetComponent <DamageProjectile>();

        script.SetDamage(damage);
        script.SetOwner(ProjectileOwner.Enemy);
        script.SetDirection(fireballInstance.transform.forward);
    }
Example #9
0
    public void SpawnArrowFan()
    {
        for (int i = -2; i < 3; i++)
        {
            GameObject movingArrow = Instantiate(arrow, playerMovement.transform.position + playerMovement.transform.forward * 0.7f + playerMovement.transform.up * 1.35f,
                                                 Quaternion.LookRotation(playerMovement.transform.forward, new Vector3(1.0f, 0.0f, 0.0f)) * Quaternion.Euler(90.0f, 0.0f, 0.0f) * Quaternion.Euler(i * 25.0f, 0.0f, 0.0f)) as GameObject;

            if (playerMovement.transform.forward == Vector3.right || playerMovement.transform.forward == Vector3.left)
            {
                movingArrow.transform.rotation = Quaternion.LookRotation(playerMovement.transform.forward, new Vector3(1.0f, 0.0f, 0.0f)) * Quaternion.Euler(90.0f, 0.0f, 0.0f) * Quaternion.Euler(0.0f, 0.0f, i * 25.0f);
            }

            DamageProjectile script = movingArrow.GetComponent <DamageProjectile>();
            script.SetDamage(baseDamage * 1.2f);
            script.SetSpeed(arrowSpeed);
            script.SetDirection(movingArrow.transform.up);
        }
    }