示例#1
0
    public void WeaponHit(ColliderTriggerEvent triggerEvent)
    {
        //Debug.Log (triggerEvent.tag);

        if (triggerEvent.tag == "Spear" && triggerEvent.triggerType == ColliderTriggerEvent.TRIGGER_TYPE.Enter)
        {
            //Debug.Log (triggerEvent.tag + " other collider is " + triggerEvent.otherCollider.gameObject.name);

            if (triggerEvent.otherCollider.GetComponent <AnimationBoneCollider>().BoneColliderTag == "Player")
            {
                Debug.Log(triggerEvent.tag);
                //
                //  stop player
                //
                movement.setSpeed(0f);

                //
                //  spawn particle
                //

                //
                //  Destroy player
                //
                Destroy(triggerEvent.otherCollider.transform.root.gameObject);
            }
        }
    }
示例#2
0
    /// <summary>
    /// Collider Trigger delegate called when a collider in the chef interacts with the world
    /// </summary>
    /// <param name="colliderTriggerEvent">Event captured when a collision occurs</param>
    public void ColliderTrigger(ColliderTriggerEvent colliderTriggerEvent)
    {
        // check to see if the event is the enter type (we don't want to process constant
        // collisions or exits)
        if (colliderTriggerEvent.triggerType == ColliderTriggerEvent.TRIGGER_TYPE.Enter)
        {
            // check to see if the tag of the event is "Attack"
            if (colliderTriggerEvent.tag == "Attack")
            {
                // check to see what object we collided with

                if (colliderTriggerEvent.otherCollider.name == "Refrigerator")
                {
                    // play the sound of hitting the fridge
                    gameManager.soundFXManager.Play("hit_refrigerator");
                }
                else if (colliderTriggerEvent.otherCollider.name == "Oven")
                {
                    // play the sound of hitting the oven
                    gameManager.soundFXManager.Play("hit_metal");
                }
                else
                {
                    // we hit a pasta

                    _hitPasta = colliderTriggerEvent.otherCollider.gameObject.transform.parent.GetComponent <ROTD_Pasta>();
                    if (_hitPasta != null)
                    {
                        // send a notification to the pasta that it was hit and how hard
                        _hitPasta.Hit(colliderTriggerEvent.otherColliderClosestPointToBone, _currentWeapon.damage);
                    }
                }
            }
        }
    }
示例#3
0
 private void Awake()
 {
     m_enterEvent           = ScriptableObject.CreateInstance <ColliderTriggerEvent>();
     m_enterEvent.EventName = "enter";
     m_leaveEvent           = ScriptableObject.CreateInstance <ColliderTriggerEvent>();
     m_leaveEvent.EventName = "leave";
 }
示例#4
0
    /// <summary>
    /// Collider Trigger delegate for the live animation
    /// </summary>
    /// <param name="ctEvent">Event sent by the animation</param>
    public void LiveColliderTrigger(ColliderTriggerEvent ctEvent)
    {
        // if the collider event was an attack by the pasta
        if (ctEvent.tag == "Attack")
        {
            // only process enter event types (not stay or exit)
            if (ctEvent.triggerType == ColliderTriggerEvent.TRIGGER_TYPE.Enter)
            {
                // randomize the pitch of the attack sound for some variation
                attackSound.pitch = UnityEngine.Random.Range(minMaxAttackSoundPitch.x, minMaxAttackSoundPitch.y);

                // play the attack sound
                attackSound.Play();

                // make the chef take damage
                _gameManager.chef.Hit(damage);
            }
        }
    }
示例#5
0
 private void Enter_ColliderTrigger_TriggerEnter(object sender, ColliderTriggerEvent e)
 {
     print("Attempt");
     TeleportMe(e.collider.transform, ignoreTags);
 }
示例#6
0
 private void Blocking_ColliderTrigger_TriggerExit(object sender, ColliderTriggerEvent e)
 {
     //throw new NotImplementedException();
 }
示例#7
0
    /// <summary>
    /// Collider Trigger delegate called when a collider in the chef interacts with the world
    /// </summary>
    /// <param name="colliderTriggerEvent">Event captured when a collision occurs</param>
    public void ColliderTrigger(ColliderTriggerEvent colliderTriggerEvent)
    {
        // check to see if the event is the enter type (we don't want to process constant
        // collisions or exits)
        if (colliderTriggerEvent.triggerType == ColliderTriggerEvent.TRIGGER_TYPE.Enter)
        {
            // check to see if the tag of the event is "Attack"
            if (colliderTriggerEvent.tag == "Attack")
            {
                // check to see what object we collided with

                if (colliderTriggerEvent.otherCollider.name == "Refrigerator")
                {
                    // play the sound of hitting the fridge
                    gameManager.soundFXManager.Play("hit_refrigerator");
                }
                else if (colliderTriggerEvent.otherCollider.name == "Oven")
                {
                    // play the sound of hitting the oven
                    gameManager.soundFXManager.Play("hit_metal");
                }
                else
                {
                    // we hit a pasta

                    _hitPasta = colliderTriggerEvent.otherCollider.gameObject.transform.parent.GetComponent<ROTD_Pasta>();
                    if (_hitPasta != null)
                    {
                        // send a notification to the pasta that it was hit and how hard
                        _hitPasta.Hit(colliderTriggerEvent.otherColliderClosestPointToBone, _currentWeapon.damage);
                    }
                }
            }
        }
    }
示例#8
0
    /// <summary>
    /// Collider Trigger delegate for the live animation
    /// </summary>
    /// <param name="ctEvent">Event sent by the animation</param>
    public void LiveColliderTrigger(ColliderTriggerEvent ctEvent)
    {
        // if the collider event was an attack by the pasta
        if (ctEvent.tag == "Attack")
        {
            // only process enter event types (not stay or exit)
            if (ctEvent.triggerType == ColliderTriggerEvent.TRIGGER_TYPE.Enter)
            {
                // randomize the pitch of the attack sound for some variation
                attackSound.pitch = UnityEngine.Random.Range(minMaxAttackSoundPitch.x, minMaxAttackSoundPitch.y);

                // play the attack sound
                attackSound.Play();

                // make the chef take damage
                _gameManager.chef.Hit(damage);
            }
        }
    }
示例#9
0
 override protected void Awake()
 {
     hxfbColliderTriggerEvent = new ColliderTriggerEvent();
 }
示例#10
0
 //////////////////////////////////////////////////
 ////// FUNCTIONS TO CATCH COLLISION EVENTS ///////
 //////////////////////////////////////////////////
 // Function which CollisionCatcherScript passes colliderTriggerEvents to.
 public void receiveColliderTriggerEvent(ColliderTriggerEvent colliderTriggerEvent)
 {
     GameObject otherChar = colliderTriggerEvent.otherCollider.gameObject.transform.root.gameObject;
     Debug.Log (gameObject + " just received a ColliderTriggerEvent from " + otherChar);
     performCollisionResponse (otherChar);
 }
 private void MulitpleCollider_TriggerEnter(object sender, ColliderTriggerEvent e)
 {
     Debug.Log("Enter: " + e.triggeredCollider.name);
 }
 private void Matryoshka_TriggerEnter(object sender, ColliderTriggerEvent e)
 {
     Debug.Log("Enter: " + e.triggeredCollider.name);
 }