Ejemplo n.º 1
0
        // [SerializeField] Sprite sprite;

        void OnMouseUp()
        {
            if (selected == this)
            {
                return;
            }

            if (selected == null && gameObject.name == "Grass")
            {
                return;
            }

            Debug.Log($"# Selection # {gameObject.name} clicked");

            ClearSelection();

            Tower tower = GetComponent <Tower>();

            if (tower != null)
            {
                TowerClickedEvent?.Invoke(tower);
                selected = this;
                return;
            }

            BuildPlace buildPlace = GetComponent <BuildPlace>();

            if (buildPlace != null)
            {
                BuildPlaceClickedEvent?.Invoke(this, buildPlace.ConstructDataList);
                selected = this;
                return;
            }

            Wizard wizard = GetComponent <Wizard>();

            if (wizard != null)
            {
                WizardClickedEvent?.Invoke(wizard);
                selected = this;
                return;
            }
        }
Ejemplo n.º 2
0
 private void OnMouseDown()
 {
     //Debug.Log("Tower ID: " + gameObject.ToString() + " was clicked!");
     TowerClickedEvent?.Invoke(this, new TowerV2RefEventArgs(this));
 }