Exemple #1
0
    private void SquadEditorUpdate()
    {
        if (!Input.GetMouseButton(0))
        {
            return;
        }

        if (cursorInfo.transform != null && UICamera.hoveredObject == null)
        {
            tile = cursorInfo.transform.GetComponent <Tile>();

            if (tile != null)
            {
                //TODO: Allow multiple altitudes OR just make a damn lookup table.
                if (chosenSquadType.staticData.altitude != tile.node.terrain.staticData.altitude)
                {
                    return;
                }

                if (tile.node.obstruction == null)
                {
                    SquadInstance.Create(tile.node, chosenSquadType);
                }
                else if (tile.node.obstruction.GetComponent <SquadInstance>().type != chosenSquadType)
                {
                    SquadInstance.Replace(tile.node.obstruction.GetComponent <SquadInstance>(), chosenSquadType);
                }
            }
        }
    }
Exemple #2
0
    void generateNodes()
    {
        //Debug.Log( width );
        //Debug.Log( length );

        TerrainType terra = TypeContainer <TerrainType> .get("Plain");

        //Debug.Log( "TERRAIN TYPE OF TERRA IS " + terra.staticDataame );

        Node n;

        for (int x = 0; x < width; x++)
        {
            for (int z = 0; z < length; z++)
            {
                n           = new Node(terra, new Vector3(x, 0f, z));
                nodes[x, z] = n;
            }
        }


        for (int x = 0; x < width; x++)
        {
            for (int z = 0; z < length; z++)
            {
                n = getNodeUnsafely(x, z);

                n.AssignEdges();
                n.terrain.autoWall();

                if (z == 0 || z == length - 1)
                {
                    SquadInstance.Create(getNodeUnsafely(x, z), TypeContainer <SquadType> .get("placeholder squad"));
                }
            }
        }
    }