本文整理汇总了C#中DwarfCorp.Voxel类的典型用法代码示例。如果您正苦于以下问题:C# Voxel类的具体用法?C# Voxel怎么用?C# Voxel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Voxel类属于DwarfCorp命名空间,在下文中一共展示了Voxel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Flag
public Flag(Vector3 position)
: base("Flag", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(1.0f, 1.0f, 1.0f), Vector3.Zero)
{
SpriteSheet spriteSheet = new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture);
List<Point> frames = new List<Point>
{
new Point(0, 2),
new Point(1, 2),
new Point(2, 2)
};
Animation lampAnimation = new Animation(GameState.Game.GraphicsDevice, new SpriteSheet(ContentPaths.Entities.Furniture.interior_furniture), "Flag", 32, 32, frames, true, Color.White, 5.0f + MathFunctions.Rand(), 1f, 1.0f, false);
Sprite sprite = new Sprite(PlayState.ComponentManager, "sprite", this, Matrix.Identity, spriteSheet, false)
{
OrientationType = Sprite.OrientMode.YAxis
};
sprite.AddAnimation(lampAnimation);
Voxel voxelUnder = new Voxel();
if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder))
{
VoxelListener listener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxelUnder);
}
lampAnimation.Play();
Tags.Add("Flag");
CollisionType = CollisionManager.CollisionType.Static;
}
示例2: BuildVoxelTask
public BuildVoxelTask(Voxel voxel, VoxelType type)
{
Name = "Put voxel of type: " + type.Name + " on voxel " + voxel.Position;
Voxel = voxel;
VoxType = type;
Priority = PriorityType.Low;
}
示例3: CraftItemAct
public CraftItemAct(CreatureAI creature, Voxel voxel, string type)
: base(creature)
{
ItemType = type;
Voxel = voxel;
Name = "Build craft item";
}
示例4: CraftItemTask
public CraftItemTask(Voxel voxel, string type)
{
Name = "Craft item " + voxel.GridPosition + " " + voxel.ChunkID.X + " " + voxel.ChunkID.Y + " " + voxel.ChunkID.Z;
Voxel = voxel;
CraftType = type;
Priority = PriorityType.Low;
}
示例5: PlaceVoxelAct
public PlaceVoxelAct(Voxel voxel, CreatureAI agent, ResourceAmount resource)
: base(agent)
{
Agent = agent;
Voxel = voxel;
Name = "Build Voxel " + voxel.ToString();
Resource = resource;
}
示例6: VoxelListener
public VoxelListener(ComponentManager manager, GameComponent parent, ChunkManager chunkManager, Voxel vref)
: base("VoxelListener", parent)
{
Chunk = vref.Chunk;
VoxelID = new Point3(vref.GridPosition);
Chunk.OnVoxelDestroyed += VoxelListener_OnVoxelDestroyed;
ChunkID = Chunk.ID;
}
示例7: CreateCraftItemAct
public CreateCraftItemAct(Voxel voxel, CreatureAI agent, string itemType)
: base(agent)
{
Agent = agent;
Voxel = voxel;
Name = "Create craft item";
ItemType = itemType;
}
示例8: Tinter
public Tinter(string name, GameComponent parent, Matrix localTransform, Vector3 boundingBoxExtents, Vector3 boundingBoxPos, bool collisionManager)
: base(name, parent, localTransform, boundingBoxExtents, boundingBoxPos, collisionManager)
{
LightsWithVoxels = true;
Tint = new Color(255, 255, 0);
LightingTimer = new Timer(0.2f, true);
StartTimer = new Timer(0.5f, true);
TargetTint = Tint;
TintChangeRate = 1.0f;
LightsWithVoxels = true;
VoxelUnder = new Voxel();
}
示例9: GetDistance
public static float GetDistance(Voxel a, Voxel b, Creature.MoveType action, ChunkManager chunks)
{
if(!b.IsEmpty)
{
return 100000;
}
else
{
float score = (a.Position - b.Position).LengthSquared() * ActionCost(action);
return score;
}
}
示例10: FindPath
public static List<Creature.MoveAction> FindPath(CreatureMovement mover, Voxel start, GoalRegion goal, ChunkManager chunks, int maxExpansions)
{
List<Creature.MoveAction> p = new List<Creature.MoveAction>();
bool success = Path(mover, start, goal, chunks, maxExpansions, ref p, false);
if(success)
{
return p;
}
else
{
return null;
}
}
示例11: GuardVoxelAct
public GuardVoxelAct(CreatureAI agent, Voxel voxel)
: base(agent)
{
Voxel = voxel;
Name = "Guard Voxel " + voxel;
Tree = new Sequence
(
new GoToVoxelAct(voxel, PlanAct.PlanType.Adjacent, agent),
new StopAct(Agent),
new WhileLoop(new WanderAct(Agent, 1.0f, 0.5f, 0.1f), new Condition(LoopCondition)),
new Condition(ExitCondition)
);
}
示例12: GoToVoxelAct
public GoToVoxelAct(Voxel voxel, PlanAct.PlanType planType, CreatureAI creature, float radius = 0.0f)
: base(creature)
{
Voxel = voxel;
Name = "Go to Voxel";
if(Voxel != null)
{
Tree = new Sequence(
new SetBlackboardData<Voxel>(Agent, "TargetVoxel", Voxel),
new PlanAct(Agent, "PathToVoxel", "TargetVoxel", planType) { Radius = radius},
new FollowPathAnimationAct(Agent, "PathToVoxel"),
new StopAct(Agent));
}
}
示例13: Tree
public Tree(Vector3 position, string asset, float treeSize)
: base("Tree", PlayState.ComponentManager.RootComponent, Matrix.Identity, new Vector3(treeSize * 2, treeSize * 3, treeSize * 2), new Vector3(treeSize * 0.5f, treeSize * 0.25f, treeSize * 0.5f))
{
HurtTimer = new Timer(1.0f, false);
ComponentManager componentManager = PlayState.ComponentManager;
Matrix matrix = Matrix.Identity;
matrix.Translation = position;
LocalTransform = matrix;
new Mesh(componentManager, "Model", this, Matrix.CreateRotationY((float)(PlayState.Random.NextDouble() * Math.PI)) * Matrix.CreateScale(treeSize, treeSize, treeSize) * Matrix.CreateTranslation(new Vector3(0.7f, 0.0f, 0.7f)), asset, false);
Health health = new Health(componentManager, "HP", this, 100.0f * treeSize, 0.0f, 100.0f * treeSize);
new Flammable(componentManager, "Flames", this, health);
Tags.Add("Vegetation");
Tags.Add("EmitsWood");
new MinimapIcon(this, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.map_icons), 16, 1, 0));
Voxel voxelUnder = new Voxel();
if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder))
{
new VoxelListener(componentManager, this, PlayState.ChunkManager, voxelUnder);
}
Inventory inventory = new Inventory("Inventory", this)
{
Resources = new ResourceContainer
{
MaxResources = (int)(treeSize * 10)
}
};
inventory.Resources.AddResource(new ResourceAmount()
{
NumResources = (int)(treeSize * 10),
ResourceType = ResourceLibrary.Resources[ResourceLibrary.ResourceType.Wood]
});
Particles = new ParticleTrigger("Leaves", componentManager, "LeafEmitter", this,
Matrix.Identity, new Vector3(treeSize * 2, treeSize * 3, treeSize * 2), new Vector3(treeSize * 0.5f, treeSize * 0.25f, treeSize * 0.5f))
{
SoundToPlay = ContentPaths.Audio.vegetation_break
};
AddToCollisionManager = true;
CollisionType = CollisionManager.CollisionType.Static;
}
示例14: Bed
public Bed(Vector3 position)
: base("Bed", PlayState.ComponentManager.RootComponent, Matrix.CreateTranslation(position), new Vector3(1.5f, 0.5f, 0.75f), new Vector3(-0.5f + 1.5f * 0.5f, -0.5f + 0.25f, -0.5f + 0.75f * 0.5f))
{
Texture2D spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bedtex);
bedModel = new Box(PlayState.ComponentManager, "bedbox", this, Matrix.CreateTranslation(-0.5f, -0.5f, -0.5f) * Matrix.CreateRotationY((float)Math.PI * 0.5f), new Vector3(1.0f, 1.0f, 2.0f), new Vector3(0.5f, 0.5f, 1.0f), PrimitiveLibrary.BoxPrimitives["bed"], spriteSheet);
Voxel voxelUnder = new Voxel();
if (PlayState.ChunkManager.ChunkData.GetFirstVoxelUnder(position, ref voxelUnder))
{
VoxelListener listener = new VoxelListener(PlayState.ComponentManager, this, PlayState.ChunkManager, voxelUnder);
}
Tags.Add("Bed");
CollisionType = CollisionManager.CollisionType.Static;
}
示例15: KillVoxelAct
public KillVoxelAct(Voxel voxel, CreatureAI creature)
: base(creature)
{
Voxel = voxel;
Name = "Kill Voxel " + voxel.Position;
Tree = new Sequence(
new SetBlackboardData<Voxel>(creature, "DigVoxel", voxel),
new Sequence(
new Wrap(() => IncrementAssignment(creature, "DigVoxel", 1)),
new GoToVoxelAct(voxel, PlanAct.PlanType.Adjacent, creature),
new Wrap(() => CheckIsDigDesignation(creature, "DigVoxel")),
new DigAct(Agent, "DigVoxel"),
new ClearBlackboardData(creature, "DigVoxel")
)
| new Wrap(() => IncrementAssignment(creature, "DigVoxel", -1)) & false);
}