本文整理汇总了C#中BuildingBlock类的典型用法代码示例。如果您正苦于以下问题:C# BuildingBlock类的具体用法?C# BuildingBlock怎么用?C# BuildingBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildingBlock类属于命名空间,在下文中一共展示了BuildingBlock类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Person
internal Person(int id, double movementSpeed, BuildingBlock position)
{
if (id <= 0)
{ /* Negative or zero-valued id means this is a totally new person */
int newID;
do
{
newID = _idCounter++;
} while (IdsInUse.Contains(newID));
ID = newID;
}
else
{
/* non-zeroed, positive value means this is an existing person */
if (IdsInUse.Contains(id))
throw new PersonException($"A user with ID {id} already exists!");
ID = id;
}
PersonInteractionStats = new DataSimulationStatistics();
// 3 - 8 kmt
MovementSpeed = movementSpeed < 3 ? 3 + Rand.NextDouble() * 5 : movementSpeed; // Less than 5 means that it was not created.
MovementSpeed = 3 + Rand.NextDouble() * 5;
MovementSpeedInMetersPerSecond = (MovementSpeed * 1000) / 60 / 60;
Position = position;
//If their position is int16.maxvalue, if the priority is not assigned == That there is no path,
//They will not be touched in the simulation, but will be added to the counter in CP_SimulationStats
if (position.Priority == Int16.MaxValue)
{
NoPathAvailable = true;
}
OriginalPosition = position;
}
开发者ID:pprintz,项目名称:p2,代码行数:33,代码来源:Person.cs
示例2: DiagonalDistanceToIfXDistanceIsSmalerThenYDistanceTest
public void DiagonalDistanceToIfXDistanceIsSmalerThenYDistanceTest()
{
BuildingBlock pointOne = new BuildingBlock(0, 0);
BuildingBlock pointTwo = new BuildingBlock(2, 1);
var distance = pointOne.DiagonalDistanceTo(pointTwo);
Assert.AreEqual(1 + Math.Sqrt(2), distance);
}
开发者ID:pprintz,项目名称:p2,代码行数:7,代码来源:TileTests.cs
示例3: Area
public Area(string name, List<IAreaConnector> inputs)
: base(new List<BuildingBlock>())
{
_name = name;
_boundBuildingBlock = null;
_inputs = inputs;
}
开发者ID:alect,项目名称:Puzzledice,代码行数:7,代码来源:Area.cs
示例4: DiagonalDistanceHalfOfIntMax
public void DiagonalDistanceHalfOfIntMax()
{
BuildingBlock pointOne = new BuildingBlock(Int32.MaxValue / 2, Int32.MaxValue / 2);
BuildingBlock pointTwo = new BuildingBlock(0, 0);
var distance = pointOne.DiagonalDistanceTo(pointTwo);
Assert.AreEqual((Int32.MaxValue / 2) * Math.Sqrt(2), distance);
}
开发者ID:pprintz,项目名称:p2,代码行数:7,代码来源:TileTests.cs
示例5: BuildingPartDestroyedEvent
public BuildingPartDestroyedEvent(BuildingBlock buildingBlock, HitInfo info)
{
BuildingPart = new BuildingPart(buildingBlock);
Info = info;
string bonename = StringPool.Get(info.HitBone);
HitBone = bonename == "" ? "unknown" : bonename;
}
开发者ID:Notulp,项目名称:Pluton.Rust,代码行数:7,代码来源:BuildingPartDestroyedEvent.cs
示例6: DiagonalDistanceToIfYDistanceIsSmalerThenXDistanceTest
public void DiagonalDistanceToIfYDistanceIsSmalerThenXDistanceTest()
{
BuildingBlock pointOne = new BuildingBlock(1, 2);
BuildingBlock pointTwo = new BuildingBlock(1, 1);
var distance = pointOne.DiagonalDistanceTo(pointTwo);
Assert.AreEqual(1, distance);
}
开发者ID:pprintz,项目名称:p2,代码行数:7,代码来源:TileTests.cs
示例7: DiagonalDistanceToIfYDistanceIsEqualToXDistanceTest
public void DiagonalDistanceToIfYDistanceIsEqualToXDistanceTest()
{
BuildingBlock pointOne = new BuildingBlock(10, 10);
BuildingBlock pointTwo = new BuildingBlock(0, 0);
var distance = pointOne.DiagonalDistanceTo(pointTwo);
Assert.AreEqual(10 * Math.Sqrt(2), distance);
}
开发者ID:pprintz,项目名称:p2,代码行数:7,代码来源:TileTests.cs
示例8: areaGeneratePuzzle
public PuzzleOutput areaGeneratePuzzle(BuildingBlock buildingBlockToBind)
{
if (_verbose) Debug.Log("spawning Area: " + _name);
if (_boundBuildingBlock != null) {
if (_verbose) Debug.Log("Area already bound to another building block!");
return new PuzzleOutput();
}
else {
BuildingBlock.shuffle(_inputs);
foreach (IAreaConnector input in _inputs) {
PuzzleOutput possibleInput = input.areaGeneratePuzzle(this);
if (possibleInput == null)
continue;
_input = input;
_boundBuildingBlock = buildingBlockToBind;
PuzzleOutput result = new PuzzleOutput();
result.Items.AddRange(possibleInput.Items);
result.Relationships.AddRange(possibleInput.Relationships);
// Add an area connection relationship here
AreaConnectionRelationship connectionRelationship = input.makeConnection(this);
result.Relationships.Add(connectionRelationship);
return result;
}
return null;
}
}
开发者ID:alect,项目名称:Puzzledice,代码行数:30,代码来源:Area.cs
示例9: DiagonalDistanceTo
public double DiagonalDistanceTo(BuildingBlock point)
{
double xDistance = Math.Abs(X - point.X);
double yDistance = Math.Abs(Y - point.Y);
if (xDistance > yDistance)
return Math.Sqrt(2) * yDistance + 1 * (xDistance - yDistance);
return Math.Sqrt(2) * xDistance + 1 * (yDistance - xDistance);
}
开发者ID:pprintz,项目名称:p2,代码行数:8,代码来源:Tile.cs
示例10: DiagonalDistanceHalfOfIntMin
public void DiagonalDistanceHalfOfIntMin()
{
int min = (Int32.MinValue + 1) / 2;
BuildingBlock pointOne = new BuildingBlock(min, min);
BuildingBlock pointTwo = new BuildingBlock(0, 0);
var distance = pointOne.DiagonalDistanceTo(pointTwo);
Assert.AreEqual((Math.Abs(min) * Math.Sqrt(2)), distance);
}
开发者ID:pprintz,项目名称:p2,代码行数:8,代码来源:TileTests.cs
示例11: BuildingPartGradeChangeEvent
public BuildingPartGradeChangeEvent(BuildingBlock bb, BuildingGrade.Enum bgrade, BasePlayer player)
{
BuildingPart = new BuildingPart(bb);
Builder = Server.GetPlayer(player);
grade = bgrade;
HasPrivilege = (bool)bb.CallMethod("CanChangeToGrade", bgrade, player);
}
开发者ID:Notulp,项目名称:Pluton,代码行数:8,代码来源:BuildingPartGradeChangeEvent.cs
示例12: BuildingEvent
public BuildingEvent(Construction construction, Construction.Target target, BuildingBlock bb, bool bNeedsValidPlacement)
{
Builder = Server.GetPlayer(target.player);
BuildingPart = new BuildingPart(bb);
Construction = construction;
Target = target;
NeedsValidPlacement = bNeedsValidPlacement;
}
开发者ID:Notulp,项目名称:Pluton,代码行数:8,代码来源:BuildingEvent.cs
示例13: PropertyChangePuzzle
public PropertyChangePuzzle(BuildingBlock changerInput, BuildingBlock changeeInput,
string desiredPropertyName, object desiredPropertyVal)
: base(new List<BuildingBlock>() { changerInput, changeeInput })
{
_changerInput = changerInput;
_changeeInput = changeeInput;
_desiredPropertyName = desiredPropertyName;
_desiredPropertyVal = desiredPropertyVal;
}
开发者ID:alect,项目名称:Puzzledice,代码行数:9,代码来源:PropertyChangePuzzle.cs
示例14: areaDespawnItems
public void areaDespawnItems(BuildingBlock possibleBind)
{
if (_verbose) Debug.Log(string.Format("Attempting to despawn items for area {0}", _name));
if (possibleBind == _boundBuildingBlock) {
if (_verbose) Debug.Log(string.Format("Successfully despawning items for area {0}", _name));
_input.areaDespawnItems(this);
_boundBuildingBlock = null;
}
}
开发者ID:alect,项目名称:Puzzledice,代码行数:9,代码来源:Area.cs
示例15: addBlockToList
private void addBlockToList(BuildingBlock buildingBlock, DateTime dateTime)
{
KeyValuePair<BuildingBlock, DateTime> newKVP = new KeyValuePair<BuildingBlock, DateTime>(buildingBlock, dateTime);
if (!this.upgradedBuildingBlocks.Exists(x => x.Key.Equals(newKVP.Key)))
{
this.upgradedBuildingBlocks.Add(newKVP);
updateConfig();
}
}
开发者ID:SteveKnowless,项目名称:Rust,代码行数:9,代码来源:RotateOnUpgrade.cs
示例16: OnEntityEnter
void OnEntityEnter(TriggerBase triggerbase, BaseEntity entity)
{
if (!hasStarted) return;
cachedBlock = triggerbase.GetComponentInParent<BuildingBlock>();
if (cachedBlock == null) return;
if (cachedBlock.blockDefinition.fullName != "build/block.halfheight") return;
cachedPlayer = entity.GetComponent<BasePlayer>();
if (cachedPlayer == null) return;
cachedBlock.Kill(BaseNetworkable.DestroyMode.Gib);
cachedPlayer.SendConsoleCommand("chat.add", new object[] { "0", string.Format("<color=orange>{0}:</color> {1}", "Warning", "You are not allowed to build blocks over you"), 1.0 });
}
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:11,代码来源:BlockBlockElevators.cs
示例17: OnEntityBuilt
void OnEntityBuilt(Planner planner, GameObject gameObject)
{
cachedBlock = gameObject.GetComponent<BuildingBlock>();
if (cachedBlock == null) return;
if (cachedBlock.blockDefinition == null) return;
if (cachedBlock.blockDefinition.fullName != "build/block.halfheight") return;
cachedBlock.GetComponentInChildren<MeshCollider>().gameObject.AddComponent<TriggerBase>();
cachedBlock.GetComponentInChildren<TriggerBase>().gameObject.layer = triggerLayer;
cachedBlock.GetComponentInChildren<TriggerBase>().interestLayers = playerMask;
timer.Once(0.1f, () => ResetBlock(cachedBlock) );
}
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:11,代码来源:BlockBlockElevators.cs
示例18: PersonStart
public void PersonStart()
{
BuildingBlock block = new BuildingBlock(0,0);
Person person = new Person(block);
Assert.AreEqual(1,person.ID);
Assert.AreEqual(false,person.Evacuated);
Assert.AreEqual(new List<BuildingBlock>(), person.PathList);
Tile tile = person.Position;
Assert.AreEqual(0, tile.X);
Assert.AreEqual(0, tile.Y);
}
开发者ID:pprintz,项目名称:p2,代码行数:11,代码来源:PersonTests.cs
示例19: BuildingBlockStart
public void BuildingBlockStart()
{
BuildingBlock buildingBlock = new BuildingBlock(0, 0);
Assert.AreEqual(0, buildingBlock.X);
Assert.AreEqual(0, buildingBlock.Y);
Assert.AreEqual(0, buildingBlock.HeatmapCounter);
Assert.AreEqual(false, buildingBlock.IsChecked);
Assert.AreEqual(double.MaxValue, buildingBlock.LengthFromSource);
Assert.AreEqual(0, buildingBlock.LengthToDestination);
Assert.AreEqual(null, buildingBlock.Parent);
Assert.AreEqual(new HashSet<Tile>(), buildingBlock.Neighbours);
Assert.AreEqual(Tile.Types.Free, buildingBlock.Type);
}
开发者ID:pprintz,项目名称:p2,代码行数:13,代码来源:BuildingBlockTests.cs
示例20: NextBlockGrade
int NextBlockGrade(BuildingBlock building_block, int offset = 1)
{
var current_grade = (int)building_block.grade;
var grades = building_block.blockDefinition.grades;
if (grades == null) return current_grade;
var target_grade = current_grade + offset;
while (target_grade >= 0 && target_grade < grades.Length)
{
if (grades[target_grade] != null) return target_grade;
target_grade += offset;
}
return current_grade;
}
开发者ID:SteveKnowless,项目名称:Rust,代码行数:16,代码来源:BuildingGrades.cs
注:本文中的BuildingBlock类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论