private void OnTriggerExit(Collider other) { if (other.CompareTag("Player") && this._hasPlayer) { this._hasPlayer = false; if (this._activeWarmth) { LocalPlayer.GameObject.SendMessage("LeaveHomeWarmth"); } } if (other.CompareTag("FireTrigger") && this._activeWarmth) { Transform transform = base.GetComponentInParent<PrefabIdentifier>().transform; bool activeWarmth = this._activeWarmth; this._activeWarmth = false; int childCount = transform.childCount; for (int i = 0; i < childCount; i++) { Fire2 componentInChildren = transform.GetChild(i).GetComponentInChildren<Fire2>(); if (componentInChildren && componentInChildren.Lit && base.GetComponent<Collider>().bounds.Contains(componentInChildren.transform.position)) { this._activeWarmth = true; break; } } if (this._hasPlayer && activeWarmth != this._activeWarmth) { LocalPlayer.GameObject.SendMessage((!this._activeWarmth) ? "LeaveHomeWarmth" : "HomeWarmth"); } } }
void OnTriggerEnter(Collider other) { if(!sequenceToPlay) { Debug.LogWarning("You have triggered a sequence in your scene, however, you didn't assign it a Sequence To Play", gameObject); return; } if(sequenceToPlay.IsPlaying) return; if(other.CompareTag("MainCamera") && isMainCameraTrigger) { sequenceToPlay.Play(); return; } if(other.CompareTag("Player") && isPlayerTrigger) { sequenceToPlay.Play(); return; } if(other.gameObject == triggerObject) { sequenceToPlay.Play(); return; } }
// 「Trigger」のコライダー接触時に呼ばれるコールバック void OnTriggerEnter(Collider collider) { if (collider.CompareTag ("Enemy")) { animator.SetTrigger ("Dead"); DoneGameController.Instance.state = DoneGameController.GameState.GameOver; } if (collider.CompareTag ("Goal")) { animator.SetTrigger ("Clear"); DoneGameController.Instance.state = DoneGameController.GameState.GameClear; } }
//check if the character collects the powerups or the snags void OnTriggerEnter(Collider other) { Debug.Log (isGrounded); if(other.CompareTag("Powerup") && isGrounded) { control.PowerupCollected(); } else if(other.CompareTag("Obstacle") && isGrounded) { control.AlcoholCollected(); } Destroy(other.gameObject); }
private void OnHit(Collider other) { if (!other.CompareTag(Tags.Monster)) { if (other.CompareTag(Tags.Hero)) { //TODO: Hero bullet attack battleProxy.DoAttackHero(AttackContext); } Script.SetState(BulletState.After); Script.CallbackUpdate = null; } }
void OnTriggerExit(Collider other) { if (other.CompareTag("Player1_") || other.CompareTag("Player2_") || other.CompareTag("Player3_") || other.CompareTag("Player4_")) { if (m_childStatic.isPlaying) { m_childStatic.Stop(); } if (m_childParticles.isPlaying) { m_childParticles.Stop(); } } }
void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) return; if (Time.time < timer) { if (!targetsAlreadyTouched.Contains(other.gameObject.GetInstanceID())) { IDamageable damageable = other.GetComponent(typeof(IDamageable)) as IDamageable; if (damageable == null) { return; } targetsAlreadyTouched.Add(other.gameObject.GetInstanceID()); damageable.TakeDirectDamage(DoDamage()); //Target spreading. if (damageable is AlienBase) { AlienBase alien = damageable as AlienBase; alien.SetTarget(damageSource.transform); } if (damageable is CocoonSpawner) (damageable as CocoonSpawner).TriggerSpawning(damageSource.transform); } } }
// OnTriggerEnter is called when the Collider other enters the trigger public void OnTriggerEnter(Collider other) { int objLayer = 1 << other.gameObject.layer; if (other.isTrigger && ignoreTriggers || other.CompareTag(playerTag) || (layersToFade & objLayer) != objLayer) return; // Retrieve all the renderers Renderer[] rendererWeHit = other.gameObject.GetComponentsInChildren<Renderer>(); // Loop through the renderers for (int idx = 0; idx < rendererWeHit.Length; idx++) { if (rendererWeHit[idx] != null) // just to be on the safe side :) { // If we changed this already we skip it, otherwise we proceed with the change if (!modifiedShaders.ContainsKey(rendererWeHit[idx].GetInstanceID())) { ShaderData shaderData = new ShaderData(); shaderData.renderer = rendererWeHit[idx]; shaderData.shader = new Shader[rendererWeHit[idx].materials.Length]; shaderData.color = new Color[rendererWeHit[idx].materials.Length]; for (int j = 0; j < rendererWeHit[idx].materials.Length; j++) { shaderData.shader[j] = rendererWeHit[idx].materials[j].shader; if (rendererWeHit[idx].materials[j].HasProperty("_Color")) shaderData.color[j] = rendererWeHit[idx].materials[j].color; rendererWeHit[idx].materials[j].shader = transparentShader; rendererWeHit[idx].materials[j].color = fadingColorToUse; } // Add the shader to the list of those that have been changed modifiedShaders.Add(rendererWeHit[idx].GetInstanceID(), shaderData); } } } }
private void OnTriggerExit(Collider otherCollider) { // Making sure the object we have left is DynamicWater if (_water != null && otherCollider.CompareTag(FluidVolume.DynamicWaterTagName) && otherCollider == _water.Collider) { _water = null; } }
public void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { string savegame = PixelCrushers.DialogueSystem.PersistentDataManager.GetSaveData(); Debug.Log ("Recording: " + savegame); Application.LoadLevel(newLevelName); } }
private void OnTriggerEnter(UnityEngine.Collider other) { if (other.CompareTag("Obstacle")) { isOnGround = true; } }
void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { GameController.NotifyPlayer("Don't forget to save, janitor !", Color.red, 3); } }
void OnTriggerExit(Collider other) { if (String.IsNullOrEmpty(CollisionTag) || other.CompareTag(CollisionTag)) { HandleGameEvent(EmitterGameEvent.TriggerExit); } }
protected override void OnSceneObjectHit(Collider collider) { if(collider.CompareTag(Tags.GameObstacle)) { OnCollisionEventStart(Tags.GameObstacleAway); } }
/// <summary> /// When the gameobject leaves the area, it's repositionned on the other side of the area. /// </summary> /// <param name="other">The leaving gameobject</param> void OnTriggerExit(Collider other) { Transform t = other.transform; if (other.CompareTag(SimHandler.Instance().Parameters.OrganismTag)) { t.position = new Vector3(t.position.x * -1, t.position.y, t.position.z * -1); } }
private void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { other.GetComponent<ShipController>().DealDamage(Damage); Destroy(gameObject); } }
private void OnTriggerExit(Collider other) { if (this._target.enabled && other.CompareTag("Water")) { this._inWater = false; this._target.enabled = false; } }
void OnTriggerExit(Collider collider) { Debug.Log("Collision Exit with " + collider.tag); if (collider.CompareTag("Internal") && m_IsInternal) { InternalModeExitEvent.Invoke(); } }
void SetGrounded(bool value, Collider other) { if (Character == null || other == null) return; if (other.CompareTag("Platform")) { Character.IsGrounded = value; } }
private void OnTriggerEnter(Collider other) { if (this._id >= 0 && other.CompareTag("Grabber")) { LocalPlayer.PassengerManifest.FoundPassenger(this._id); base.GetComponent<Collider>().enabled = false; } }
private void OnTriggerEnter(Collider col) { if (String.IsNullOrEmpty(CollisionTag) || col.CompareTag(CollisionTag)) { _collisionCount++; this.enabled = true; } }
void OnTriggerEnter(Collider hit) { if (hit.CompareTag("Player")) { if (source.clip.name != song.name) { trigger = true; } } }
public override void OnTriggerEnter(Collider otherObject) { Debug.Log("MiningLaser hit " + otherObject.name); //mining laser only damages asteroids if (otherObject.CompareTag("Asteroid")) otherObject.SendMessage("TakeDamage", 1); }
void OnTriggerEnter(Collider other) { if (other.CompareTag("Enemy")) { //TODO: Deal damage to enemy when done // other.GetComponent<Enemy>().DealDamage(damage); Destroy(gameObject); } }
void StateOnTriggerEnter(Collider other) { if (other.CompareTag("Finish")) { m_Audio.Play(); other.gameObject.SetActive(false); m_Count.Value = m_Count.Value + 1; } SendEvent(GlobalBlackboard.FINISHED); }
// If this script is attached to a GameObject with a collider // that has "isTrigger" selected, this callback will fire upon collision. void OnTriggerEnter(Collider other) { if (other.tag == null || !other.CompareTag(objectTag) || scenario == null ) { return; } scenario.TriggerCb (triggerID); }
public void OnTriggerEnter(Collider other) { if(other.CompareTag("Goal")) { m_playerScore += 1; RefreshPlayerNameTag(); m_gameManager.RefreshTopScores(); } }
void OnTriggerExit(Collider target) { for (int i = 0; i < ReactsToTags.Length; i++) { if (target.CompareTag(ReactsToTags[i])) { OnTriggeredExit.Invoke(); OnTransformTriggeredExit.Invoke(target.transform); break; } } }
void OnTriggerEnter(Collider hit) { if (hit.CompareTag("Player")) { for(int i = 0; i < barriers.Count; i++){ barriers[i].SetActive(true); } //player.GetComponent<ROBgui>().tokenRetrieve = true; Destroy(this.gameObject); } }
void OnTriggerEnter(Collider other) { if (other.CompareTag(Tags.Hero)) { if (Icon != null) Icon.gameObject.SetActive(true); if (CallbackEnter != null) CallbackEnter(); } }
void OnTriggerExit(Collider other) { if (other.CompareTag(Tags.Hero)) { if (Icon != null) Icon.gameObject.SetActive(false); if (CallbackExit != null) CallbackExit(); } }
private void OnTriggerExit(UnityEngine.Collider other) { if (other.CompareTag("Boundaries")) { if (SpawnManager.Instance.UsePoolManager) { PoolManager.Instance.Destroy(gameObject); } else { Destroy(gameObject); } } }
private void OnTriggerEnter(UnityEngine.Collider other) { if (other.CompareTag("Player")) { other.transform.position = new Vector3(57.32f, 173, -72.76f); if (flag == 0) { talkFlowchart.ExecuteBlock("goBack"); flag = 1; } else if (!back) { flag = 0; } } }
private void OnTriggerEnter(UnityEngine.Collider other) { if (other.CompareTag("Player")) { for (int i = 0; i < inventory.slots.Length; i++) { if (inventory.isFull[i] == false) { Instantiate(ItemButton, inventory.slots[i].transform); Destroy(gameObject); inventory.isFull[i] = true; break; } } } }
private void OnTriggerEnter(UnityEngine.Collider other) { Instantiate(explosion, transform.position, transform.rotation); if (other.CompareTag("Player")) { Instantiate(playerExplosion, other.transform.position, other.transform.rotation); gameController.GameOver(); } gameController.IncrementScore(valueScore); gameController.increaseKilledEnemies(); Destroy(other.gameObject); Destroy(gameObject); }