/// <summary> /// Ends the current subscription and returns control back to the input manager! /// </summary> public void EndCurrentSubscription() { GameInputSubscriberStack stack = this._subscribers.Pop(); stack.Delegates.Clear(); stack.Behaviour = null; }
/// <summary> /// Ends the current subscription and returns control back to the input manager! /// </summary> public void EndSubscriptionStack() { Assert.IsNotNull(this._currentInputStack, "Calling EndSubscriptionStack without ever calling Begin!"); this._subscribers.Push(this._currentInputStack); this._currentInputStack = null; }
/// <summary> /// Called whenever a touch click occurred! /// </summary> /// <param name="position"></param> void Evt_OnHandleTouchClick(Vector3 position) { if (this._subscribers.Count == 0) { return; } GameInputSubscriberStack subscriber = _subscribers.Peek(); if (subscriber.Delegates.ContainsKey(GameInputType.Click)) { subscriber.Delegates[GameInputType.Click].DynamicInvoke(position); } }
/// <summary> /// Begins a new subscription stack for a specific class. Please /// note that you will have to call end current subscription, too. /// </summary> /// <param name="behaviour">The object that should be registered</param> public void BeginSubscriptionStack(object behaviour) { Assert.IsNull(this._currentInputStack, "Calling BeginSubscriptionStack without ever calling End!"); this._currentInputStack = new GameInputSubscriberStack(); this._currentInputStack.Behaviour = behaviour; }