46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
|
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<GameObject> objectsToDestroy = new List<GameObject>();
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Initialise command (called before Activate)
|
|||
|
/// </summary>
|
|||
|
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()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|