Exemplo n.º 1
0
    void ProcessCollider(Collider2D _collider, Touch _touch)
    {
        ITouchProcessor touchProcessor = _collider.GetComponent <ITouchProcessor>();

        touchProcessor?.OnTouch(_touch);
        if (touchProcessor != null)
        {
            touchProcessor.OnTouch(_touch);
        }
        else
        {
            TouchOnTheScreen?.Invoke(_touch);
        }
    }
Exemplo n.º 2
0
    public void Awake()
    {
        // Create a dictionary linking touch ids to touch objects
        touches = new Dictionary <int, TouchInfo>();

        // Creates the InputProcessors responsible for receiving input events
        combatProcessor = new CombatTouchProcessor();

        // The currently activate TouchProcessor which receives input events and modifies game state
        touchProcessor = this.combatProcessor;

        // Cycles through all of the possible touch ids that can exist
        for (int id = 0; id < MAX_TOUCHES; id++)
        {
            // Creates a data container for each possible touch id
            touches.Add(id, new TouchInfo(id));
        }
    }