コード例 #1
0
ファイル: WavesTimer.cs プロジェクト: moto2002/DefenseGame
    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");
    }
コード例 #2
0
    /// <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;
        }
    }
コード例 #3
0
    /// <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();
        }
    }
コード例 #4
0
ファイル: BuildingTower.cs プロジェクト: moto2002/DefenseGame
    /// <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;
        }
    }
コード例 #5
0
    private void GameResult(XEventArgs args)
    {
        LevelState levelState = args.GetData <LevelState>(0);

        switch (levelState)
        {
        case LevelState.Win:
            GoToVictoryMenu();
            break;

        case LevelState.Lose:
            GoToDefeatMenu();
            break;
        }
    }
コード例 #6
0
ファイル: ShowInfo.cs プロジェクト: moto2002/DefenseGame
    /// <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);
            }
        }
    }
コード例 #7
0
    /// <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;
        }
    }
コード例 #8
0
ファイル: BuildingTower.cs プロジェクト: moto2002/DefenseGame
    /// <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();
        }
    }
コード例 #9
0
ファイル: AirStrike.cs プロジェクト: moto2002/DefenseGame
    /// <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);
            }
        }
    }
コード例 #10
0
ファイル: BattleField.cs プロジェクト: moto2002/DefenseGame
 void SkillHurt(XEventArgs args)
 {
     battleSystem.AddSkillAttackToBattleOrder(args.GetData <AttackData>(0));
 }
コード例 #11
0
ファイル: BattleField.cs プロジェクト: moto2002/DefenseGame
 private void GameResult(XEventArgs args)
 {
     battleSystem.ChangeLevelState(args.GetData <LevelState>(0));
 }
コード例 #12
0
    private void AddCurrency(XEventArgs args)
    {
        int amount = args.GetData <int>(0);

        currency.AddCurrency(amount);
    }
コード例 #13
0
ファイル: TestOne.cs プロジェクト: moto2002/DefenseGame
    private void UpdateGold(XEventArgs xEventArgs)
    {
        int gold = (int)xEventArgs.GetData <int>();

        Debug.Log("TestOne UpdateGold:" + gold);
    }
コード例 #14
0
    public void OnCurrencyChanged(XEventArgs args)
    {
        int currentCurrency = args.GetData <int>(0);

        goldAmount.text = currentCurrency.ToString();
    }