示例#1
0
    // 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);
        }
    }
示例#2
0
    // 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);
        }
    }
示例#3
0
 public Action(string name, ActionableGameObject owner, RaycastHit destination, Action nextAction) : this(name, owner, destination)
 {
     this.nextAction = nextAction;
 }
示例#4
0
 public Action(string name, ActionableGameObject owner, RaycastHit destination) : this(name, owner)
 {
     this.destination = destination;
 }
示例#5
0
 public Action(string name, ActionableGameObject owner)
 {
     this.name  = name;
     this.owner = owner;
 }