Ejemplo n.º 1
0
    protected void OnDeselect(IEventBase eventBase)
    {
        DeselectEvent ev = eventBase as DeselectEvent;

        if (ev != null)
        {
            selected = false;
            Debug.Log("I'm deselected: " + gameObject.name);
        }
    }
Ejemplo n.º 2
0
 private void Activate()
 {
     Debug.Log("process toggle aaa");
     Init();
     if (_toggle.isOn)
     {
         SelectEvent.Invoke(this);
     }
     else
     {
         DeselectEvent.Invoke(this);
     }
 }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            if (DeselectEvent != null)
            {
                DeselectEvent.Invoke(this, null);
            }

            var rayPos = new Vector2(Camera.main.ScreenToWorldPoint(Input.mousePosition).x,
                                     Camera.main.ScreenToWorldPoint(Input.mousePosition).y);
            var hit = Physics2D.Raycast(rayPos, Vector2.zero, 0f);
            if (hit)
            {
                var charSelected = hit.transform.GetComponentInChildren <PlayerCharacter>();
                if (charSelected)
                {
                    charSelected.Select();
                }
            }
        }
        if (Input.GetMouseButtonDown(1))
        {
            var rayPos            = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            var hit               = Physics2D.Raycast(rayPos, Vector2.zero, 0f);
            var targetedCharacter = !hit ? null : hit.transform.GetComponentInChildren <Character>();
            if (AbilityCastEvent != null)
            {
                AbilityCastEvent.Invoke(this, new AbilityCastEventArgs
                {
                    //Position = Camera.main.ScreenToWorldPoint(Input.mousePosition),
                    TargetEnemy       = FindObjectOfType <BossCharacter>(),
                    TargetedCharacter = targetedCharacter
                });
            }
        }
    }
Ejemplo n.º 4
0
    private void DeselectUnits()
    {
        DeselectEvent ev = new DeselectEvent();

        EventAggregator.Publish(ev);
    }
Ejemplo n.º 5
0
 public void Deselect()
 {
     DeselectEvent?.Invoke();
     selected?.Deselect();
     selected = null;
 }
 public void OnDeselect(BaseEventData eventData)
 {
     _selected = false;
     DeselectEvent.Invoke(this);
 }
Ejemplo n.º 7
0
 public DeselectPathEvent(DeselectEvent srcEvent) : base(srcEvent)
 {
 }
Ejemplo n.º 8
0
 void OnDeselectEvent(DeselectEvent e)
 {
     this.Deselect();
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Play the deselect sound.
 /// </summary>
 public void PlayDeselect()
 {
     DeselectEvent.Raise();
 }