Пример #1
0
    void EditCell(HexCell cell)
    {
        if (cell)
        {
            if (applyColour)
            {
                cell.Colour = activeColor;
            }
            if (applyElevation)
            {
                cell.Elevation = activeElevation;
            }
            else if (isDrag)
            {
                HexCell otherCell = cell.GetNeighbor(dragDirection.Opposite());
                if (cell)
                {
                    cell.ClearCellFeatures();
                    if (spawnFeatures)
                    {
                        GameObject tempFeature = Instantiate(Resources.Load(activePrefab),
                                                             cell.gameObject.transform.position, Quaternion.identity) as GameObject;
                        tempFeature.transform.SetParent(cell.transform);
                        cell.activeFeatures.Add(tempFeature);
                    }
                }
            }

            if (Input.GetMouseButtonDown(0))
            {
                cell.ClearCellFeatures();
                //Debug.Log(activePrefab);
                if (spawnFeatures)
                {
                    GameObject tempFeature = Instantiate(Resources.Load(activePrefab),
                                                         cell.gameObject.transform.position, Quaternion.identity) as GameObject;
                    tempFeature.transform.SetParent(cell.transform);
                    cell.activeFeatures.Add(tempFeature);
                }
            }
        }
    }