Exemple #1
0
    void PointerUpHelper(Vector2Int gridIndex, TileType tileType)
    {
        // TODO: this check seems unnecessary
        if (!m_ToolsPalette.IsBoxActive())
        {
            return;
        }

        Vector2Int moveDir = gridIndex - m_StartIndex;

        m_StartIndex = gridIndex;

        int dirXMultiplier = moveDir.x <= 0 ? 1 : -1;
        int dirYMultiplier = moveDir.y <= 0 ? 1 : -1;

        for (int i = Mathf.Abs(moveDir.x); i >= 0; --i)
        {
            for (int j = Mathf.Abs(moveDir.y); j >= 0; --j)
            {
                var xIndex       = i * dirXMultiplier;
                var yIndex       = j * dirYMultiplier;
                var indexOffset  = new Vector2Int(xIndex, yIndex);
                var newGridIndex = m_StartIndex + indexOffset;
                AddRequest(newGridIndex, tileType, cloning: false);
            }
        }

        EndBatch();

        m_Outliner.Disable();
    }
Exemple #2
0
    //public override void RightPointerUp(ToolEvent te)
    //{
    //  if (m_State == State.SelectingForModification)
    //  {
    //    m_PointerDragEndPosition = te.GridIndex;

    //    Outline(m_ModificationOutliner);
    //    GatherSelectedElements();

    //    if (AllSelectedPathsMatch())
    //    {
    //      if (m_SelectedElements.Count == 0 || m_SelectedElements[0].GetComponent<PathMover>() == null)
    //      {
    //        EnterIdle();

    //        var message = "No path is selected, so there is nothing to modify";
    //        StatusBar.Print(message);
    //      }
    //      else
    //      {
    //        EnterReadyToModify();
    //      }
    //    }
    //    else
    //    {
    //      EnterIdle();

    //      var message = "Not all the selected elements have matching paths, " +
    //        "so there is no single path to modify";
    //      StatusBar.Print(message);
    //    }
    //  }
    //}


    void EnterIdle()
    {
        m_State            = State.Idle;
        m_SelectedElements = new List <TileGrid.Element>();

        if (m_AnchorIconTransform != null)
        {
            Destroy(m_AnchorIconTransform.gameObject);
        }
        if (m_NodeIcons != null)
        {
            ClearIcons();
        }

        m_CreationOutliner.Disable();
        m_ModificationOutliner.Disable();

        StatusBar.Print(m_SelectedStatus);
    }
Exemple #3
0
 void OnPlayModePreToggle(bool isInPlayMode)
 {
     m_Outliner.Disable();
 }