using UnityEngine; using System.Collections; using System.Collections.Generic; namespace R0bbie.Timeline { [AddComponentMenu("Timeline/Commands/Destroy GameObjects (Step Command)")] [RequireComponent(typeof(Step))] public class DestroyObjectsCmd : StepCmd { [SerializeField] private List objectsToDestroy = new List(); /// /// Initialise command (called before Activate) /// protected override void Init() { init = true; } public override void Activate(Step _parentStep) { base.Activate(_parentStep); // Loop through and destroy all objects foreach (GameObject go in objectsToDestroy) { if (go != null) Destroy(go); } // Then job of this command is done, complete it and deactivate Complete(); } protected override void Cleanup() { } } }