private void Fire() { GameObject shot = GameObjectUtil.Instantiate(firePreFabs, transform.position); GameObjectUtil.Destroy(shot, timeBeforeDestroyShots); switch (direction) { case Direction.Up: shot.GetComponent <FireScript>().Shot(FireScript.Direction.Up); break; case Direction.Down: shot.GetComponent <FireScript>().Shot(FireScript.Direction.Down); break; case Direction.Right: shot.GetComponent <FireScript>().Shot(FireScript.Direction.Right); break; case Direction.Left: shot.GetComponent <FireScript>().Shot(FireScript.Direction.Left); break; default: break; } }
private void CleanMap() { for (int i = 0; i < mapHolder.transform.childCount; i++) { GameObjectUtil.Destroy(mapHolder.transform.GetChild(i).gameObject); } }
private void CleanMapList() { for (int i = 0; i < transform.childCount; i++) { GameObjectUtil.Destroy(transform.GetChild(i).gameObject); } }
private void cleanObjectChilren(GameObject obj) { foreach (Transform child in obj.transform) { GameObjectUtil.Destroy(child.gameObject); } }
public static void DestroyItems(this IEnumerable <GameObject> list) { for (int i = list.Count() - 1; i >= 0; --i) { GameObjectUtil.Destroy(list.ElementAt(i)); } }
// Update is called once per frame void Update() { if (health <= 0) { health = saveHealth; GameObjectUtil.Destroy(this.gameObject); } }
void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.tag == "Enemy" || coll.gameObject.tag == "Wall" || coll.gameObject.tag == "Obstacles" || coll.gameObject.tag == "Floor") { GameObjectUtil.Destroy(this.gameObject); } }
public void OutofBounds() { offScreen = false; GameObjectUtil.Destroy(gameObject); if (DestroyCallback != null) { DestroyCallback(); } }
public void OnOutOfBounds() { offscreen = false; GameObjectUtil.Destroy(gameObject); if (DestroyCallBack != null) { DestroyCallBack(); } }
private void Update() { if (!animation.isPlaying && m_prevIsPlaying) { GameObjectUtil.Destroy(gameObject); } m_prevIsPlaying = animation.isPlaying; }
private void Start() { gameManager = GameObjectUtil.GetSingleton <GameManager>(); platformDetectionUtil = GameObjectUtil.GetSingleton <PlatformDetectionUtil>(); // If it's on a console don't show this GameObject if (platformDetectionUtil.GetPlatformDefinition().deviceType == DeviceType.Console) { GameObjectUtil.Destroy(gameObject); } }
void OnOutOfBounds() { offScreen = false; GameObjectUtil.Destroy(gameObject); if (destroyCallBack != null) { destroyCallBack(); } }
public void OnOutOfBounds() { offscreen = false; GameObjectUtil.Destroy(gameObject); contadorFuera++; if (DestroyCallback != null) { DestroyCallback(); } }
void DestroyObject() { offscreen = false; GameObjectUtil.Destroy(gameObject); if (OnDestroyCallback != null) { OnDestroyCallback(); } }
// Update is called once per frame void Update() { endx = rbody.position.x; // endy = rbody.position.y; - not used JT if (Mathf.Abs(endx - startx) > maxDistance) // Changed 30 to maxDistance { GameObjectUtil.Destroy(this.gameObject); } }
//"Destroy" the object public void OnOutOfBounds() { //Debug.Log("Out of bounds"); offscreen = false; GameObjectUtil.Destroy(gameObject); if (DestroyCallBack != null) { DestroyCallBack(); } }
public void OnOutOfBounds() { offscreen = false; GameObjectUtil.Destroy(gameObject); // If a method has been connected to the property, call the method if (DestroyCallback != null) { DestroyCallback(); } }
public void OnOutOfBounds() { offscreen = false; // destroys the game object to which this script is attached GameObjectUtil.Destroy(gameObject); if (DestroyCallback != null) { DestroyCallback(); } }
void OnCollisionEnter(Collision col) { ComponentHealth a; if (col.gameObject.GetComponent <ComponentHealth>() != null) { a = col.gameObject.GetComponent <ComponentHealth>(); a.Damage(m_dmg); } GameObjectUtil.Destroy(gameObject); }
public void OnOutOfBounds() { offscreen = false; GameObjectUtil.Destroy(gameObject); //this will be define in the game manager if (DestroyCallback != null) { DestroyCallback(); } }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.layer == LayerMask.NameToLayer("MovingTiles")) { other.GetComponent <MoveingBox>().move(); GameObjectUtil.Destroy(gameObject); } else if (other.gameObject.layer == LayerMask.NameToLayer("NonMovingTiles")) { GameObjectUtil.Destroy(gameObject); } }
/// <summary> /// 处理离开游戏可活动区域(屏幕范围)的对象 /// </summary> void OnOutOfBounds() { // 重置该游戏对象是否离开屏幕范围的标识为 false offScreen = false; GameObjectUtil.Destroy(gameObject); // 调用监听 OnDestroy() 的回调方法 if (null != DestroyCallback) { DestroyCallback(); } }
// Update is called once per frame void Update() { var posX = transform.position.x; var worldUnits = Screen.width / PixelPerfect.pixelsToUnit; var halfWorldUnits = worldUnits / 2; if (posX < 0 && (Mathf.Abs(posX) > (halfWorldUnits + padding))) { print("half world units" + halfWorldUnits + "," + (halfWorldUnits + padding) + "," + posX); //DestroyObject(gameObject); GameObjectUtil.Destroy(gameObject); } }
void OutOfBounds() { offscreen = false; GlobalSettings.Instance.ActiveObjects.Remove(gameObject.name); GameObjectUtil.Destroy(gameObject); if (DestroyCallback != null) { DestroyCallback(); } }
static int Destroy(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); UnityEngine.Object arg0 = (UnityEngine.Object)ToLua.CheckObject <UnityEngine.Object>(L, 1); GameObjectUtil.Destroy(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public void OnOutOfBounds() { // handles object going offscreen // Current offScreen = false line is future-proofing for when we reuse this object later offScreen = false; GameObjectUtil.Destroy(gameObject); if (DestroyCallback != null) { DestroyCallback(); // call this as if it were a method } }
private void Update() { if (particleSystem.isPlaying) { m_hasPlayed = true; } else if (m_hasPlayed) { if (childParticleSystems.All(x => x.isStopped)) { GameObjectUtil.Destroy(gameObject); } } }
// Update is called once per frame private void Update() { if (readyToDissapear) { t += Time.deltaTime; spriteRenderer.material.color = Color.Lerp(start, end, t / 2); GetComponent <Rigidbody2D>().velocity = new Vector2(-95, GetComponent <Rigidbody2D>().velocity.y); if (spriteRenderer.material.color.a <= 0.0) { GameObjectUtil.Destroy(gameObject); } } }
private void Start() { //soundManager = GameObjectUtil.GetSingleton<SoundManager>(); platformDetectionUtil = GameObjectUtil.GetSingleton <PlatformDetectionUtil>(); //TODO need to add in way to save mute // If it's on a console don't show this GameObject if (platformDetectionUtil.GetPlatformDefinition().deviceType == DeviceType.Console) { GameObjectUtil.Destroy(gameObject); } UpdateLabel(); }
void Update() { if (Input.GetKeyDown(KeyCode.A)) { GameObjectUtil.Destroy(player); if (DestroyCallback != null) { DestroyCallback(); } } if (!gameStarted && Time.timeScale == 0) { if (Input.GetKeyDown(KeyCode.Z)) { timeManager.ManipulateTime(1, 1.0f); ResetGame(); } } }