Beispiel #1
0
    void Shoot()
    {
        Vector3    direction  = (transform.position - currentTarget.position).normalized;
        Projectile projectile = Instantiate(projectilePrefab, transform.position, Quaternion.identity);

        projectile.Initialize(currentTarget, projectileSpeed);
        pulse.Pulse();
        SoundManager.main.PlaySound(SoundType.PlayerShoot);
    }
Beispiel #2
0
 void TakeDamage()
 {
     health -= 1;
     animateShader.Pulse();
     if (health <= 0)
     {
         health = 0;
         Die();
     }
     SoundManager.main.PlaySound(SoundType.Hurt);
 }
Beispiel #3
0
 void Shoot()
 {
     Debug.Log("Distance: " + Vector3.Distance(transform.position, target.position) + "(" + minShootDistance + ") -> " + name);
     if (Vector3.Distance(transform.position, target.position) < minShootDistance)
     {
         EnemyProjectile projectile = Instantiate(projectilePrefab);
         SoundManager.main.PlaySound(SoundType.EnemyShoot);
         projectile.transform.position = transform.position;
         projectile.Initialize(target, 5f);
         animateShader.Pulse();
     }
 }