void IncreaseHealth() { Debug.Log("won"); fightInProgress = false; WoodController.AttackWithWood(); // do zmiany Łukaszku //health++; // actually why would you get hp for won battle? }
// Start is called before the first frame update private void Awake() //как только компонент загрузится { if (WoodController.instanceTree != null) //если этот объект уже есть, то не надо создавать новый { Destroy(this); //gameObject того объекта, который случайно создался return; } WoodController.instanceTree = this; //DontDestroyOnLoad(this); //чтобы при переходе с одной сцены на другую }
void DecreaseHealth() { Debug.Log("lost"); fightInProgress = false; health--; WoodController.Pac(); // do zmiany Łukaszku if (health <= 0) { fightInProgress = false; LostTheWholeBattle(); } }
private void OnDestroy() { WoodController.instanceTree = null; //при удалении }