Ejemplo n.º 1
0
 void OnTriggerEnter(Collider hit)
 {
     if(hit.GetComponent<ROBgui>()) {
         hit.GetComponent<ROBgui>().messageSet(text);
         Destroy(this.gameObject);
     }
 }
Ejemplo n.º 2
0
 void OnTriggerEnter(Collider _col)
 {
     if(_isColliding) return;
     _isColliding = true;
     if(_col.tag.Equals("Player")) _col.GetComponent<Player.PlayerMove>().Slip(this.transform.forward);
     else if(_col.tag.Equals("Pickup")) _col.GetComponent<Player.ObjectSlider>().Slide(this.transform.forward);
 }
Ejemplo n.º 3
0
 void OnTriggerStay(Collider other)
 {
     if (!targetsBurning.Contains(other.gameObject.GetInstanceID()) && other.GetComponent<LivingEntity>() && other.tag != "Player")
     {
         targetsBurning.Add(other.gameObject.GetInstanceID());
         other.GetComponent<LivingEntity>().TakeDirectDamage(DoDamage());
         Debug.Log(other.tag);
     }
 }
Ejemplo n.º 4
0
 public void OnTriggerEnter(Collider other)
 {
     if(other.gameObject.layer == layerPickup) {
         PickupCargo(other.GetComponent<CargoPickup>());
     }
     if(other.gameObject.layer == layerCity) {
         TryDropoff(other.GetComponent<City>());
     }
 }
Ejemplo n.º 5
0
 void OnTriggerStay(Collider aOther)
 {
     if (!m_isActive) return;
     if (aOther.GetComponent<PhotonView>() != null && aOther.GetComponent<PhotonView>().owner == PhotonNetwork.player)
     {
         GameObject.Find("GameManager").GetComponent<GameManager>().BombPickedUp(aOther.GetComponent<PhotonView>().owner, m_pickupID);
         m_isActive = false;
         Destroy(gameObject);
     }
 }
Ejemplo n.º 6
0
 private void interception(Collider ballCollider)
 {
     // ramasse/intercepte la balle uniquement si le perso a au moins un élément "passe"
     if (ballCollider.transform.parent == null && ballCollider.name == "Ball" && player.Passe != 0 && ballCollider.GetComponent<BallController>().interceptable(gameObject))
     {
         ballCollider.transform.parent = transform.FindChild("perso").transform;
         ballCollider.GetComponent<Collider>().enabled = false;
         ballCollider.transform.localPosition = new Vector3(1.3f, 3, 0);
     }
 }
Ejemplo n.º 7
0
 void OnTriggerExit(Collider coll)
 {
     if (coll.tag == "Player")
     {
         libra.GetComponent<LibraTrigger>().playerReadyToLaunch = false;
         coll.GetComponent<Rigidbody>().mass = 1;
         coll.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
         GameObject.Find("Level").GetComponent<Level.LevelOne>().ModifySpawnPoint();
     }
 }
Ejemplo n.º 8
0
 void OnTriggerStay(Collider aOther)
 {
     if (!m_isActive) return;
     if (aOther.GetComponent<PlaneController>() != null && aOther.GetComponent<PlaneController>().m_playerID == BombersNetworkManager.m_localPlayer.m_playerID)
     {
         BombersNetworkManager.m_localPlayer.BombPickedUpCommand(BombersNetworkManager.m_localPlayer.m_playerID, m_pickupID);
         m_isActive = false;
         Destroy(gameObject);
     }
 }
Ejemplo n.º 9
0
 private void OnTriggerEnter(Collider coll)
 {
     if (coll.tag == "Player")
     {
         regularMass = coll.GetComponent<Rigidbody>().mass;
         player = coll.gameObject;
         playerOnLibra = true;
         coll.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezePositionX | RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotation;
         libra.GetComponent<Rigidbody>().constraints = RigidbodyConstraints.None;
     }
 }
Ejemplo n.º 10
0
        //---------------------------- While the Umbrella is off the island ---------------------------------------//
        void OnTriggerStay(Collider barrier)
        {
            if (barrier.tag == "Player") {

                _timer += Time.deltaTime;
                barrier.GetComponent<Rigidbody> ().drag = Mathf.Lerp (barrier.GetComponent<Rigidbody> ().drag, 10, Time.fixedDeltaTime / 100);
                if (_timer > 3) {
                    barrier.GetComponent<Rigidbody> ().AddForce (knockBack * directionOfForce);
                }
            }
        }
Ejemplo n.º 11
0
 //Check which object collide with the wind capsule
 void OnTriggerEnter(Collider col)
 {
     // Add the GameObject collided with to the list.
     if (col.GetComponent<Rigidbody>())
     {
         if (!col.GetComponent<Rigidbody>().isKinematic)
         {
             currentCollisions.Add(col.gameObject);
         }
     }
 }
 void OnTriggerEnter(Collider coll)
 {
     if (coll.tag == "Fracture")
     {
         coll.transform.position = gameObject.transform.position;
         coll.transform.rotation = new Quaternion(0, 0, 0, 0);
         coll.GetComponent<Rigidbody>().isKinematic = true;
         coll.GetComponent<Renderer>().material.SetColor("_Color", Color.white);
         coll.GetComponent<InteractableObjectOutline>().enabled = false;
     }
 }
Ejemplo n.º 13
0
 void OnTriggerStay(Collider coll)
 {
     if (coll.tag == "Player" && Input.GetButtonDown("Submit"))
     {
         if (!complete && coll.GetComponent<Player>().HoldingWater && coll.GetComponent<Player>().Onesie.isHeavy)
         {
             coll.GetComponent<Player>().HoldingWater = false;
             waterGiven = true;
         }
     }
 }
Ejemplo n.º 14
0
        void OnTriggerStay(Collider other)
        {
            if (other.gameObject.tag == "Player") {
                if (other.GetComponent<Rigidbody> ()) {
                    other.GetComponent<Rigidbody> ().AddForce (transform.forward * push);

                }
                umbrellaAnim.SetBool ("Hit", true);

                push -= 1;
                push = Mathf.Clamp (push, 0, savedPush);

            }
        }
 private void OnTriggerStay(Collider collider)
 {
     var controller = (collider.GetComponent<VRTK_ControllerEvents>() ? collider.GetComponent<VRTK_ControllerEvents>() : collider.GetComponentInParent<VRTK_ControllerEvents>());
     if (controller)
     {
         if (lastUsePressedState == true && !controller.usePressed)
         {
             var distance = Vector3.Distance(transform.position, destination.position);
             var controllerIndex = VRTK_DeviceFinder.GetControllerIndex(controller.gameObject);
             OnDestinationMarkerSet(SetDestinationMarkerEvent(distance, destination, new RaycastHit(), destination.position, controllerIndex));
         }
         lastUsePressedState = controller.usePressed;
     }
 }
Ejemplo n.º 16
0
        private void OnTriggerExit(Collider other)
        {
            ShieldHealth health = other.GetComponent<ShieldHealth>();
            if (health != null)
            {
                health.Trash();
                return;
            }

            PoolObject po = other.GetComponent<PoolObject>();
            if (po != null)
            {
                po.Disable();
            }
        }
Ejemplo n.º 17
0
 void OnTriggerEnter(Collider obj) {
     if(obj.tag == "Player") {
         obj.GetComponent<PlayerController>().isStunned = true;
         this.parentNode.isEnabled = true;
         this.parentNode.blockMaterials[1] = this.parentNode.stunUpMaterial;
         this.parentNode.blockRenderer.materials = this.parentNode.blockMaterials;
         PlayerAudio.instance.PlayMisc();
     } else if(obj.tag == "AI") {
         obj.GetComponent<AIController>().isStunned = true;
         this.parentNode.isEnabled = true;
         this.parentNode.blockMaterials[1] = this.parentNode.stunUpMaterial;
         this.parentNode.blockRenderer.materials = this.parentNode.blockMaterials;
         AIAudio.instance.PlayMisc();
     }
 }
Ejemplo n.º 18
0
        void OnTriggerEnter(Collider other)
        {
            if (!active) return;

            if (!stayOff)
            {
                if (other.gameObject.tag == "Player")
                {
                    if (isLocal)
                    {
                        if (localDestination != null)
                        {
                            localDestination.AddCooldown(cooldownAfterJump);

                            if (frozenAfterJump > 0)
                            {
                                PlayerController frozen = other.GetComponent<PlayerController>();
                                if (frozen != null) frozen.MovementCooldown = frozenAfterJump;
                            }

                            LocalTeleport(other.gameObject, localDestination.transform);
                        }
                    }
                    else
                    {
                        if (overrideLocation)
                        {
                            StageData stageData = SaveSystem.GetSceneData(sceneDestinationName).StageData;
                            stageData.RegisterPlayerLocation(overridedPosition, Quaternion.Euler(overridedRotation));
                        }
                        SaveSystem.LoadScene(sceneDestinationName);
                    }
                }
            }
        }
Ejemplo n.º 19
0
 void OnTriggerEnter(Collider collider)
 {
     if (enter) {
         SerenityAgent agent = collider.GetComponent<SerenityAgent>();
         Play("OnTriggerEnter",agent.agentName);
     }
 }
Ejemplo n.º 20
0
 void OnTriggerEnter(Collider other)
 {
     if (other.GetComponent<InfoPlayer>() != null && isActive)
     {
         StartCoroutine(LeaveLevelTransition("completed"));
     }
 }
Ejemplo n.º 21
0
        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);
                }
            }
        }
Ejemplo n.º 22
0
        void OnTriggerEnter(Collider other)
        {
            if (health > 0)
            {
                if (controller.GetComponent<Animation>().IsPlaying("Lumbering"))
                {

                    if (other.name == "NPC_Tools_Axe_004")
                    {

                        if (invulnerable == false)
                        {
                            other.GetComponent<AudioSource> ().Play ();
                            StartCoroutine(getRect(damageTaken));
                        }
                    }
                }
                if (other.tag == "PlayerPhysicsProjectile")
                {
                    GameObject thingy = other.gameObject;
                    Vector3 thingyspeed = thingy.GetComponent<Rigidbody>().velocity;
                    //print(thingyspeed.magnitude);
                    if (thingyspeed.magnitude > 3)
                    {
                        print(thingyspeed.magnitude);
                        if (invulnerable == false)
                        {
                            StartCoroutine(getRect(50));
                        }
                    }

                }
            }
        }
Ejemplo n.º 23
0
 void OnTriggerEnter(Collider coll)
 {
     inside = true;
     if (coll.GetComponent<Being> ()!=null) {
         StartCoroutine ("DestroyUnit", coll.gameObject);
     }
 }
Ejemplo n.º 24
0
 // OnTriggerEnter is called when the agent runs into a trigger that specifies what task to run text
 public override void OnTriggerEnter(Collider other)
 {
     TriggerType triggerType = null;
     if ((triggerType = other.GetComponent<TriggerType>()) != null) {
         nextTaskIndex = (int)triggerType.triggerType;
     }
 }
Ejemplo n.º 25
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.GetComponent<mutantPickUp>())
     {
         this._receiver.SendMessage("DeadBodyEnteredArea");
     }
 }
Ejemplo n.º 26
0
        void OnTriggerEnter(Collider enterCol)
        {
            var player = enterCol.GetComponent<Player>();
            if (player == null) return;

            Destroy(gameObject);
        }
Ejemplo n.º 27
0
        public void OnTriggerEnter(Collider other)
        {
            //if (other.name != "Top")
            {
                var a = other.GetComponent<MiniGame1Car>();
                var b = other.transform.parent.GetComponent<MiniGame1Car>();

                var vel = 0f;

                if (a != null)
                {
                    Debug.Log("a");
                    vel = a.velocity;
                }
                else
                {
                    Debug.Log("b");
                    vel = b.velocity;
                }

                if (vel == 1)
                {
                    velocity = 0;
                    StartCoroutine(CheckMove());
                }
            }
        }
Ejemplo n.º 28
0
        protected override void OnTriggerExit( Collider other )
        {
            base.OnTriggerExit(other);

            if( !enabled || !ShouldAffect(other) )
                return;

            Rigidbody rigidbody = other.GetComponent<Rigidbody>();

            if( rigidbody == null )
                return;

            if( boxCollider == null )
                boxCollider = GetComponent<BoxCollider>();

            Vector3 position = transform.InverseTransformPoint( other.transform.position );

            if( affectX && Mathf.Abs( position.x * 2 ) >= boxCollider.size.x )
            {
                position.x = -position.x;
            }

            if( affectY && Mathf.Abs( position.y * 2 ) >= boxCollider.size.y )
            {
                position.y = -position.y;
            }

            if( affectZ && Mathf.Abs( position.z * 2 ) >= boxCollider.size.z )
            {
                position.z = -position.z;
            }

            rigidbody.MovePosition( transform.TransformPoint(position) );
        }
Ejemplo n.º 29
0
 protected virtual void Attack(Collider collider)
 {
     Debug.Log("Collide");
     var target = collider.GetComponent<IDamage>();
     if (target != null)
         Owner.Attack(target, new Damage(gameObject,_parameter.Strong, collider, this));
 }
Ejemplo n.º 30
0
 void cmdChatProd(NetUser netuser, string command, string[] args)
 {
     if (!hasAccess(netuser)) { SendReply(netuser, "You don't have access to this command"); return; }
     cachedCharacter = netuser.playerClient.rootControllable.idMain.GetComponent<Character>();
     if (!MeshBatchPhysics.Raycast(cachedCharacter.eyesRay, out cachedRaycast, out cachedBoolean, out cachedhitInstance)) { SendReply(netuser, "Are you looking at the sky?"); return; }
     if (cachedhitInstance != null)
     {
         cachedCollider = cachedhitInstance.physicalColliderReferenceOnly;
         if (cachedCollider == null) { SendReply(netuser, "Can't prod what you are looking at"); return; }
         cachedStructure = cachedCollider.GetComponent<StructureComponent>();
         if (cachedStructure != null && cachedStructure._master != null)
         {
             cachedMaster = cachedStructure._master;
             var name = PlayerDatabase?.Call("GetPlayerData", cachedMaster.ownerID.ToString(), "name");
             SendReply(netuser, string.Format("{0} - {1} - {2}", cachedStructure.gameObject.name, cachedMaster.ownerID.ToString(), name == null ? "UnknownPlayer" : name.ToString()));
             return;
         }
     }
     else
     {
         cachedDeployable = cachedRaycast.collider.GetComponent<DeployableObject>();
         if (cachedDeployable != null)
         {
             var name = PlayerDatabase?.Call("GetPlayerData", cachedDeployable.ownerID.ToString(), "name");
             SendReply(netuser, string.Format("{0} - {1} - {2}", cachedDeployable.gameObject.name, cachedDeployable.ownerID.ToString(), name == null ? cachedDeployable.ownerName.ToString() : name.ToString()));
             return;
         }
     }
     SendReply(netuser, string.Format("Can't prod what you are looking at: {0}",cachedRaycast.collider.gameObject.name));
 }
Ejemplo n.º 31
0
 private void OnTriggerEnter(UnityEngine.Collider other)
 {
     if (other.tag == "Player")
     {
         Player player = other.GetComponent <Player> ();
         player.LoseLife();
         Die();
     }
 }
Ejemplo n.º 32
0
 private void OnTriggerEnter(UnityEngine.Collider other)
 {
     thing = other.gameObject;
     if (other.tag.Equals("Planet"))
     {
         plan     = other.GetComponent <planet>();
         draining = true;
     }
     else if (other.name.Equals("Star"))
     {
         plan     = other.GetComponent <star>();
         draining = true;
     }
     else if (other.gameObject.tag.Equals("Base"))
     {
         draining     = false;
         station      = other.GetComponent <station>();
         transferring = true;
     }
 }
Ejemplo n.º 33
0
 protected override void HandleEncounter(UnityEngine.Collider other)
 {
     //this will cover most cases including the player
     mlisteningItemCheck = (IListener)other.GetComponent(typeof(IListener));
     if (mlisteningItemCheck == null)
     {
         //whoops, we have to do some heavy lifting
         //see if it's a world item
         mIoiCheck      = null;
         mlistenerCheck = null;
         if (WorldItems.GetIOIFromCollider(other, out mIoiCheck) && mIoiCheck.IOIType == ItemOfInterestType.WorldItem && mIoiCheck.worlditem.Is <Listener>(out mlistenerCheck))
         {
             mlisteningItemCheck = mlistenerCheck;
         }
     }
     //unlike the visibility bubble
     //listeners are responsible for figuring out whether they can hear the item
     //so just add it to the list and it'll be pushed in OnUpdateAwareness
     Listeners.SafeAdd(mlisteningItemCheck);
 }
Ejemplo n.º 34
0
        protected override void HandleEncounter(UnityEngine.Collider other)
        {
            //this will cover most cases including the player
            mVisibleItemCheck = (IVisible)other.GetComponent(typeof(IVisible));
            if (mVisibleItemCheck == null)
            {
                //whoops, we have to do some heavy lifting
                //see if it's a world item
                mIoiCheck = null;
                if (WorldItems.GetIOIFromCollider(other, out mIoiCheck) && mIoiCheck.IOIType == ItemOfInterestType.WorldItem)
                {
                    mVisibleItemCheck = mIoiCheck.worlditem;
                }
            }

            //make sure our parent object gives a damn
            if (mVisibleItemCheck != null &&
                Flags.Check((uint)mVisibleItemCheck.IOIType, (uint)ParentObject.State.VisibleTypesOfInterest, Flags.CheckType.MatchAny) &&
                mVisibleItemCheck.HasAtLeastOne(ParentObject.State.ItemsOfInterest))
            {
                VisibleItems.SafeAdd(mVisibleItemCheck);
            }
        }
    private void OnTriggerEnter(UnityEngine.Collider other)
    {
        Vector3 newPos = transform.position;

        Parent.transform.position  = gameObject.transform.position;
        Ragdobj.transform.position = gameObject.transform.position;
        if ((other.gameObject.tag == "Bullet" || other.gameObject.tag == "Object" || other.gameObject.tag == "Die") && other.GetComponent <Rigidbody>().velocity.magnitude > CollisionSpeed)      //태그가 불릿이나 오브젝트이고, 속도가 일정 이상이 되면
        {
            if (!IsOnceHit)
            {
                newPos.y += 2.0f;
                Instantiate(particle, newPos, Quaternion.identity);
                IsOnceHit = true;
            }
            HitByProjectile();

            //Debug.Log(" Die");
        }
    }