public void SetFireDelay()
    {
        GameObject     projectile = ProjectilePrototypes.FirstOrDefault(it => it.Type == CurrentProjectile).Prefab;
        BallisticProps ballistic  = projectile.GetComponent <BallisticProps> ();

        fireDelay = ballistic.fireDelay;
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        // Set speed of projectile
        ballistic = GetComponent <BallisticProps> ();
        speed     = ballistic.speed;

        // Play sound of projectile shooting
        audioSource = GetComponent <AudioSource>();
        AudioClip audioClip = ballistic.audioClip;

        audioSource.PlayOneShot(audioClip);
        Debug.Log("Playing projectile audio clip");

        // Set mass of projectile
        rb      = GetComponent <Rigidbody2D>();
        rb.mass = ballistic.mass;

        // Set direction of projectile from transform angle
        angle = Mathf.Deg2Rad * transform.rotation.eulerAngles.z;
        dir   = new Vector3(Mathf.Cos(angle), Mathf.Sin(angle), 0.0f);
    }