예제 #1
0
    public void StartSpecificLeak(LeakZone leakZone, List <LeakZone> pipeLeakZones, LeverScript associatedLever, int associatedPipe, LeverScript.RessourcesType ressource = LeverScript.RessourcesType.none)
    {
        GameObject leak       = Instantiate(leakPrefab, leakZone.GetRandomLeakPosition(), Quaternion.identity);
        Leak       leakScript = leak.GetComponent <Leak>();

        leakScript.associatedPipeLeaksZones           = pipeLeakZones;
        leakScript.associatedLever                    = associatedLever;
        leakScript.associatedPipe                     = associatedPipe;
        leakScript.currentRessource                   = ressource;
        associatedLever.allLeaksZones[associatedPipe] = null;
        allLeaks.Add(leak);
        SoundsManager.instance.PlaySoundOneShot(SoundsManager.SoundName.StartLeak, leakSource);
        CharacterController2D.instance.animatorFace.SetTrigger("Choc");
    }
 public void LaunchSpecificSS(SecondarySystem specificSecondarySystem, Pack associatedPack, LeverScript.RessourcesType ressource = LeverScript.RessourcesType.energy, bool showTimer = true)
 {
     if (lastPack != null)
     {
         if (lastPack.secondarySystems.Count > 0)
         {
             allSecondarySystems.Add(lastPack);
         }
     }
     specificSecondarySystem.associatedPack = associatedPack;
     lastPack = associatedPack;
     allSecondarySystems.Remove(associatedPack);
     specificSecondarySystem.animator.SetBool("OnActivity", true);
     if (specificSecondarySystem.memberAnimator)
     {
         specificSecondarySystem.memberAnimator.speed = 1f;
     }
     if (ressource == LeverScript.RessourcesType.energy)
     {
         specificSecondarySystem.currentEnergy = 0f;
         specificSecondarySystem.energyGauge.SetActive(true);
         specificSecondarySystem.energyNeeded = true;
     }
     else
     {
         specificSecondarySystem.currentOxygen = 0f;
         specificSecondarySystem.oxygenGauge.SetActive(true);
         specificSecondarySystem.oxygenNeeded = true;
     }
     activesSecondarySystems++;
     HintSecondarySystemManager.instance.activeSecondarySystems.Add(specificSecondarySystem);
     if (showTimer)
     {
         TimerSecondarySystem timerObject = Instantiate(GameManager.instance.UI_timerSS, UI_Manager.instance.transform).GetComponent <TimerSecondarySystem>();
         timerObject.associatedSystem = specificSecondarySystem;
     }
     SoundsManager.instance.PlaySoundOneShot(SoundsManager.SoundName.SecondarySystemPop, ssManagerSource);
 }
예제 #3
0
    private void Update()
    {
        if (associatedLever.currentPipe == associatedPipe)
        {
            switch (associatedLever.currentRessource)
            {
            case LeverScript.RessourcesType.energy:
                EmptyingStomach();
                if (fxMainModule.startColor.color != GameManager.instance.energyColor)
                {
                    fxMainModule.startColor      = GameManager.instance.energyColor;
                    fxMainModuleChild.startColor = GameManager.instance.energyColor;
                    currentRessource             = LeverScript.RessourcesType.energy;
                }
                break;

            case LeverScript.RessourcesType.oxygen:
                EmptyingLungs();
                if (fxMainModule.startColor.color != GameManager.instance.oxygenColor)
                {
                    fxMainModule.startColor      = GameManager.instance.oxygenColor;
                    fxMainModuleChild.startColor = GameManager.instance.oxygenColor;
                    currentRessource             = LeverScript.RessourcesType.oxygen;
                }
                break;

            case LeverScript.RessourcesType.none:
                switch (currentRessource)
                {
                case LeverScript.RessourcesType.none:
                    int rand = Random.Range(0, 2);
                    switch (rand)
                    {
                    case 0:
                        EmptyingStomach();
                        if (fxMainModule.startColor.color != GameManager.instance.energyColor)
                        {
                            fxMainModule.startColor      = GameManager.instance.energyColor;
                            fxMainModuleChild.startColor = GameManager.instance.energyColor;
                            currentRessource             = LeverScript.RessourcesType.energy;
                        }
                        break;

                    case 1:
                        EmptyingLungs();
                        if (fxMainModule.startColor.color != GameManager.instance.oxygenColor)
                        {
                            fxMainModule.startColor      = GameManager.instance.oxygenColor;
                            fxMainModuleChild.startColor = GameManager.instance.oxygenColor;
                            currentRessource             = LeverScript.RessourcesType.oxygen;
                        }
                        break;
                    }
                    break;

                case LeverScript.RessourcesType.energy:
                    EmptyingStomach();
                    if (fxMainModule.startColor.color != GameManager.instance.energyColor)
                    {
                        fxMainModule.startColor      = GameManager.instance.energyColor;
                        fxMainModuleChild.startColor = GameManager.instance.energyColor;
                        currentRessource             = LeverScript.RessourcesType.energy;
                    }
                    break;

                case LeverScript.RessourcesType.oxygen:
                    EmptyingLungs();
                    if (fxMainModule.startColor.color != GameManager.instance.oxygenColor)
                    {
                        fxMainModule.startColor      = GameManager.instance.oxygenColor;
                        fxMainModuleChild.startColor = GameManager.instance.oxygenColor;
                        currentRessource             = LeverScript.RessourcesType.oxygen;
                    }
                    break;
                }
                break;
            }
        }
        else
        {
            switch (currentRessource)
            {
            case LeverScript.RessourcesType.none:
                int rand = Random.Range(0, 2);
                switch (rand)
                {
                case 0:
                    EmptyingStomach();
                    if (fxMainModule.startColor.color != GameManager.instance.energyColor)
                    {
                        fxMainModule.startColor      = GameManager.instance.energyColor;
                        fxMainModuleChild.startColor = GameManager.instance.energyColor;
                        currentRessource             = LeverScript.RessourcesType.energy;
                    }
                    break;

                case 1:
                    EmptyingLungs();
                    if (fxMainModule.startColor.color != GameManager.instance.oxygenColor)
                    {
                        fxMainModule.startColor      = GameManager.instance.oxygenColor;
                        fxMainModuleChild.startColor = GameManager.instance.oxygenColor;
                        currentRessource             = LeverScript.RessourcesType.oxygen;
                    }
                    break;
                }
                break;

            case LeverScript.RessourcesType.energy:
                EmptyingStomach();
                if (fxMainModule.startColor.color != GameManager.instance.energyColor)
                {
                    fxMainModule.startColor      = GameManager.instance.energyColor;
                    fxMainModuleChild.startColor = GameManager.instance.energyColor;
                    currentRessource             = LeverScript.RessourcesType.energy;
                }
                break;

            case LeverScript.RessourcesType.oxygen:
                EmptyingLungs();
                if (fxMainModule.startColor.color != GameManager.instance.oxygenColor)
                {
                    fxMainModule.startColor      = GameManager.instance.oxygenColor;
                    fxMainModuleChild.startColor = GameManager.instance.oxygenColor;
                    currentRessource             = LeverScript.RessourcesType.oxygen;
                }
                break;
            }
        }
    }