示例#1
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance = this;
     }
 }
示例#2
0
    void Awake()
    {
        int o = transform.childCount;

        sound = new AudioSource[o];

        for (int i = 0; i < o; i++)
        {
            sound[i] = transform.GetChild(i).GetComponent <AudioSource>();
        }

        data = this;
    }
示例#3
0
 public void AssociatePrimarySystemAudio()
 {
     audioSystemObj    = GameObject.FindWithTag("CameraListener");
     audioSystemScript = audioSystemObj.GetComponent <audioSystem>();
     if (actualSceneName == "Menu")
     {
         audioSystemScript.AssociateGameAudio();
         //play menu music
         audioSystemScript.PlayTheSound(0);
     }
     else if (actualSceneName == "Game")
     {
         audioSystemScript.AssociateGameAudio();
         //play ingame music
     }
     else if (actualSceneName == "VictoryScreen")
     {
         audioSystemScript.AssociateGameAudio();
     }
 }
    void Start()
    {
        //AssociateSystem
        primarySystemObject = GameObject.FindWithTag("PrimarySystem");
        primarySystemScript = primarySystemObject.GetComponent <primarySystem>();

        audioSystemObj    = GameObject.FindWithTag("CameraListener");
        audioSystemScript = audioSystemObj.GetComponent <audioSystem>();

        colliderPossitionY = 50.0f;

        AssociateShips();
        AssociateTexts();
        CheckSandbox();
        CalculateScore();

        primarySystemScript.AssociatePrimarySystemAudio();

        //distancia da partida sem sandbox
        necessaryDistance = 2000.0f;


        playerTimerSaver       = playerTimerOptionInMin;
        necessaryDistanceSaver = necessaryDistance;
        totalTimerSeconds      = 0.0f;
        iniciate = 0;

        BothCameraText.text          = "";
        SSNecessaryDistanceText.text = "-- " + Math.Round(necessaryDistance, 0).ToString() + " --";

        if (primarySystemScript.whichLang == "PT")
        {
            BackgroundStartText.text = "Pressione qualquer tecla para iniciar";
        }
        else if (primarySystemScript.whichLang == "EN")
        {
            BackgroundStartText.text = "Press any key to start";
        }
    }