// If the parameter is in the map, removes the mapping from the map and unsubscribes the ActionableGameObject. public void Unsubscribe(ActionableGameObject owner) { if (eventMap.ContainsKey(owner)) { ActionEvent actionEvent; eventMap.TryGetValue(owner, out actionEvent); eventMap.Remove(owner); UnityAction <Action> callback = owner.OnActionEvent; actionEvent.RemoveListener(callback); } }
// If the parameter is not already in the map, adds the ActionableGameObject-ActionEvent pair to the map with a new ActionEvent. Then subscribes the ActionableGameObject to the ActionEvent. public void Subscribe(ActionableGameObject owner) { ActionEvent actionEvent; if (!eventMap.ContainsKey(owner)) { actionEvent = new ActionEvent(); eventMap.Add(owner, actionEvent); UnityAction <Action> callback = owner.OnActionEvent; actionEvent.AddListener(callback); } }
public Action(string name, ActionableGameObject owner, RaycastHit destination, Action nextAction) : this(name, owner, destination) { this.nextAction = nextAction; }
public Action(string name, ActionableGameObject owner, RaycastHit destination) : this(name, owner) { this.destination = destination; }
public Action(string name, ActionableGameObject owner) { this.name = name; this.owner = owner; }