• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Building类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Building类属于命名空间,在下文中一共展示了Building类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: UpdateBuildings

 public static void UpdateBuildings(ushort[] newBuildingIDS, Building[] newBuildings)
 {
     for (int i = 0; i < newBuildingIDS.Length; i++)
     {
         CreateBuilding(newBuildingIDS[i], newBuildings[i]);
     }
 }
开发者ID:rockhowse,项目名称:Gurkenplayer,代码行数:7,代码来源:BuildingSyncHelper.cs


示例2: UI_Init

	/**
	 * Initialise the building view.
	 */ 
	override public void UI_Init(Building building) {
		base.UI_Init(building);

		// Position animators
		if (building.Type is BuildingDataWithUnitAnimations)
		{
			allocatedSpots = new Dictionary<OccupantData, int>();
			// Position animators
			for (int i = 0 ; i < animators.Count; i++) {
				animators[i].gameObject.SetActive(false);
				if (((BuildingDataWithUnitAnimations)building.Type).animationPositions.Count > i) {
						animators[i].gameObject.transform.localPosition = new Vector3(((BuildingDataWithUnitAnimations)building.Type).animationPositions[i].x, 
					                                                              ((BuildingDataWithUnitAnimations)building.Type).animationPositions[i].y, 0.0f);
				}
				animators[i].gameObject.SetActive(false);
				animators[i].Hide();
			}
			// Position static sprites
			for (int i = 0 ; i < staticUnits.Count; i++) {
				if (((BuildingDataWithUnitAnimations)building.Type).staticPositions.Count > i) {
					staticUnits[i].gameObject.transform.localPosition = new Vector3(((BuildingDataWithUnitAnimations)building.Type).staticPositions[i].x, 
				                                                                ((BuildingDataWithUnitAnimations)building.Type).staticPositions[i].y, 0.0f);
				}
				staticUnits[i].gameObject.SetActive(false);

			}
		}

		UpdateOccupants();

	}
开发者ID:YooghurtEnterprises,项目名称:War_of_Rebels,代码行数:34,代码来源:BuildingViewWithUnits.cs


示例3: CancelBuildingPlacement

 public void CancelBuildingPlacement()
 {
     findingPlacement = false;
     Destroy(tempBuilding.gameObject);
     tempBuilding = null;
     tempCreator = null;
 }
开发者ID:urbanek32,项目名称:SharpWars_GameCore,代码行数:7,代码来源:Player.cs


示例4: CalculateOwnVehicles

 protected void CalculateOwnVehicles(ushort buildingID, ref Building data, TransferManager.TransferReason material, ref int count, ref int cargo, ref int capacity, ref int outside)
 {
     VehicleManager instance = Singleton<VehicleManager>.instance;
     ushort num = data.m_ownVehicles;
     int num2 = 0;
     while (num != 0)
     {
     if ((TransferManager.TransferReason)instance.m_vehicles.m_buffer [(int)num].m_transferType == material)
     {
         VehicleInfo info = instance.m_vehicles.m_buffer [(int)num].Info;
         int a;
         int num3;
         info.m_vehicleAI.GetSize (num, ref instance.m_vehicles.m_buffer [(int)num], out a, out num3);
         cargo += Mathf.Min (a, num3);
         capacity += num3;
         count++;
         if ((instance.m_vehicles.m_buffer [(int)num].m_flags & (Vehicle.Flags.Importing | Vehicle.Flags.Exporting)) != Vehicle.Flags.None)
         {
             outside++;
         }
     }
     num = instance.m_vehicles.m_buffer [(int)num].m_nextOwnVehicle;
     if (++num2 > 16384)
     {
         CODebugBase<LogChannel>.Error (LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
         break;
     }
     }
 }
开发者ID:klyte45,项目名称:CS-VehicleLimitExpander,代码行数:29,代码来源:FakeCommonBuildingAI.cs


示例5: getLazyEmplo

    private Employee getLazyEmplo(Building build)
    {
        Employee emplo = build.Employees.getLazyEmploye();

        if (emplo.Share == true) return null;
        else return emplo;
    }
开发者ID:Lukasz199312,项目名称:ClickCraft,代码行数:7,代码来源:SawmillProduce.cs


示例6: CheckBuilding

        private bool CheckBuilding( Building b )
        {
            // Only check for power traders
            var p = b.TryGetComp<CompPowerTrader>();
            if( p == null )
                return false;

            // That are connected to a power network
            if( p.PowerNet == null )
                return false;

            // Which aren't powered on
            if( p.PowerOn == true )
                return false;

            // Which want to be powered on
            if( p.DesirePowerOn == false )
                return false;

            /*
            // Batteries on network, don't worry about it for now
            if( p.PowerNet.CurrentStoredEnergy() >= 1 )
                return false;

            // Where the network power is too low
            var netEnergy = p.PowerNet.CurrentEnergyGainRate() / CompPower.WattsToWattDaysPerTick;
            if( netEnergy > -p.EnergyOutputPerTick )
                return false;
            */

            // And return this building is under powered
            return true;
        }
开发者ID:DAOWAce,项目名称:CommunityCoreLibrary,代码行数:33,代码来源:Alert_NeedBatteries.cs


示例7: LateUpdate

    //Late update so units can move before checking building position
    private void LateUpdate()
    {
        if (_selectedBuilding == null || _buildingPreview == null)
            return;

        if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 200, LayerMask.GetMask("Ground")))
        {
            _buildingPreview.transform.position = hit.point;

            if (hit.point != _lastPosition)
            {
                _lastPosition = hit.point;
                _canBuild = _selectedBuilding.isBuildPositionValid;
                if (_canBuild)
                    _selectedBuilding.SetModelColor(Color.green);
                else
                    _selectedBuilding.SetModelColor(Color.red);

            }

            if (Input.GetMouseButtonUp(0) && _canBuild)
            {
                //Take resources
                //Send signal to other player(s)
                _selectedBuilding.Place();
                _selectedBuilding = null;
                _buildingPreview = null;
            }
        }
    }
开发者ID:mennolp098,项目名称:multiplayer-rts,代码行数:31,代码来源:BuildingControls.cs


示例8: BuildingIsFinished

        public bool BuildingIsFinished(Building building)
        {
            var value = building.PercentComplete >= 100;
                //&& !building.IsCompleted; // TODO: Remove if not needed

            return value;
        }
开发者ID:CompulsiveCoder,项目名称:TileSim,代码行数:7,代码来源:BuildActivity.cs


示例9: AddBuilding

 public void AddBuilding(Building building)
 {
     if (!buildings.Contains (building))
     {
         buildings.Add (building);
     }
 }
开发者ID:dujos,项目名称:TowerD,代码行数:7,代码来源:EntitiesManager.cs


示例10: FillSprite

 public float FillSprite(Building build)
 {
     //Debug.Log("Oryginal: " + (float)(build.InConstruction.Oryginalspan.TotalSeconds));
     //Debug.Log("Sub: " + build.InConstruction.getTotalSecondSub());
     //Debug.Log("TIME: " + (float)(build.InConstruction.getTotalSecondSub() / build.InConstruction.Oryginalspan.TotalSeconds));
     return (float)(build.InConstruction.getTotalSecondSub() / build.InConstruction.Oryginalspan.TotalSeconds);
 }
开发者ID:Lukasz199312,项目名称:ClickCraft,代码行数:7,代码来源:BuildViewScene.cs


示例11: Place

    //Place a building on specific location
    public void Place(Building building, int x, int y, int rotation, int lastCollection)
    {
        Vector3 newPosition = building.transform.localPosition;
        newPosition.x = x*squareSize.x + building.size.x/2;
        newPosition.z = y*squareSize.y + building.size.y/2;
        building.transform.localPosition = newPosition;
        building.setConflict(!isFree ());
        building.setCoordinates (x, y);
        building.rotation = rotation;
        building.lastCollection = lastCollection;
        buildingManager.addBuilding (building);

        //rotate
        //print ("The rotation is " + rotation.ToString());
        for (int i=0; i<rotation; i++) {
            building.rotate();
        }

        //mark ground taken
        for (int i = 0; i < building.size.x/squareSize.x; i++) {
            for (int j = 0; j < building.size.y/squareSize.y; j++) {
                grid[x+i,y+j] = true;
                highlightGrid[x+i, y+j].renderer.material = redMat;
            }
        }

        HashSet<int> unlocks = building.getUnlockSet ();
        foreach (BuildingButton b in buttons) {
            if (unlocks.Contains(b.prefab.buildingType)) {
                b.prefab.locked = false;
            }
        }
    }
开发者ID:lucyktan,项目名称:ItTakesAVillage,代码行数:34,代码来源:BuildingPlacer.cs


示例12: GetCitizenIncome

        public void GetCitizenIncome(CitizenUnit.Flags flags, Building buildingData, ref int income, ref int tourists)
        {
            int level = 0;
            UnlockManager um = Singleton<UnlockManager>.instance;
            if (!um.Unlocked(ItemClass.SubService.PublicTransportMetro))
            {
                level += 1;
                if (!um.Unlocked(ItemClass.Service.PublicTransport))
                {
                    level += 1;
                    if (!um.Unlocked(ItemClass.Service.HealthCare))
                    {
                        level += 1;
                    }
                }
            }

            CitizenManager instance = Singleton<CitizenManager>.instance;
            uint num = buildingData.m_citizenUnits;
            int num2 = 0;
            while (num != 0u)
            {
                if ((ushort)(instance.m_units.m_buffer[(int)((UIntPtr)num)].m_flags & flags) != 0)
                {
                    GetCitizenIncome(instance.m_units.m_buffer[(int)((UIntPtr)num)], level, ref income, ref tourists);
                }
                num = instance.m_units.m_buffer[(int)((UIntPtr)num)].m_nextUnit;
                if (++num2 > 524288)
                {
                    CODebugBase<LogChannel>.Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace);
                    break;
                }
            }
        }
开发者ID:HaoYuan90,项目名称:Cities-Skylines-Extended-Building-Info,代码行数:34,代码来源:CitizenHelper.cs


示例13: RenderInstance

 public static void RenderInstance(ref Building b, RenderManager.CameraInfo cameraInfo, ushort buildingID,
     int layerMask)
 {
     if ((b.m_flags & (Building.Flags.Created | Building.Flags.Deleted | Building.Flags.Hidden)) != Building.Flags.Created)
         return;
     BuildingInfo info = b.Info;
     //begin mod
     if (info == null)
     {
         return;
     }
     var ai = info.m_buildingAI;
     if ((layerMask & 1 << info.m_prefabDataLayer) == 0 && !(ai is PlayerBuildingAI || ai is DecorationBuildingAI/* || ai is DummyBuildingAI*/)) //TODO(earalov): do we need to uncomment that?
         //end mod
         return;
     Vector3 point = b.m_position;
     float radius = info.m_renderSize + (float)b.m_baseHeight * 0.5f;
     point.y += (float)(((double)info.m_size.y - (double)b.m_baseHeight) * 0.5);
     if (!cameraInfo.Intersect(point, radius))
         return;
     RenderManager instance = Singleton<RenderManager>.instance;
     uint instanceIndex;
     if (!instance.RequireInstance((uint)buildingID, 1U, out instanceIndex))
         return;
     RenderInstance(ref b, cameraInfo, buildingID, layerMask, info, ref instance.m_instances[(uint)instanceIndex]);
 }
开发者ID:earalov,项目名称:Skylines-AdaptivePropVisibilityDistance,代码行数:26,代码来源:BuildingDetour.cs


示例14: Serialize

 public static void Serialize(string filename, Configuration config)
 {
     var xmlSerializer = new XmlSerializer(typeof(Configuration));
     try
     {
         using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(filename))
         {
             var configCopy = new Configuration();
             foreach (var building in config.buildings)
             {
                 var newBuilding = new Building(building.name);
                 foreach (var variation in building.variations.Where(variation => !building.isBuiltIn || !variation.isBuiltIn))
                 {
                     newBuilding.variations.Add(variation);
                 }
                 if (!building.isBuiltIn || newBuilding.variations.Count > 0)
                 {
                     configCopy.buildings.Add(newBuilding);
                 }
             }
             xmlSerializer.Serialize(streamWriter, configCopy);
         }
     }
     catch (Exception e)
     {
         Debug.Log("Couldn't create configuration file at \"" + Directory.GetCurrentDirectory() + "\"");
         throw e;
     }
 }
开发者ID:boformer,项目名称:BetterUpgrade,代码行数:29,代码来源:Configuration.cs


示例15: drawOutlines

 private void drawOutlines(Building<int> result)
 {
     if (result == null) return;
     int c = result.Data.Count;
     for (int i = 0; i < c - 2; i = i + 2)
     {
         if (i == 0)
         {
             System.Windows.Point p1 = new System.Windows.Point(result[i], 0);
             System.Windows.Point p2 = new System.Windows.Point(result[i], result[i + 1]);
             System.Windows.Point p3 = new System.Windows.Point(result[i + 2], result[i + 1]);
             drawingLine(p1, p2, Colors.Red, true);
             drawingLine(p2, p3, Colors.Red, true);
         }
         else
         {
             System.Windows.Point p1 = new System.Windows.Point(result[i], result[i - 1]);
             System.Windows.Point p2 = new System.Windows.Point(result[i], result[i + 1]);
             System.Windows.Point p3 = new System.Windows.Point(result[i + 2], result[i + 1]);
             drawingLine(p1, p2, Colors.Red, true);
             drawingLine(p2, p3, Colors.Red, true);
         }
     }
     if (c > 0)
     {
         System.Windows.Point p1 = new System.Windows.Point(result[c - 2], result[c - 3]);
         System.Windows.Point p2 = new System.Windows.Point(result[c - 2], 0);
         drawingLine(p1, p2, Colors.Red, true);
     }
 }
开发者ID:hszeng,项目名称:GeneralSolution,代码行数:30,代码来源:MainWindow.xaml.cs


示例16: RemoveBuilding

 public void RemoveBuilding(Building building)
 {
     if (buildings.Contains (building))
     {
         buildings.Remove (building);
     }
 }
开发者ID:dujos,项目名称:TowerD,代码行数:7,代码来源:EntitiesManager.cs


示例17: Start

 // Use this for initialization
 void Start()
 {
     currHealth = MaxHealth;
     HealthBar = GameObject.FindGameObjectWithTag ("unit");
     plane=GameObject.Find("Plane");
     b=plane.GetComponent<Building>();
 }
开发者ID:TangoDevs,项目名称:Mock1,代码行数:8,代码来源:HealthUnit.cs


示例18: InitialiseWithBuilding

	/**
	 * Set up the building with the given building.
     */
	override public void InitialiseWithBuilding(Building building) {
		resourceLabel.text = ((int)building.Type.cost * BuildingManager.RECLAIM_PERCENTAGE).ToString();
		goldLabel.text =  ((int)Mathf.Max(1.0f, (int)(building.Type.cost * BuildingManager.GOLD_SELL_PERCENTAGE))).ToString ();
		buildingSprite.spriteName = building.Type.spriteName;
		messageLabel.text = string.Format ("         Are you sure you want to sell your {0} for {1} resources?", building.Type.name, (BuildingManager.GOLD_SELL_PERCENTAGE <= 0 ? "": "gold or "));
		if (BuildingManager.GOLD_SELL_PERCENTAGE <= 0) sellForGoldButton.SetActive(false);
	}
开发者ID:YooghurtEnterprises,项目名称:War_of_Rebels,代码行数:10,代码来源:UISellBuildingPanel.cs


示例19: BuildingIntoRoom

        public roomInfo BuildingIntoRoom(Building thisBuilding)
        {
            roomInfo ThisRoom = new roomInfo();

            ThisRoom.RoomName = thisBuilding.BuildingName;
            ThisRoom.Description = thisBuilding.Description;
            ThisRoom.AltDescription = thisBuilding.AltDescription;
            ThisRoom.CanMove = thisBuilding.CanMove;
            ThisRoom.LockedIn = thisBuilding.LockedIn;
            ThisRoom.SuicideAction = thisBuilding.SuicideAction;
            //ThisRoom.ImagePath = thisBuilding.ImagePath;

            ThisRoom.Events = new List<Event>();
            ThisRoom.Civilians = new List<CivilianProfile>();
            ThisRoom.items = new List<itemInfo>();
            ThisRoom.Enemy = new List<EnemyProfile>();

            DataTypes dt = new DataTypes();

            if (thisBuilding.Events != null) foreach (Event newEvent in thisBuilding.Events) { ThisRoom.Events.Add(dt.CloneEvent(newEvent)); }
            if (thisBuilding.Civilians != null) foreach (CivilianProfile NPC in thisBuilding.Civilians) { ThisRoom.Civilians.Add(dt.CloneNPC(NPC)); }
            if (thisBuilding.items != null) foreach (itemInfo NewItem in thisBuilding.items) { ThisRoom.items.Add(dt.CloneItem(NewItem)); }
            if (thisBuilding.Enemy != null) foreach (EnemyProfile Enemy in thisBuilding.Enemy) { ThisRoom.Enemy.Add(dt.CloneEnemy(Enemy)); }

            return ThisRoom;
        }
开发者ID:joevandebilt,项目名称:Legend-Of-Drongo,代码行数:26,代码来源:DataTypes.cs


示例20: OnMouseDownSimulation

    void OnMouseDownSimulation()
    {
        island = this.transform.parent.parent.parent.gameObject.GetComponent<MinorIsland>();
        building = GameObject.Find(island.nameBuildingTouched).GetComponent<Building>();
        island.nameBuildingTouched = string.Empty;

        if (this.name == "Upgrade")
        {
            if (building.level < 3)
            {

                island.buildingInfoPresent = false;
                island.createChallengeUpgrade(building);
                island.challengePresent = true;

                //To be cheked
                this.Client.sendData("@[email protected]" + (100*(building.level + 1)).ToString());
            }
            else
            {
                island.displayPopup("Ce bâtiment est déjà au niveau maximal !", 3);
                //StartCoroutine(island.destroyPopup(island.createPopup("Ce bâtiment est déjà au niveau maximal !"), 3));
            }
        }

        island.upgradeBuildingInfoPresent = false;
        Destroy(GameObject.Find(this.transform.parent.parent.name));
    }
开发者ID:TerisseNicolas,项目名称:Archip3l,代码行数:28,代码来源:UpgradeBuilding.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# BuildingBlock类代码示例发布时间:2022-05-24
下一篇:
C# BuilderRef类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap