Ejemplo n.º 1
0
 public BridgeBaseObject(RiverBridgeObject parent, Vec2i worldPosition) : base(worldPosition, new Vector3(0, .1f, 0), null, null)
 {
     Parent = parent;
 }
Ejemplo n.º 2
0
    private void GenerateRiverBridge(ChunkBase cb, WorldObjectData[,] chunkObjs, int bridgeWidth = 5)
    {
        RiverNode rn    = cb.RiverNode;
        int       rDirX = Mathf.Abs(rn.RiverNodeDirection().x);
        int       rDirZ = Mathf.Abs(rn.RiverNodeDirection().z);

        if (rDirX == 1 && rDirZ == 1)
        {
            return;
        }

        Vec2i absDir = new Vec2i(rDirX, rDirZ);

        int riverWidth = (int)rn.EntranceWidth;
        int halfWidth  = bridgeWidth / 2;

        Vec2i start, end;

        if (rDirX == 1)
        {
            start = new Vec2i(World.ChunkSize / 2 - halfWidth, World.ChunkSize / 2 - riverWidth);
            end   = new Vec2i(World.ChunkSize / 2 + halfWidth, World.ChunkSize / 2 + riverWidth + 1);
        }
        else
        {
            start = new Vec2i(World.ChunkSize / 2 - riverWidth, World.ChunkSize / 2 - halfWidth);
            end   = new Vec2i(World.ChunkSize / 2 + riverWidth + 1, World.ChunkSize / 2 + halfWidth);
        }


        RiverBridgeObject rbObj = new RiverBridgeObject(start, end, absDir);

        IMultiTileObjectChild[,] childs = rbObj.GetChildren();

        for (int x = 0; x < rbObj.Size.x; x++)
        {
            for (int z = 0; z < rbObj.Size.z; z++)
            {
                chunkObjs[start.x + x, start.z + z] = childs[x, z] as WorldObjectData;
            }
        }

        /*
         * //If these do not sum to 1, the direction is not simple (i.e, diagonal) and no bridge can be made
         * if (rnDir.x + rnDir.z != 1)
         *  return;
         * //If the river is travelling in the z direction
         * if (rnDir.x == 0)
         * {
         *  Vec2i start = new Vec2i(World.ChunkSize / 2 - halfWidth, World.ChunkSize / 2 - riverWidth);
         *  Vec2i end = new Vec2i(World.ChunkSize / 2 + halfWidth, World.ChunkSize / 2 + riverWidth);
         *
         *  RiverBridgeObject rbObj = new RiverBridgeObject(start, end, new Vec2i(1,0));
         *  IMultiTileObjectChild[,] childs = rbObj.GetChildren();
         *  for(int x=0; x<rbObj.Size.x; x++)
         *  {
         *      for(int z=0; z<rbObj.Size.z; z++)
         *      {
         *          chunkObjs[start.x + x, start.z + z] = childs[x, z] as WorldObjectData;
         *      }
         *  }
         * }
         * else
         * {
         *
         * }*/
    }
Ejemplo n.º 3
0
 public BridgeRampObject(RiverBridgeObject parent, Vec2i worldPosition) : base(worldPosition, null, null)
 {
     Parent = parent;
 }