本文整理汇总了C#中IntVector3类的典型用法代码示例。如果您正苦于以下问题:C# IntVector3类的具体用法?C# IntVector3怎么用?C# IntVector3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntVector3类属于命名空间,在下文中一共展示了IntVector3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Contains
// I/F
public bool Contains(IntVector3 eyePosition, IntVector3 point)
{
int distanceSquared;
IntVector3.DistanceSquared(ref eyePosition, ref point, out distanceSquared);
return distanceSquared <= radiusSquared;
}
开发者ID:willcraftia,项目名称:TestBlocks,代码行数:8,代码来源:DefaultActiveVolume.cs
示例2: TryGetSectorViewHighlightables
/// <summary>
/// Returns <c>true</c> if the sector indicated by sectorID contains one or more ISectorViewHighlightables, <c>false</c> otherwise.
/// </summary>
/// <param name="sectorID">ID of the sector.</param>
/// <param name="highlightablesInSector">The highlightables in sector.</param>
/// <returns></returns>
public bool TryGetSectorViewHighlightables(IntVector3 sectorID, out IEnumerable<ISectorViewHighlightable> highlightablesInSector) {
D.AssertNotDefault(sectorID);
List<ISectorViewHighlightable> sectorHighlightables = new List<ISectorViewHighlightable>();
ISystem_Ltd system;
if (TryGetSystem(sectorID, out system)) {
ISectorViewHighlightable sys = system as ISectorViewHighlightable;
D.AssertNotNull(sys);
sectorHighlightables.Add(sys);
}
IEnumerable<IStarbaseCmd_Ltd> starbases;
if (TryGetStarbases(sectorID, out starbases)) {
IEnumerable<ISectorViewHighlightable> highlightableStarbases = starbases.Cast<ISectorViewHighlightable>();
D.Assert(!highlightableStarbases.IsNullOrEmpty());
sectorHighlightables.AddRange(highlightableStarbases);
}
IEnumerable<IFleetCmd_Ltd> fleets;
if (TryGetFleets(sectorID, out fleets)) {
IEnumerable<ISectorViewHighlightable> highlightableFleets = fleets.Cast<ISectorViewHighlightable>();
D.Assert(!highlightableFleets.IsNullOrEmpty());
sectorHighlightables.AddRange(highlightableFleets);
}
if (sectorHighlightables.Any()) {
highlightablesInSector = sectorHighlightables;
return true;
}
highlightablesInSector = null;
return false;
}
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:35,代码来源:UserPlayerKnowledge.cs
示例3: AdjustRiver
public void AdjustRiver()
{
int minZ = m_riverPath.Min(p => m_terrain.GetSurfaceLevel(p));
var pos = DirectionSet.Cardinal | DirectionSet.Exact;
var coreLocs = new HashSet<IntVector2>(m_riverPath.SelectMany(p => pos.ToSurroundingPoints(p)));
foreach (var pp in coreLocs)
{
if (m_terrain.Size.Plane.Contains(pp) == false)
continue;
for (int z = m_terrain.Depth - 1; z >= minZ - 1; --z)
{
var p = new IntVector3(pp.X, pp.Y, z);
var td = TileData.EmptyTileData;
if (z == minZ - 1)
td.WaterLevel = TileData.MaxWaterLevel;
m_terrain.SetTileData(p, td);
}
}
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:26,代码来源:RiverGen.cs
示例4: GenerateVoxel
public override Voxel GenerateVoxel(IntVector3 pos)
{
var distance = pos.DistanceTo(IntVector3.Zero);
if (distance < half)
return new Voxel { Weight = 255 };
/*
var polarPos = SphericalPosition.FromCartesian(pos.X, pos.Y, pos.Z);
if (polarPos.Radius < half)
{
//var noiseVal = (float)gen.GetValue(polarPos.Azimuth, polarPos.Inclination, Seed);
//var radHere = (float)(noiseVal + 1f / 2f) * Size;
//if (radHere < half)
return new Voxel(1f);
}
// the easy way to generate a sphere
//if(pos.DistanceTo(IntVector3.Zero) < half)
// return new Voxel(1f);
*/
return Voxel.Empty;
}
开发者ID:TehWardy,项目名称:Framework,代码行数:25,代码来源:IslandGenerator.cs
示例5: Chunk
/// <summary>
/// Creates a new Chunk of size chunkSize x chunkSize x chunkSize, filled with null blocks.
/// This is for chunks that are part of the map.
/// It will assume that its north-west-bottom corner is at pos * chunkSize,
/// and (when implemented...) it will save its data to "pos.x,pos.y,pos.z".xml
/// </summary>
/// <param name="layers"></param>
/// <param name="pos"></param>
public Chunk(IntVector3 pos, GraphicsDevice graphics)
{
size = Sizes.ChunkSize;
blocks = new Block[Sizes.ChunkSize, Sizes.ChunkSize, Sizes.ChunkSize];
structures = new List<MapStructure>();
position = pos;
filename = MainGame.WorldFolder + position.X + "," + position.Y + "," + position.Z;
try
{
vBuff = new DynamicVertexBuffer(graphics, typeof(VertexPositionColorNormal), maxVerts, BufferUsage.WriteOnly);
//vBuff.ContentLost += new EventHandler<EventArgs>(verticesLostHandler);
iBuff = new DynamicIndexBuffer(graphics, IndexElementSize.SixteenBits, maxInds, BufferUsage.WriteOnly);
//iBuff.ContentLost += new EventHandler<EventArgs>(indicesLostHandler);
//so do I need to add a custom test for content lost before drawing?
}
catch(OpenTK.Graphics.GraphicsContextException e)
{
Logger.Log(e.ToString());
}
vertices = new VertexPositionColorNormal[0];
indices = new short[0];
}
开发者ID:littlebeast,项目名称:Outpost,代码行数:33,代码来源:Chunk.cs
示例6: findDetachedVoxels
public static ArrayList findDetachedVoxels(int [,,] mapData, int stopCode, IntVector3 point)
{
/*
where i,j,k is a recently destroyed block, returns a list of IntVector3s of all blocks that should
be detached, as well as the size of the blob that would contain them.
*/
ArrayList detachedVoxels = new ArrayList ();
allVisitedVoxels = new ArrayList ();
ArrayList seeds = MDView.getNeighbors (mapData, point);
for (int index=0; index<seeds.Count; index++) {
IntVector3 seedPoint = (IntVector3)seeds [index];
if (allVisitedVoxels.Contains (seedPoint)) {
seeds.Remove (seedPoint);
index--;
continue;
}
ArrayList newVoxels = getBlob (mapData, stopCode, seedPoint);
if (newVoxels.Count > 0) {
detachedVoxels.AddRange (newVoxels);
}
}
return detachedVoxels;
}
开发者ID:Zulban,项目名称:viroid,代码行数:31,代码来源:MDPathfinder.cs
示例7: getCollisionArray
public static int[,] getCollisionArray(int[,,]mapData, IntVector3 direction)
{
/*
where direction is a unit vector, pointing in the direction mapData is travelling
the direction vector decides what the collision plane will be. for example the collision plane
of a moving car is vertical, like the surface of a brick wall, in front of the car.
the returned collisionArray is the heights of the nearest voxel lining up to each (x,y) of that
plane.
*/
//Debug.Log ("getCollisionArray " + direction.i + " " + direction.j + " " + direction.k);
if (! direction.isOrthogonalUnitVector ())
Debug.Log ("warning: getCollisionArray didn't get a unit vector.");
IntVector2 arraySize = getCollisionArraySize (mapData, direction);
int [,] collisionArray = new int [arraySize.x, arraySize.y];
for (int xOffset=0; xOffset<arraySize.x; xOffset++) {
for (int yOffset=0; yOffset<arraySize.y; yOffset++) {
int dist = getClosestVoxelDistance (mapData, xOffset, yOffset, direction);
collisionArray [xOffset, yOffset] = dist;
if (dist != -1) {
//Debug.Log ("xoffset: " + xOffset + " yoffset: " + yOffset + " dist: " + dist);
}
}
}
return collisionArray;
}
开发者ID:Zulban,项目名称:viroid,代码行数:33,代码来源:MDCollision.cs
示例8: MoveBaseAssignment
protected MoveBaseAssignment(IJobObserver parent, IEnvironmentObject environment, IntVector3 location)
: base(parent)
{
this.Environment = environment;
this.Location = location;
m_state = 0;
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:7,代码来源:MoveBaseAssignment.cs
示例9: Calculate3
public static void Calculate3(IntVector3 viewerLocation, int visionRange, VisionMap visibilityMap, IntSize3 mapSize,
Func<IntVector3, bool> blockerDelegate)
{
visibilityMap.Clear();
if (blockerDelegate(viewerLocation) == true)
return;
var g = new IntGrid3(new IntVector3(), mapSize);
g = g.Offset(-viewerLocation.X, -viewerLocation.Y, -viewerLocation.Z);
var vr = new IntVector3(visionRange, visionRange, visionRange);
g = g.Intersect(new IntGrid3(vr, -vr));
int visionRangeSquared = (visionRange + 1) * (visionRange + 1); // +1 to get a bit bigger view area
foreach (var dst in g.Range())
{
if (dst.LengthSquared > visionRangeSquared)
continue;
bool vis = FindLos3(viewerLocation, dst, blockerDelegate);
visibilityMap[dst] = vis;
// XXX Cheat a bit so that the floor will be visible
if (vis && dst.Z == 0 && viewerLocation.Z > 1)
{
visibilityMap[dst.SetZ(dst.Z - 1)] = true;
}
}
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:30,代码来源:RayCastLerp.cs
示例10: InitializeWorld
public void InitializeWorld(World world, IntSize3 size)
{
CreateTerrain(size);
IntVector3? stairs = null;
foreach (var p2 in m_terrainData.Size.Plane.Range())
{
var p = new IntVector3(p2, m_terrainData.Size.Depth - 1);
var td = m_terrainData.GetTileData(p.Down);
if (td.ID == TileID.Stairs)
{
stairs = p;
break;
}
}
if (stairs.HasValue == false)
throw new Exception();
m_env = EnvironmentObject.Create(world, m_terrainData, VisibilityMode.LivingLOS, stairs.Value);
CreateMonsters();
CreateDebugMonsterAtEntry();
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:27,代码来源:DungeonWorldCreator.cs
示例11: EnvironmentObject
EnvironmentObject(Dwarrowdelf.TerrainGen.TerrainData terrain, VisibilityMode visMode, IntVector3 startLocation)
: base(ObjectType.Environment)
{
this.Version = 1;
this.VisibilityMode = visMode;
terrain.GetData(out m_tileGrid, out m_levelMap);
this.Size = terrain.Size;
this.StartLocation = startLocation;
InitFlags();
VerifyLevelMap();
m_contentArray = new KeyedObjectCollection[this.Depth];
for (int i = 0; i < this.Depth; ++i)
m_contentArray[i] = new KeyedObjectCollection();
m_originalNumTrees = ParallelEnumerable.Range(0, this.Size.Depth).Sum(z =>
{
int sum = 0;
for (int y = 0; y < this.Size.Height; ++y)
for (int x = 0; x < this.Size.Width; ++x)
if (GetTileData(x, y, z).HasTree)
sum++;
return sum;
});
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:30,代码来源:EnvironmentObject.cs
示例12: CreateBallMap
public static TerrainData CreateBallMap(IntSize3 size, int innerSide = 0)
{
var map = new TerrainData(size);
int side = MyMath.Min(size.Width, size.Height, size.Depth);
int r = side / 2 - 1;
int ir = innerSide / 2 - 1;
Parallel.For(0, size.Depth, z =>
{
for (int y = 0; y < size.Height; ++y)
for (int x = 0; x < size.Width; ++x)
{
var pr = Math.Sqrt((x - r) * (x - r) + (y - r) * (y - r) + (z - r) * (z - r));
var p = new IntVector3(x, y, z);
if (pr < r && pr >= ir)
map.SetTileDataNoHeight(p, TileData.GetNaturalWall(MaterialID.Granite));
else
map.SetTileDataNoHeight(p, TileData.EmptyTileData);
}
});
map.RescanLevelMap();
return map;
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:29,代码来源:ArtificialGen.cs
示例13: Sees
public override bool Sees(IntVector3 p)
{
if (!m_environment.Contains(p))
return false;
return GetVisible(p);
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:7,代码来源:VisionTrackerGlobalFOV.cs
示例14: MineAssignment
public MineAssignment(IJobObserver parent, IEnvironmentObject environment, IntVector3 location, MineActionType mineActionType)
: base(parent)
{
m_environment = environment;
m_location = location;
m_mineActionType = mineActionType;
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:7,代码来源:MineAssignment.cs
示例15: genFootballPosts
public static int[,,] genFootballPosts(VoxelTheme voxelTheme, IntVector3 destination, int width, int addedHeight)
{
int cageHeight=5;
int[,,] newData = genMapDataFromPoint (destination, width,addedHeight+cageHeight);
int iSize = newData.GetLength (0);
int jSize = newData.GetLength (1);
if (iSize < 3 || width<3 || jSize/iSize>1)
return genBasic (voxelTheme, destination, width);
IntVector3 lastHopPoint = new IntVector3 (0, 0, -1);
int stepSpacing=5;
foreach (IntVector3 hopPoint in getHopArray(iSize,jSize-addedHeight,stepSpacing)) {
IntVector3 offset = new IntVector3 (hopPoint.x, hopPoint.y+addedHeight-1, 0);
int[,,] cageData=new int[1,cageHeight-1,width];
cageData=MDController.combine(cageData,GreebleGenerator.genCage(voxelTheme,1,cageHeight,width));
newData = MDController.combine (newData, cageData, offset);
if (lastHopPoint.z != -1) {
offset = new IntVector3 (lastHopPoint.x,0,width/2);
int underhangAddedHeight=Mathf.Min (hopPoint.y,lastHopPoint.y)+addedHeight;
int[,,] underhangData=ShapeGenerator.genUnderhang(voxelTheme, hopPoint,lastHopPoint,underhangAddedHeight);
newData = MDController.combine (newData, underhangData, offset);
}
lastHopPoint = hopPoint;
}
return rotateMapData (newData, destination);
}
开发者ID:Zulban,项目名称:viroid,代码行数:28,代码来源:CatwalkGenerator.cs
示例16: MapSelection
public MapSelection(IntVector3 start, IntVector3 end)
: this()
{
this.SelectionStart = start;
this.SelectionEnd = end;
this.IsSelectionValid = true;
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:7,代码来源:MapSelection.cs
示例17: isVoxelOccupied
public static bool isVoxelOccupied(int [,,] mapData, IntVector3 point)
{
if (!isInsideMapData (mapData, point))
return false;
return mapData [point.x, point.y, point.z] > 0;
}
开发者ID:Zulban,项目名称:viroid,代码行数:7,代码来源:MDView.cs
示例18: MoveTo
public void MoveTo(ContainerObject dst, IntVector3 dstLoc)
{
var src = this.Container;
var srcLoc = this.Location;
if (src != dst)
{
if (src != null)
src.RemoveChild(this);
this.Container = dst;
}
if (srcLoc != dstLoc)
{
this.Location = dstLoc;
if (dst != null && src == dst)
dst.MoveChild(this, srcLoc, dstLoc);
}
if (src != dst)
{
if (dst != null)
dst.AddChild(this);
}
if (src != dst || srcLoc != dstLoc)
if (ObjectMoved != null)
ObjectMoved(this, this.Container, this.Location);
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:30,代码来源:MovableObject.cs
示例19: CanReach
/* Parallel */
/// <summary>
/// Returns if dst can be reached from src
/// </summary>
public static bool CanReach(IEnvironmentObject env, IntVector3 src, IntVector3 dst, DirectionSet dstPositioning)
{
Debug.Assert(env != null);
// Do pathfinding to both directions simultaneously to detect faster if the destination is blocked
CancellationTokenSource cts = new CancellationTokenSource();
AStarResult resBackward = null;
AStarResult resForward = null;
var taskForward = new Task(delegate
{
resForward = Find(env, src, DirectionSet.Exact, dst, dstPositioning, 200000, cts.Token);
});
taskForward.Start();
var taskBackward = new Task(delegate
{
resBackward = Find(env, dst, dstPositioning.Reverse(), src, DirectionSet.Exact, 200000, cts.Token);
});
taskBackward.Start();
Task.WaitAny(taskBackward, taskForward);
cts.Cancel();
Task.WaitAll(taskBackward, taskForward);
if (resForward.Status == AStarStatus.Found || resBackward.Status == AStarStatus.Found)
return true;
else
return false;
}
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:37,代码来源:AStarHelpers.cs
示例20: isInsideMapData
public static bool isInsideMapData(int[,,]mapData, IntVector3 point)
{
return (point.x >= 0 && point.y >= 0 && point.z >= 0 &&
mapData.GetLength (0) > point.x &&
mapData.GetLength (1) > point.y &&
mapData.GetLength (2) > point.z);
}
开发者ID:Zulban,项目名称:viroid,代码行数:7,代码来源:MDView.cs
注:本文中的IntVector3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论