Exemple #1
0
    /// <summary>
    /// Handle input for focus on spawnUnit.
    /// </summary>
    /// <param name="ctx">CallBackContext of input</param>
    /// <param name="spawnUnitTag">tag of the spawnUnit to focus</param>
    private void FocusCameraOnSpawnUnit(InputAction.CallbackContext ctx, string spawnUnitTag)
    {
        if (ECamState.Iso2D == m_cameraState)
        {
            return;
        }

        SpawnUnits spawnToFocus = GameManager.Instance.GetSpawnUnitForPlayer(GameManager.Instance.GetLocalPlayer(), spawnUnitTag);

        spawnToFocus.ShowUISpawnUnit();
        spawnToFocus.GetComponent <ObjectSelection>().OnMouseDown();
        double timer;

        if (spawnUnitTag == Constant.ListOfTag.s_spawnUnit1)
        {
            timer = m_timerDoubleTapSpawn1;
            m_timerDoubleTapSpawn1 = ctx.time;
            m_timerDoubleTapSpawn2 = 0;
        }
        else
        {
            timer = m_timerDoubleTapSpawn2;
            m_timerDoubleTapSpawn2 = ctx.time;
            m_timerDoubleTapSpawn1 = 0;
        }
        if (ctx.time > timer + m_timerDoubleTap)
        {
            return;
        }
        StartCoroutine(MoveCameraToPosition(spawnToFocus.gameObject.transform.position));
    }
Exemple #2
0
 /// <summary>
 /// Handle click on this button
 /// </summary>
 public virtual void TaskOnClick()
 {
     m_spawnUnits.GetComponent <ObjectSelection>().Select();
     GameManager.Instance.GetLocalPlayerEntity().SetSelectedItem(m_spawnUnits.GetComponent <ObjectSelection>());
     m_spawnUnits.ShowUISpawnUnit();
     OnSelection();
 }