//Metoda jest wywoływana w momencie zaznaczenia jednostki public virtual void OnUnitSelected() { uiManager = FindObjectOfType <UiManager>(); scorePanelControll = FindObjectOfType <ScorePanelControll>(); SetState(new UnitStateMarkedAsSelected(this)); if (UnitSelected != null) { UnitSelected.Invoke(this, new EventArgs()); } if (Cell.Forest || Cell.Spikes || Cell.Temple) { scorePanelControll.UpgadeParameters(this); } else { scorePanelControll.RestEvents(); } uiManager.ActiveScorePanel(); scorePanelControll.UpgradeMovment(this); if (Cell != null && Cell.Spikes == true) { audioManager.Play("Lava"); Debug.Log("Zadano Obrazenia"); HitPoints -= DamageSpikeParameterUnit; Debug.Log("Obecne Zdrowie: " + HitPoints + " Zadane Obrazenia: " + DamageSpikeParameterUnit); if (HitPoints <= 0) { OnDestroyed(); } } }
private void OnMouseDown() { if (uiManager.isStart == false) { if (isSelected == false) { if (playerNumber == cellGrid.CurrentPlayerNumber) { audioManager.Play("SelectUnit"); foreach (var item in FindObjectsOfType <NumberUnit>()) { item.GetComponent <NumberUnit>().isSelected = false; } isSelected = true; uiManager.ActiveScorePanel(); scorePanelControll.TakeUnit(gameObject); } } } }