Ejemplo n.º 1
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);
                    }
                }
            }
        }
    }
Ejemplo n.º 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);
                    }
                }
            }
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Deactivates a pasta so that it can be reused
 /// </summary>
 /// <param name="pasta">Pasta object to "kill"</param>
 public void KillPasta(ROTD_Pasta pasta)
 {
     // set the pasta state to Dead
     pasta.State = ROTD_Pasta.STATE.Dead;
 }
Ejemplo n.º 4
0
    /// <summary>
    /// Gets the number of pastas for each type that need to be active
    /// based on the total number of kills
    /// </summary>
    /// <returns>The number of active pastas</returns>
    public int GetCurrentPastaTypeCount(ROTD_Pasta.TYPE pastaType)
    {
        // go through the difficulty levels, starting with the highest first
        foreach (ROTD_DifficultyLevel dl in _internalDifficultyLevels)
        {
            // if the total kills is higher than this difficulty level threshold
            if (TotalPastaKills >= dl.totalKillThreshold)
            {
                // look for the correct pasta type and return the count
                switch (pastaType)
                {
                    case ROTD_Pasta.TYPE.Pizza:
                        return dl.pizzaCount;
                }
            }
        }

        // no difficulty level reached or no pasta type found, just return zero
        return 0;
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Deactivates a pasta so that it can be reused
 /// </summary>
 /// <param name="pasta">Pasta object to "kill"</param>
 public void KillPasta(ROTD_Pasta pasta)
 {
     // set the pasta state to Dead
     pasta.State = ROTD_Pasta.STATE.Dead;
 }