Exemple #1
0
    public void Fire(Vector3 direction)
    {
        if (m_canFire)
        {
            Debug.Log("Firing - " + Time.time);
            GameObject newProjectile = SpawningHelpers.InstantiateUnderWithIdentityTransforms(m_projectilePrefab, transform);
            newProjectile.transform.parent = null;
            //Debug.Log("fireDirection: " + direction);

            Projectile projectileBehaviour = newProjectile.GetComponent <Projectile> () as Projectile;
            projectileBehaviour.On(direction);
            foreach (string tag in m_bulletTags)
            {
                projectileBehaviour.AddTag(tag);
            }

            m_canFire = false;
            StartCoroutine(ResetCanFire());
        }
    }