예제 #1
0
    private void Attack()
    {
        Blaster attack = Instantiate(Resources.Load("Projectiles/Blaster", typeof(Blaster)) as Blaster) as Blaster;

        attack.transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + 1f);
        attack.GetComponent <Rigidbody>().velocity = new Vector3(0f, 0f, 2f * attack.movementSpeed);
        attack.GetComponent <Blaster>().owner      = transform;
        GetComponent <AudioSource>().Play();
        attackCooldown = 15;
    }
예제 #2
0
    private void Attack()
    {
        if (!targetFound)
        {
            return;
        }

        //target = Movement.Instance().transform.position;

        Blaster attack = Instantiate(Resources.Load("Projectiles/EnemyBlaster", typeof(Blaster)) as Blaster) as Blaster;

        attack.transform.position    = gun.transform.position;
        attack.transform.eulerAngles = new Vector3(90f, transform.eulerAngles.y, 0f);
        attack.GetComponent <Rigidbody>().velocity = 16f * transform.forward;
        attack.GetComponent <Blaster>().owner      = transform;

        if (gameObject != null)
        {
            GetComponent <AudioSource>().Play();
        }
        cooldown = 45;
    }