当前位置: 首页>>代码示例>>C#>>正文


C# BuildingBlock类代码示例

本文整理汇总了C#中BuildingBlock的典型用法代码示例。如果您正苦于以下问题:C# BuildingBlock类的具体用法?C# BuildingBlock怎么用?C# BuildingBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BuildingBlock类属于命名空间,在下文中一共展示了BuildingBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的BuildingBlock类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。