// Detach all tank decoration objects
 public void DetachDecorations()
 {
     for (int i = 0; i < m_AttachedDecorations.Count; i++)
     {
         Decoration decoration = m_AttachedDecorations[i];
         if (decoration != null)
         {
             decoration.Detach();
         }
     }
 }
Exemple #2
0
        /// <summary>
        /// When the create is destroyed
        /// </summary>
        protected override void OnDied()
        {
            // Spawn decoration debris
            Decoration spawnedPrefab = Instantiate <Decoration>(cratePrize.decorationPrefab);

            spawnedPrefab.Detach();
            spawnedPrefab.transform.position = transform.position + Vector3.up;
            spawnedPrefab.SetMaterial(cratePrize.availableMaterials[decorationMaterialIndex]);

            if (ExplosionManager.s_InstanceExists)
            {
                ExplosionManager.s_Instance.SpawnExplosion(transform.position, Vector3.up, null, -1, m_ExplosionDefinition, false);
            }

            base.OnDied();
        }