Esempio n. 1
0
    private void HitObstacle(DamageCarriableEvent e)
    {
        if (e.obstacleType == ObstacleKind.car)
        {
            PlaySound("Play_ColCar");
        }
        else if (e.obstacleType == ObstacleKind.general)
        {
            PlaySound("Play_Collision");
        }
        else if (e.obstacleType == ObstacleKind.dumpster)
        {
            PlaySound("Play_ColContainer");
        }
        else if (e.obstacleType == ObstacleKind.roadblock || e.obstacleType == ObstacleKind.roadblockBig)
        {
            PlaySound("Play_ColRoadBlock");
        }
        else if (e.obstacleType == ObstacleKind.trashcan_Body || e.obstacleType == ObstacleKind.trashcan_Top)
        {
            PlaySound("Play_ColTrashCan");
        }
        else
        {
            PlaySound("Play_Collision");
        }

        if (ohNoSoundPlayed == false && !isDialogue)
        {
            isDialogue = true;
            AkSoundEngine.PostEvent("Play_MusVO16", gameObject, (uint)AkCallbackType.AK_EndOfEvent, DialogueCallbackFunction, gameObject);
            ohNoSoundPlayed = true;
        }
    }
    /// <summary>
    /// BEING CALLED WHEN PLAYER TRIGGER ON OBSTACLES (1)
    /// </summary>
    public void DamageObstacle(DamageCarriableEvent e)
    {
        animator.SetTrigger("Bump");

        if (numberOfLostCarriables != stackedList.CollectedCarriables.Count)
        {
            GetCarriableFallingOff();
            carriableHealth = carriableFallingOff.GetComponent <CarriableHealth>();
            carriableHealth.LoseHealth();
        }
    }