Example #1
0
    //public void PrimeProjectile()
    //{
    //    if (!gameObject.activeSelf)
    //        gameObject.SetActive(true);

    //    isPrimed = true;
    //    StartCoroutine(DestroyProjectile(ProjectileLifetime));
    //}

    protected void InitializeProjectile()
    {
        OnProjectileSpawned.Invoke();

        if (isRocket && profile.rocketProfile != null)
        {
            if (rocket == null)
            {
                rocket = new RocketEffect();
            }

            rocket.Initialize(this.gameObject, profile.rocketProfile);

            if (rocket.IgnitionDelay == 0)
            {
                rocket.Ignite();
            }

            StartCoroutine(rocket.UpdateRocket(projectileBody));
        }

        if (isExplosive && profile.explosiveProfile != null)
        {
            if (explosive == null)
            {
                explosive = new ExplosiveEffect();
            }

            explosive.Initilize(this.gameObject, profile.explosiveProfile);
            OnProjectileDestroyed.AddListener(explosive.Detonate);
        }

        if (profile.SoundGroupName.Length > 0 && isClient)
        {
            DarkTonic.MasterAudio.MasterAudio.PlaySound3DAtTransform(profile.SoundGroupName, this.transform);
        }
    }