本文整理汇总了C#中UnityEngine.GameObject类的典型用法代码示例。如果您正苦于以下问题:C# GameObject类的具体用法?C# GameObject怎么用?C# GameObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GameObject类属于UnityEngine命名空间,在下文中一共展示了GameObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: hide
void hide(GameObject bt)
{
messageBox.gameObject.SetActive(false);
blurPanel.gameObject.SetActive(false);
info.show = false;
isShow = false;
}
开发者ID:zhendery,项目名称:FiveVsFive,代码行数:7,代码来源:MessageBox.cs
示例2: ISWeapon
public ISWeapon(int durability, int maxDurability, ISEquipmentSlot equipmentSlot, GameObject prefab)
{
_durability = durability;
_maxDurability = maxDurability;
_equipmentSlot = equipmentSlot;
_prefab = prefab;
}
开发者ID:zachstratton,项目名称:ItemSytem,代码行数:7,代码来源:ISWeapon.cs
示例3: SubmitLap
public void SubmitLap(GameObject car, int team)
{
switch (team)
{
case 1:
if (m_LapTimeTeamOne >= 60.0f)
{
m_LapsTeamOne += 1;
m_LapTimeTeamOne = 0.0f;
}
break;
case 2:
if (m_LapTimeTeamTwo >= 60.0f)
{
m_LapsTeamTwo += 1;
m_LapTimeTeamTwo = 0.0f;
}
break;
}
if (m_LapsTeamOne >= 2)
{
instance.SubmitGameResults(m_TeamOneWon);
}
if (m_LapsTeamTwo >= 2)
{
instance.SubmitGameResults(m_TeamTwoWon);
}
}
开发者ID:stijndelaruelle,项目名称:glupartygame,代码行数:30,代码来源:GameController.cs
示例4: PlayState2
//private PlayerScript controller;
public PlayState2 (StateManager managerRef)
{ //Constructor
manager = managerRef;
Debug.Log ("Constructing PlayState2");
manager.darkState = false;
"Stage2".LoadScene ();
//if (Application.loadedLevelName != "Stage2")
// Application.LoadLevel ("Stage2");
StaticMethods.SetOneActive ("Following Camera", manager.gameDataRef.cameras); //Camera that follows the Player, setOneActive method
player = GameObject.FindGameObjectWithTag ("Player"); //the Player GameObject is now active and can be found
player.GetComponent<Rigidbody2D> ().isKinematic = false; //Player is now affected by physics
player.transform.SetPositionXY (-6.0f, -0.4f); //set starting position for Player
skin = Resources.Load ("GUISkin") as GUISkin;
//darkness = GameObject.FindGameObjectWithTag ("Darkness");
//dark.a += 0f;
//darkness.GetComponent<Renderer>().material.color = dark;
//darkness.GetComponent<Renderer>().material.color.a;
//Color dark = darkness.renderer.material.color;
//dark.a -= 0;
//darkness.renderer.material.color = color;
}
开发者ID:katerinakat,项目名称:Platform_Game,代码行数:29,代码来源:PlayState2.cs
示例5: UpdateTime
public override void UpdateTime(GameObject Actor, float runningTime, float deltaTime)
{
Animation animation = Actor.GetComponent<Animation>();
if (!animation || animationClip == null)
{
return;
}
if (animation[animationClip.name] == null)
{
animation.AddClip(animationClip, animationClip.name);
}
AnimationState state = animation[animationClip.name];
if (!animation.IsPlaying(animationClip.name))
{
animation.wrapMode = wrapMode;
animation.Play(animationClip.name);
}
state.time = runningTime;
state.enabled = true;
animation.Sample();
state.enabled = false;
}
开发者ID:EJ10,项目名称:CinemaActionProjectTest,代码行数:27,代码来源:PlayAnimationEvent.cs
示例6: CreatePulse
public static void CreatePulse(MenuCommand menuCommand)
{
var pulse = new GameObject("Pulse", typeof(Pulse));
GameObjectUtility.SetParentAndAlign(pulse, menuCommand.context as GameObject);
Undo.RegisterCreatedObjectUndo(pulse, "Create " + pulse.name);
Selection.activeGameObject = pulse;
}
开发者ID:CarlosMeloStuff,项目名称:PulseSequencer,代码行数:7,代码来源:PulseEditorHelpers.cs
示例7: DoAddComponent
void DoAddComponent(GameObject go)
{
addedComponent = go.AddComponent(script.Value);
if (addedComponent == null)
ActionHelpers.RuntimeError(this, "Can't add script: " + script.Value);
}
开发者ID:AlexanderUrbano,项目名称:shapewars,代码行数:7,代码来源:AddScript.cs
示例8: SetTag
void SetTag(GameObject parent)
{
if (parent == null)
{
return;
}
if (string.IsNullOrEmpty(filterByComponent.Value)) // do all children
{
foreach (Transform child in parent.transform)
{
child.gameObject.tag = tag.Value;
}
}
else
{
UpdateComponentFilter();
if (componentFilter != null) // filter by component
{
var root = parent.GetComponentsInChildren(componentFilter);
foreach (var child in root)
{
child.gameObject.tag = tag.Value;
}
}
}
Finish();
}
开发者ID:ChetahPangestu,项目名称:MajorProjectReveal,代码行数:30,代码来源:SetTagsOnChildren.cs
示例9: GetActive
public bool GetActive(GameObject go){
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
return go.active;
#else
return go.activeInHierarchy;
#endif
}
开发者ID:watapax,项目名称:Antartica_AR,代码行数:7,代码来源:MB3_MBVersionConcrete.cs
示例10: Awake
void Awake()
{
player = GameObject.FindGameObjectWithTag ("Player");
pHealth = player.GetComponent<PlayerHealth> ();
eHealth = GetComponent<EnemyHealth> ();
eMove = GetComponent<EnemyMovement> ();
}
开发者ID:ltrout,项目名称:TankBattle,代码行数:7,代码来源:EnemyAttack_Med.cs
示例11: SpawnCloud
void SpawnCloud()
{
if (BoilerLid.lidIsOpen)
{
spawnedCloud = Instantiate(cloudToSpawn, new Vector3(-5.02f, 18.8f, 5.03f), transform.rotation) as GameObject;
}
}
开发者ID:Dawnwoodgames,项目名称:LotsOfTowers,代码行数:7,代码来源:FireWood.cs
示例12: Start
void Start()
{
container = new GameObject("_ObjectPool");
if (prefabsToPool == null) return;
// AUTOPOOL: Find all Destructible objects with DestroyedPrefabs in the scene that have Auto-Pool set to TRUE.
Destructible[] destructibleObjectsInScene = FindObjectsOfType<Destructible>();
autoPooledObjects = new Dictionary<int, GameObject>();
AddDestructibleObjectsToPool(destructibleObjectsInScene);
// Instantiate game objects from the PrefabsToPool list and add them to the Pool.
Pool = new GameObject[prefabsToPool.Count][];
for (int i = 0; i < prefabsToPool.Count; i++)
{
PoolEntry poolEntry = prefabsToPool[i];
Pool[i] = new GameObject[poolEntry.Count];
for (int n=0; n<poolEntry.Count; n++)
{
if (poolEntry.Prefab == null) continue;
var newObj = Instantiate(poolEntry.Prefab);
newObj.name = poolEntry.Prefab.name;
PoolObject(newObj);
}
}
}
开发者ID:tegleg,项目名称:mfp,代码行数:25,代码来源:ObjectPool.cs
示例13: DoSetFsmGameObject
void DoSetFsmGameObject()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null)
{
return;
}
if (go != goLastFrame)
{
goLastFrame = go;
// only get the fsm component if go has changed
fsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);
}
if (fsm == null)
{
return;
}
var fsmGameObject = fsm.FsmVariables.GetFsmGameObject(variableName.Value);
if (fsmGameObject != null)
{
fsmGameObject.Value = setValue == null ? null : setValue.Value;
}
}
开发者ID:personal-robots,项目名称:storyspace,代码行数:30,代码来源:SetFsmGameObject.cs
示例14: ComputeHull
public static int ComputeHull(GameObject gameObject, FracturedObject fracturedObject)
{
int nTotalTriangles = 0;
if(ComputeHull(gameObject, fracturedObject.ConcaveColliderAlgorithm, fracturedObject.ConcaveColliderMaxHulls, fracturedObject.ConcaveColliderMaxHullVertices, fracturedObject.ConcaveColliderLegacySteps, fracturedObject.Verbose, out nTotalTriangles) == false)
{
if(fracturedObject.ConcaveColliderAlgorithm == FracturedObject.ECCAlgorithm.Fast)
{
// Fast failed. Try with normal.
if(fracturedObject.Verbose)
{
Debug.Log(gameObject.name + ": Falling back to normal convex decomposition algorithm");
}
if(ComputeHull(gameObject, FracturedObject.ECCAlgorithm.Normal, fracturedObject.ConcaveColliderMaxHulls, fracturedObject.ConcaveColliderMaxHullVertices, fracturedObject.ConcaveColliderLegacySteps, fracturedObject.Verbose, out nTotalTriangles) == false)
{
if(fracturedObject.Verbose)
{
Debug.Log(gameObject.name + ": Falling back to box collider");
}
}
}
}
return nTotalTriangles;
}
开发者ID:cxtadment,项目名称:Mobile-Game---Free-Mind,代码行数:26,代码来源:ConcaveColliderInterface.cs
示例15: SetActiveRecursively
public void SetActiveRecursively(GameObject go, bool isActive){
#if UNITY_3_0 || UNITY_3_0_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5
go.SetActiveRecursively(isActive);
#else
go.SetActive(isActive);
#endif
}
开发者ID:watapax,项目名称:Antartica_AR,代码行数:7,代码来源:MB3_MBVersionConcrete.cs
示例16: CreatePattern
public static void CreatePattern(MenuCommand menuCommand)
{
var pattern = new GameObject("Pattern", typeof(Pattern));
GameObjectUtility.SetParentAndAlign(pattern, menuCommand.context as GameObject);
Undo.RegisterCreatedObjectUndo(pattern, "Create " + pattern.name);
Selection.activeGameObject = pattern;
}
开发者ID:CarlosMeloStuff,项目名称:PulseSequencer,代码行数:7,代码来源:PulseEditorHelpers.cs
示例17: PickupCoin
public void PickupCoin(GameObject coin)
{
this._pickupSound.Play();
Player.Instance.Points += 10;
DestroyObject(coin);
this.CreateNewCoin();
}
开发者ID:SHEePYTaGGeRNeP,项目名称:GTO4Mobile,代码行数:7,代码来源:GameManager.cs
示例18: Start
void Start(){
if(cursorIndicatorMode!=_CursorIndicatorMode.None){
if(indicatorBuildPoint!=null){
indicatorBuildPoint=(GameObject)Instantiate(indicatorBuildPoint);
indicatorBuildPoint.transform.localScale=new Vector3(gridSize, 1, gridSize);
indicatorBuildPoint.transform.parent=transform;
indicatorBuildPoint.SetActive(false);
indicatorCursor.name="TileIndicator_BuildPoint";
foreach(Transform child in indicatorBuildPoint.transform)
indicatorBuildPointRen=child.GetComponent<Renderer>();
}
if(indicatorCursor!=null){
indicatorCursor=(GameObject)Instantiate(indicatorCursor);
indicatorCursor.transform.localScale=new Vector3(gridSize, 1, gridSize);
indicatorCursor.transform.parent=transform;
indicatorCursor.SetActive(false);
indicatorCursor.name="TileIndicator_Cursor";
foreach(Transform child in indicatorCursor.transform)
indicatorCursorRen=child.GetComponent<Renderer>();
}
}
InitiateSampleTowerList();
}
开发者ID:jrobison93,项目名称:Museum-of-Aviation-Exhibit,代码行数:27,代码来源:BuildManager.cs
示例19: OnParticleCollision
private void OnParticleCollision(GameObject other)
{
int safeLength = m_ParticleSystem.GetSafeCollisionEventSize();
if (m_CollisionEvents.Length < safeLength)
{
m_CollisionEvents = new ParticleCollisionEvent[safeLength];
}
int numCollisionEvents = m_ParticleSystem.GetCollisionEvents(other, m_CollisionEvents);
int i = 0;
while (i < numCollisionEvents)
{
if (Time.time > lastSoundTime + 0.2f)
{
lastSoundTime = Time.time;
}
var col = m_CollisionEvents[i].collider;
var attachedRigidbody = col.GetComponent<Rigidbody>();
if (attachedRigidbody != null)
{
Vector3 vel = m_CollisionEvents[i].velocity;
attachedRigidbody.AddForce(vel*force, ForceMode.Impulse);
}
other.BroadcastMessage("Extinguish", SendMessageOptions.DontRequireReceiver);
i++;
}
}
开发者ID:CaptainStouf,项目名称:TheKinectAwakens,代码行数:32,代码来源:WaterHoseParticles.cs
示例20: SyncUnityHooks
//property nodes
//method nodes
#pragma warning restore 414
//functions to refresh properties from entities
void SyncUnityHooks( )
{
SyncEventListeners( );
if ( null == local_3_UnityEngine_GameObject || false == m_RegisteredForEvents )
{
local_3_UnityEngine_GameObject = GameObject.Find( "LeftHandTouch" ) as UnityEngine.GameObject;
}
//if our game object reference was changed then we need to reset event listeners
if ( local_3_UnityEngine_GameObject_previous != local_3_UnityEngine_GameObject || false == m_RegisteredForEvents )
{
//tear down old listeners
local_3_UnityEngine_GameObject_previous = local_3_UnityEngine_GameObject;
//setup new listeners
}
if ( null == local_4_UnityEngine_GameObject || false == m_RegisteredForEvents )
{
local_4_UnityEngine_GameObject = GameObject.Find( "RightHandTouch" ) as UnityEngine.GameObject;
}
//if our game object reference was changed then we need to reset event listeners
if ( local_4_UnityEngine_GameObject_previous != local_4_UnityEngine_GameObject || false == m_RegisteredForEvents )
{
//tear down old listeners
local_4_UnityEngine_GameObject_previous = local_4_UnityEngine_GameObject;
//setup new listeners
}
}
开发者ID:ruben-farrus,项目名称:the-airport-prototype,代码行数:37,代码来源:HandControls.cs
注:本文中的UnityEngine.GameObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论