Beispiel #1
0
    private void UpdatePlaceholders()
    {
        m_targetedCellPlaceholder = GetTargetedCellPlaceholder();
        bool targetingExistingCell = m_targetedCellPlaceholder != null;

        if (m_tempPlaceholder && m_tempPlaceholder.isActiveAndEnabled)
        {
            Cell tempCell = CellsManager.registeredCells[m_selectedCellIndex];
            m_tempPlaceholder.transform.position = PlayerCursor.singleton.targetPosition;
            m_tempPlaceholder.SetCell(tempCell);
            m_tempPlaceholder.cellRenderer.SetCellRenderingMode(tempCell.Affordable()? CellRenderingMode.Affordable : CellRenderingMode.NotAffordable);
            Vector3 flattenForward = GameManager.camera.transform.forward;
            flattenForward.y = 0;
            m_tempPlaceholder.transform.forward = flattenForward;
        }

        for (int i = 0; i < m_placeholders.Count; i++)
        {
            CellPlaceholder cellPlaceholder = m_placeholders[i];
            //bool displayAlt = targetingExistingCell ? targetedCellPlaceholder != cellPlaceholder : PlayerCursor.singleton.hasTarget;
            CellRenderingMode cellRenderingMode = CellRenderingMode.Default;
            if (targetingExistingCell)
            {
                if (m_targetedCellPlaceholder == cellPlaceholder)
                {
                    cellRenderingMode = CellRenderingMode.Selected;
                }
                else
                {
                    cellRenderingMode = CellRenderingMode.OtherSelected;
                }
            }
            else
            {
                if (PlayerCursor.singleton.hasTarget)
                {
                    cellRenderingMode = CellRenderingMode.OtherSelected;
                }
            }

            cellPlaceholder.cellRenderer.SetCellRenderingMode(cellRenderingMode);
        }
    }
Beispiel #2
0
    public void SetCellRenderingMode(CellRenderingMode mode)
    {
        Material material = m_defaultMaterial;

        switch (mode)
        {
        case CellRenderingMode.OtherSelected:
            material = m_otherSelectedMaterial;
            break;

        case CellRenderingMode.Selected:
            material = m_selectedMaterial;
            break;

        case CellRenderingMode.NotAffordable:
            material = m_notAffordableMaterial;
            break;

        case CellRenderingMode.Affordable:
            material = m_affordableMaterial;
            break;
        }
        m_renderer.material = material;
    }