예제 #1
0
    //private Level level;
    //Awake is always called before any Start functions
    void Awake()
    {
        //Check if instance already exists
        if (instance == null)
        {
            //if not, set instance to this
            instance = this;
        }

        //If instance already exists and it's not this:
        else if (instance != this)
        {
            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy(gameObject);
        }

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);

        //Get a component reference to the attached BoardManager script
        //   boardScript = GetComponent<BoardManager>();

        //Call the InitGame function to initialize the first level
        InitGame();
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        gameManagerSingleton = GameManagerSingleton.instance;

        levelStyle.fontSize = (int)(Screen.height * 0.028f);
        Language();
    }
예제 #3
0
    //
    public static string[] GetTextXML(string category, string subCategory, string name)
    {
        string[]             textToReturn;
        XmlDocument          xml_d;
        XmlNode              objectToUse;
        XmlNodeList          xmlDescription;
        GameManagerSingleton gameManagerSingleton = GameManagerSingleton.instance;
        string    language  = gameManagerSingleton.GetLanguage();
        TextAsset textasset = (TextAsset)Resources.Load(language, typeof(TextAsset));

        xml_d = new XmlDocument();
        xml_d.LoadXml(textasset.text);
        //Search if it is the correct ID or name
        string route = "MAIN/" + category + "/" + subCategory + "[@name='" + name + "']";

        objectToUse = xml_d.SelectSingleNode(route);
        if (objectToUse != null)
        {
            xmlDescription = ((XmlElement)objectToUse).GetElementsByTagName("texto");
            textToReturn   = new string[xmlDescription.Count];
            int j = 0;
            foreach (XmlNode node in xmlDescription)
            {
                textToReturn [j] = node.InnerText;
                j++;
            }
            return(textToReturn);
        }
        return(null);
    }
예제 #4
0
    // Use this for initialization
    void Start()
    {
        //Assign keep values
        gameManagerSingleton = GameManagerSingleton.instance;
        switch (gameManagerSingleton.GetLanguage())
        {
        case "English":
            language.value = 0;
            MenuEnglish();
            break;

        case "Español":
            language.value = 1;
            MenuSpanish();
            break;

        case "Français":
            language.value = 2;
            break;
        }
        sound.isOn        = gameManagerSingleton.Music;
        volumeValue.value = gameManagerSingleton.Volume;

        //Restore the time scale from the previous pause
        Time.timeScale = 1.0f;
    }
예제 #5
0
파일: Music.cs 프로젝트: Mzamo257/Asteroids
 // Use this for initialization
 protected virtual void Start()
 {
     gameManagerSingleton = GameManagerSingleton.instance;
     aS        = GetComponent <AudioSource> ();
     aS.volume = gameManagerSingleton.Volume;
     PlayMusic();
 }
예제 #6
0
    //---------------------------------------
    // Use this for initialization
    void Start()
    {
        GM = GameManagerSingleton.Singleton;
        RM = RaceManagerSingleton.Singleton;


        PauseMenu.SetActive(false);
        RaceFinishedUI.SetActive(false);
        GameUI.SetActive(false);
        SettingsUI.SetActive(false);
        Compass.SetActive(true);
        PreStartUI.SetActive(true);

        // create list of available resolutions:
        resolutions = Screen.resolutions;
        resolutionDropdown.ClearOptions();

        List <string> options = new List <string>();
        int           currentResolutionIndex = 0;


        for (int i = 0; i < resolutions.Length; i++)
        {
            string option = resolutions[i].width + "x" + resolutions[i].height;
            options.Add(option);
            if (resolutions[i].width == Screen.currentResolution.width && resolutions[i].height == Screen.currentResolution.height)
            {
                currentResolutionIndex = i;
            }
        }

        resolutionDropdown.AddOptions(options);
        resolutionDropdown.value = currentResolutionIndex;
        resolutionDropdown.RefreshShownValue();
    }
 void Awake()
 {
     instance      = this;
     scoreKeeper   = GetComponent <Score>();
     slowMotion    = GetComponent <SlowMotion>();
     bulletManager = GetComponent <BulletManager>();
 }
예제 #8
0
 private void Awake()
 {
     if (singletonInstance == null)
     {
         singletonInstance = this;
     }
     else
     {
         Destroy(this);
     }
 }
예제 #9
0
 void Awake()
 {
     if (instance)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
예제 #10
0
 void Awake()
 {
     if (instance)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
예제 #11
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         player   = GameObject.FindGameObjectWithTag(playerTag);
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
예제 #12
0
파일: HUD.cs 프로젝트: Mzamo257/Asteroids
    // Use this for initialization
    protected virtual void Start()
    {
        levelMgr = FindObjectOfType <BaseLevelManager> ();

        iconSize = Screen.height * iconSizeRate;

        damage = levelMgr.SpaceCurrentLife;

        gmSingScript = FindObjectOfType <GameManagerSingleton>();

        levelStyle.fontSize = (int)(Screen.height * 0.03f);

        Language();
    }
예제 #13
0
    //---------------------------------------
    // Use this for initialization
    void Awake()
    {
        if (singleton == null)
        {
            singleton = this;
        }
        // DontDestroyOnLoad(this.gameObject);
        UI             = GetComponent <UIManager>();
        Cursor.visible = false;
        audioMixer     = FMODUnity.RuntimeManager.CreateInstance(audioMixerEvent);
        audioMixer.start();

        audioMixer.setParameterValue("paused", 0);
        audioMixer.setParameterValue("preRace", 1);
        audioMixer.setParameterValue("raceFinished", 0);
    }
예제 #14
0
    // Use this for initialization
    protected virtual void Start()
    {
        gameManagerSingleton = GameManagerSingleton.instance;
        asteroidManager      = FindObjectOfType <AsteroidManager>();

        spaceshipCurrentLife = maxSpaceshipLife;
        ship = FindObjectOfType <BaseSpaceship>();
        //
        cameraTransform = Camera.main.transform;
        // Start stuff
        inIntro              = true;
        currentState         = GameState.WaitingToStart;
        Time.timeScale       = 0.0f;
        textStyle.fontSize   = (int)(Screen.height * 0.04f);
        numberStyle.fontSize = (int)(Screen.height * 0.8f);
    }
예제 #15
0
    void Awake()
    {
        //Check if there is already an instance of SoundManager
        if (instance == null)
        {
            //if not, set it to this.
            instance = this;
        }
        //If instance already exists:
        else if (instance != this)
        {
            //Destroy this, this enforces our singleton pattern so there can only be one instance of SoundManager.
            Destroy(gameObject);
        }

        //Set SoundManager to DontDestroyOnLoad so that it won't be destroyed when reloading our scene.
        DontDestroyOnLoad(gameObject);
    }
예제 #16
0
 // Use this for initialization
 void Start()
 {
     gameManagerSingleton = GameManagerSingleton.instance;
     MenuPauseLanguage();
 }