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


C# GameObject.RemoveComponent方法代码示例

本文整理汇总了C#中GameObject.RemoveComponent方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.RemoveComponent方法的具体用法?C# GameObject.RemoveComponent怎么用?C# GameObject.RemoveComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameObject的用法示例。


在下文中一共展示了GameObject.RemoveComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

 // Use this for initialization
 void Start()
 {
     cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
     cube.transform.parent = this.gameObject.transform;
     cube.transform.localPosition = new Vector3(0, 3f, 0);
     cube.transform.localScale = new Vector3(1, .25f, 0f);
     cube.RemoveComponent<BoxCollider>();
     cube.GetComponent<MeshRenderer>().material.color = new Color(.6f, 0f, 0f, .5f);
     cube.GetComponent<MeshRenderer>().material.shader = Shader.Find("Transparent/Cutout/Soft Edge Unlit");
     cube.transform.localRotation = new Quaternion();
     cube.EnsureComponent<LookAtCamera>();
 }
开发者ID:TreyWheeler,项目名称:ProjectLilith,代码行数:13,代码来源:HealthArch.cs

示例2: HarvestHarvestable

 private static bool HarvestHarvestable(HarvestPlant ths, GameObject harvestable, Sim actor, BurglarSituation burglarSituation)
 {
     if (harvestable == null)
     {
         return false;
     }
     harvestable.SetOwnerLot(actor.LotHome);
     harvestable.UnParent();
     harvestable.RemoveFromWorld();
     bool flag = false;
     if (burglarSituation == null)
     {
         if (actor.Inventory.TryToAdd(harvestable, false))
         {
             flag = true;
         }
     }
     else
     {
         burglarSituation.StolenObjects.Add(harvestable);
         burglarSituation.CurrentValue += harvestable.Value;
         flag = true;
     }
     if (flag)
     {
         harvestable.AddFlags(GameObject.FlagField.WasHarvested);
         harvestable.RemoveComponent<HarvestableComponent>();
         ths.PostHarvestHarvestable(actor, harvestable);
         return flag;
     }
     harvestable.Destroy();
     return flag;
 }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:33,代码来源:HarvestEx.cs

示例3: WhenComponentIsRemovedThenExecutionOrderIsUpdated

        public void WhenComponentIsRemovedThenExecutionOrderIsUpdated()
        {
            var updateOrder = new List<int>();
            DualityApp.AppData = new DualityAppData();
            Scene.SetComponentExecutionOrder(typeof(ComponentTwo), typeof(ComponentOne), typeof(ComponentThree));

            var gameObject = new GameObject();
            gameObject.AddComponent(new ComponentOne(updateOrder));
            gameObject.AddComponent(new ComponentTwo(updateOrder));
            gameObject.AddComponent(new ComponentFour(updateOrder));

            Scene.Current.AddObject(gameObject);

            gameObject.RemoveComponent<ComponentOne>();

            Scene.Current.Update();

            Assert.True(updateOrder.SequenceEqual(new[] { 2, 4 }));
        }
开发者ID:BraveSirAndrew,项目名称:duality,代码行数:19,代码来源:ComponentExecutionOrderTests.cs


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