void OnWaveChanged(XEventArgs args) { int waveNumber = args.GetData <int>(0); int timeToNextWave = args.GetData <int>(1); int wavesCount = args.GetData <int>(2); currentWaveText.text = waveNumber.ToString(); currentWaveFinishTime = timeToNextWave; maxWaveNumberText.text = wavesCount.ToString(); isStartWave = true; StartCoroutine("HighlightTimer"); }
/// <summary> /// Actions cancel handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void ActionCancel(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); if (obj == activeUserAction) { activeUserAction = null; highlightIcon.SetActive(false); myState = MyState.Active; } }
/// <summary> /// Action start handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void ActionStart(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); if (obj == activeUserAction) { activeUserAction = null; highlightIcon.SetActive(false); StartCooldown(); } }
/// <summary> /// Disable tower raycast and close building tree on game pause. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void GamePaused(XEventArgs args) { string param = args.GetData <string>(1); if (param == bool.TrueString) // Paused { CloseBuildingTree(); bodyCollider.enabled = false; } else // Unpaused { bodyCollider.enabled = true; } }
private void GameResult(XEventArgs args) { LevelState levelState = args.GetData <LevelState>(0); switch (levelState) { case LevelState.Win: GoToVictoryMenu(); break; case LevelState.Lose: GoToDefeatMenu(); break; } }
/// <summary> /// User click handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void UserClick(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); HideUnitInfo(); if (obj != null) { // Cliced object has info for displaing UnitInfo unitInfo = obj.GetComponent <UnitInfo>(); if (unitInfo != null) { ShowUnitInfo(unitInfo); } } }
/// <summary> /// User UI click handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void UserUiClick(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); if (obj == gameObject) // Clicked on this icon { if (myState == MyState.Active) { highlightIcon.SetActive(true); activeUserAction = Instantiate(userActionPrefab); myState = MyState.Highligted; } } else if (myState == MyState.Highligted) // Clicked on other UI { highlightIcon.SetActive(false); myState = MyState.Active; } }
/// <summary> /// On user click. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void UserClick(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); if (obj == gameObject) // This tower is clicked { // Show attack range ShowRange(true); // Open building tree if it is not OpenBuildingTree(); } else // Other click { // Hide attack range ShowRange(false); // Close active building tree CloseBuildingTree(); } }
/// <summary> /// User click handler. /// </summary> /// <param name="obj">Object.</param> /// <param name="param">Parameter.</param> private void UserClick(XEventArgs args) { GameObject obj = args.GetData <GameObject>(); if (myState == MyState.WaitForClick) { // If clicked not on tower if (obj == null || obj.CompareTag("Tower") == false) { // Create FX transform.position = (Vector2)Camera.main.ScreenToWorldPoint(Input.mousePosition); GameObject effect = Instantiate(effectPrefab, transform.position, Quaternion.identity); Destroy(effect, effectDuration); XEventBus.Instance.Post(EventId.ActionStart, new XEventArgs(gameObject)); // Start damege coroutine StartCoroutine(DamageCoroutine()); myState = MyState.WaitForFX; } else // Clicked on tower { Destroy(gameObject); } } }
void SkillHurt(XEventArgs args) { battleSystem.AddSkillAttackToBattleOrder(args.GetData <AttackData>(0)); }
private void GameResult(XEventArgs args) { battleSystem.ChangeLevelState(args.GetData <LevelState>(0)); }
private void AddCurrency(XEventArgs args) { int amount = args.GetData <int>(0); currency.AddCurrency(amount); }
private void UpdateGold(XEventArgs xEventArgs) { int gold = (int)xEventArgs.GetData <int>(); Debug.Log("TestOne UpdateGold:" + gold); }
public void OnCurrencyChanged(XEventArgs args) { int currentCurrency = args.GetData <int>(0); goldAmount.text = currentCurrency.ToString(); }