コード例 #1
0
    public void SetupFoundations(SquareCell origin)
    {
        List <SquareCell> foundationList = new List <SquareCell>();

        height = origin.GetMaxElevation();
        owner  = origin.Town;
        SquareCell tempCellx = origin;
        SquareCell tempCelly = origin;

        for (int x = 0; x < width; x++)
        {
            tempCelly = tempCellx;
            for (int y = 0; y < depth; y++)
            {
                foundationList.Add(tempCelly);
                tempCelly = tempCelly.GetNeighbor(GridDirection.N);
            }
            tempCellx = tempCellx.GetNeighbor(GridDirection.E);
        }
        Foundations = foundationList.ToArray();
    }
コード例 #2
0
 void AdjustVerticleHeight()
 {
     if (mainCamera.orthographic)
     {
         transform.position = new Vector3(transform.position.x, 0, transform.position.z);
     }
     else
     {
         SquareCell cell   = grid.GetCell(transform.position);
         Vector3    target = new Vector3(transform.position.x, 0, transform.position.z) + Vector3.up * cell.GetMaxElevation() * GridMetrics.elevationStep;
         transform.position = Vector3.SmoothDamp(transform.position, target, ref velocity, smoothTime);
     }
 }