Пример #1
0
 void UpdateDoubleEntry()
 {
     if (associatedObjects[currentPipe].GetComponent <LeverScript>())
     {
         currentRessource = associatedObjects[currentPipe].GetComponent <LeverScript>().currentRessource;
         UpdateEndObjectDoubleEntry();
     }
     else if (associatedObjects[currentPipe].GetComponent <PrimarySystem>())
     {
         if (associatedObjects[currentPipe].GetComponent <LungsManager>())
         {
             currentRessource = RessourcesType.oxygen;
         }
         else
         {
             currentRessource = RessourcesType.energy;
         }
         UpdateEndObjectDoubleEntry();
     }
     else if (associatedObjects[currentPipe].GetComponent <SecondarySystem>())
     {
         Debug.LogError("This case is not suppose to happen. Normally a pipe doesn't leave a secondary system. If you want to keep these please discuss about it with game designers :)");
     }
     else
     {
         Debug.LogError("There is no correct object associated to this pipe : " + pipes[currentPipe] + " actual object : " + associatedObjects[currentPipe]);
     }
     UpdatePipesDisplay();
     lastFrameRessource = currentRessource;
 }
Пример #2
0
    private void Update()
    {
        if (GameManager.instance.levelStarted)
        {
            if (!ScoreManager.instance.levelEnded && !GameManager.instance.levelPaused)
            {
                if (lastFrameRessource != currentRessource)
                {
                    UpdatePipe();
                }
                lastFrameRessource = currentRessource;
                if (currentAssociatedSecondarySystem)
                {
                    if (currentAssociatedSecondarySystem.oxygenNeeded && currentRessource == RessourcesType.oxygen && !currentAssociatedSecondarySystem.filling)
                    {
                        UpdatePipe();
                    }
                    if (currentAssociatedSecondarySystem.energyNeeded && currentRessource == RessourcesType.energy && !currentAssociatedSecondarySystem.filling)
                    {
                        UpdatePipe();
                    }
                }

                if (isFillingSS)
                {
                    if (pipes[currentPipe].shapeRenderer.color != GameManager.instance.emptyPipeOpenColor)
                    {
                        LerpPipeHeight();
                    }
                }

                if (doubleEntry && currentAssociatedSecondarySystem)
                {
                    if ((currentAssociatedSecondarySystem.energyNeeded || currentAssociatedSecondarySystem.oxygenNeeded) && !currentAssociatedSecondarySystem.filling)
                    {
                        if (!checkNeedDoubleEntryDone)
                        {
                            UpdatePipe();
                            checkNeedDoubleEntryDone = true;
                        }
                    }
                    else
                    {
                        if (checkNeedDoubleEntryDone)
                        {
                            checkNeedDoubleEntryDone = false;
                        }
                    }
                }
            }
        }
    }
Пример #3
0
    Color GetOpenColor(RessourcesType currentRessource)
    {
        switch (currentRessource)
        {
        case RessourcesType.none:
            return(GameManager.instance.emptyPipeOpenColor);

        case RessourcesType.energy:
            return(GameManager.instance.energyColor);

        case RessourcesType.oxygen:
            return(GameManager.instance.oxygenColor);

        default:
            return(Color.red);
        }
    }
Пример #4
0
 void UpdatePipe()
 {
     if (doubleEntry)
     {
         UpdateDoubleEntry();
         return;
     }
     CleanPreviousAssociatedObjects();
     if (associatedObjects[currentPipe].GetComponent <LeverScript>())
     {
         currentAssociatedLever = associatedObjects[currentPipe].GetComponent <LeverScript>();
         currentAssociatedLever.currentRessource = currentRessource;
     }
     else if (associatedObjects[currentPipe].GetComponent <PrimarySystem>())
     {
         if (initialPipes)
         {
             if (associatedObjects[currentPipe].GetComponent <LungsManager>())
             {
                 currentRessource = RessourcesType.oxygen;
             }
             else
             {
                 currentRessource = RessourcesType.energy;
             }
             currentAssociatedPrimarySystem         = associatedObjects[currentPipe].GetComponent <PrimarySystem>();
             currentAssociatedPrimarySystem.filling = true;
         }
         else
         {
             if (associatedObjects[currentPipe].GetComponent <LungsManager>())
             {
                 if (currentRessource == RessourcesType.oxygen)
                 {
                     currentAssociatedPrimarySystem         = associatedObjects[currentPipe].GetComponent <PrimarySystem>();
                     currentAssociatedPrimarySystem.filling = true;
                 }
                 else
                 {
                     //WRONG RESSOURCE
                 }
             }
             else
             {
                 if (currentRessource == RessourcesType.energy)
                 {
                     currentAssociatedPrimarySystem         = associatedObjects[currentPipe].GetComponent <PrimarySystem>();
                     currentAssociatedPrimarySystem.filling = true;
                 }
                 else
                 {
                     //WRONG RESSOURCE
                 }
             }
         }
     }
     else if (associatedObjects[currentPipe].GetComponent <SecondarySystem>())
     {
         currentAssociatedSecondarySystem = associatedObjects[currentPipe].GetComponent <SecondarySystem>();
         if (currentAssociatedSecondarySystem.energyNeeded)
         {
             if (currentRessource == RessourcesType.energy)
             {
                 currentAssociatedSecondarySystem.filling = true;
                 SoundsManager.instance.PlaySoundOneShot(SoundsManager.SoundName.StartFillingSecondarySystem, currentAssociatedSecondarySystem.audioSource);
                 IsSecondarySystemFilling(true);
             }
             else
             {
                 //WRONG RESSOURCE
             }
         }
         else if (currentAssociatedSecondarySystem.oxygenNeeded)
         {
             if (currentRessource == RessourcesType.oxygen)
             {
                 currentAssociatedSecondarySystem.filling = true;
                 SoundsManager.instance.PlaySoundOneShot(SoundsManager.SoundName.StartFillingSecondarySystem, currentAssociatedSecondarySystem.audioSource);
                 IsSecondarySystemFilling(true);
             }
             else
             {
                 //WRONG RESSOURCE
             }
         }
     }
     else
     {
         Debug.LogError("There is no correct object associated to this pipe : " + pipes[currentPipe] + " actual object : " + associatedObjects[currentPipe]);
     }
     UpdatePipesDisplay();
     lastFrameRessource = currentRessource;
 }