Beispiel #1
0
    protected void OnDeselect(IEventBase eventBase)
    {
        DeselectEvent ev = eventBase as DeselectEvent;

        if (ev != null)
        {
            selected = false;
            Debug.Log("I'm deselected: " + gameObject.name);
        }
    }
Beispiel #2
0
 private void Activate()
 {
     Debug.Log("process toggle aaa");
     Init();
     if (_toggle.isOn)
     {
         SelectEvent.Invoke(this);
     }
     else
     {
         DeselectEvent.Invoke(this);
     }
 }
Beispiel #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
                });
            }
        }
    }
Beispiel #4
0
    private void DeselectUnits()
    {
        DeselectEvent ev = new DeselectEvent();

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