21 lines
372 B
C#
21 lines
372 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class OneActionComponent : MonoBehaviour {
|
|
|
|
private Action action;
|
|
private bool hasAction = false;
|
|
|
|
public void SetAction(Action action){
|
|
hasAction = true;
|
|
this.action = action;
|
|
}
|
|
|
|
void Update(){
|
|
if(hasAction){
|
|
action();
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
}
|