// Use this for initialization
    void Start()
    {
        UnityEngine.Random.InitState(DateTime.Now.Millisecond);
        playerSlots = new Vector3[]
        {
            new Vector3(0.00f, 0.03f),            // upper left
            new Vector3(0.1f, 0.06f),             // upper right
            new Vector3(0.2f, 0.09f),             // lower left
            new Vector3(0.3f, 0.12f)              // lower right
        };
        //gamestate = GameObject.FindGameObjectWithTag ("GameState").GetComponent<GameState> ();
        if (PersistentInfo.instance.remakeScene)
        {
            PersistentInfo pinf = PersistentInfo.instance;
            gamestate     = pinf.gstate;
            currentPlayer = pinf.currentPlayer;
            playerCount   = pinf.NumPlayers;
            StartCoroutine(reset(true));
        }

        else
        {
            PersistentInfo.instance.gstate = gamestate;
            playerCount = gamestate.player_cars.Count;
            PersistentInfo.instance.NumPlayers = playerCount;
            currentPlayer = UnityEngine.Random.Range(0, playerCount);
            PersistentInfo.instance.currentPlayer = currentPlayer;
            StartCoroutine(reset(false));
        }
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        this._initCommonGui();

        this._boxWidth  = CommonMenuUtilities.forceDimensions(this._boxWidth, this._minWidth, this._maxWidth);
        this._boxHeight = CommonMenuUtilities.forceDimensions(this._boxHeight, this._minHeight, this._maxHeight);

        //Debug.Log("Briefing width: " + this._boxWidth);
        //Debug.Log("Briefing height: " + this._boxHeight);

        PersistentInfo Persistence = GameObject.Find("PersistentInfo").GetComponent <PersistentInfo>();

        this.InterludeText = Resources.Load("Texts/Interludes/" + Persistence.sceneName) as TextAsset;

        //Debug.Log ("Briefings/" + Persistence.sceneName);
        this.BriefingTexture = Resources.Load("Briefings/" + Persistence.sceneName) as Texture2D;

        this._ContinueResponseFunction = _loadNextScene;

        //Special exception scenes
        if (Persistence.sceneName == "Ending")
        {
            this._ContinueResponseFunction = _loadMainMenu;
        }
        else if (Persistence.sceneName == "Defeat")
        {
            this._ContinueResponseFunction = _loadMainMenu;
        }
    }
    private void _loadDefeatScene()
    {
        GameObject LevelInfo = GameObject.Find("LevelInfo");

        Destroy(LevelInfo);

        PersistentInfo Persistence = GameObject.Find("PersistentInfo").GetComponent <PersistentInfo>();

        Persistence.loadDefeatScene();
    }
    private void _loadNextScene()
    {
        //Make sure to destroy the LevelInfo that we carried over from the map
        GameObject LevelInfo = GameObject.Find("LevelInfo");

        Destroy(LevelInfo);

        PersistentInfo Persistence = GameObject.Find("PersistentInfo").GetComponent <PersistentInfo>();

        Persistence.loadNextScene();
    }
 void Start()
 {
     info   = GameObject.Find("Info");
     myInfo = info.GetComponent <PersistentInfo> ();
     centerLocation.address   = myInfo.city;
     centerLocation.latitude  = myInfo.latitude;
     centerLocation.longitude = myInfo.longitude;
     if (loadOnStart)
     {
         Refresh();
     }
 }
Beispiel #6
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
     DontDestroyOnLoad(this.gameObject);
 }
 // Start is called before the first frame update
 void Awake()
 {
     if (Instance != null)
     {
         GameObject.Destroy(this.gameObject);
     }
     else
     {
         Instance = this;
         Object.DontDestroyOnLoad(this.gameObject);
     }
 }
Beispiel #8
0
    // Use this for initialization
    void Start()
    {
        info       = GameObject.Find("Info");
        myInfo     = info.GetComponent <PersistentInfo> ();
        statusText = this.GetComponent <Text> ();

        if (myInfo.city == "")
        {
            statusText.text = "Building: " + myInfo.buildingNum + '\n' + '\n' + "Latitude: " + myInfo.latitude + '\n' + "Longitude: " + myInfo.longitude;
        }
        else if (myInfo.city != "")
        {
            statusText.text = "Building: " + myInfo.buildingNum + '\n' + '\n' + "City: " + myInfo.city;
        }
    }
Beispiel #9
0
    public void startGame()
    {
        this.GuiAudioSource.PlayOneShot(this.Click1);

        //Here we create our first and LevelInfo object.
        GameObject PersistentInfoObj = Instantiate(Resources.Load("Prefabs/PersistentInfo")) as GameObject;

        PersistentInfoObj.name = "PersistentInfo";

        PersistentInfo PersistentInformation = PersistentInfoObj.GetComponent <PersistentInfo>();

        PersistentInformation.loadSceneAtIndex(0);

        //Debug.Log(sceneInfo[0]);
        //Debug.Log(sceneInfo[1]);

        //Application.LoadLevel ("TestMap");
    }
Beispiel #10
0
 // Use this for initialization
 void Start()
 {
     info   = GameObject.Find("Info");
     myInfo = info.GetComponent <PersistentInfo> ();
 }
Beispiel #11
0
        private void doCheckResource(Dictionary <string, Info> target, bool isTargetLatest)
        {
            var downloadList = new Dictionary <string, Info>();

            foreach (var kv in target)
            {
                var fn   = kv.Key;
                var info = kv.Value;

                Info infoInStream;
                bool inStream = StreamInfo.TryGetValue(fn, out infoInStream) &&
                                infoInStream.Equals(info);

                if (inStream)
                {
                    Res.resourcesInStreamWhenNotUseStreamVersion.Add(fn);
                }
                else
                {
                    var fi = new FileInfo(Application.persistentDataPath + "/" + fn);
                    if (fi.Exists)
                    {
                        if (fi.Length != info.Size)
                        {
                            downloadList.Add(fn, info);
                            fi.Delete();
                        }
                        else if (isTargetLatest)
                        {
                            Info infoInPersistent;
                            bool inPersistent = PersistentInfo.TryGetValue(fn, out infoInPersistent) &&
                                                infoInPersistent.Equals(info);

                            if (!inPersistent)
                            {
                                downloadList.Add(fn, info);
                                fi.Delete();
                            }
                        }
                    }
                    else
                    {
                        downloadList.Add(fn, info);
                    }
                }
            }

            if (isTargetLatest)
            {
                File.Replace(Application.persistentDataPath + "/" + res_md5_latest,
                             Application.persistentDataPath + "/" + res_md5, null);
                File.Replace(Application.persistentDataPath + "/" + CheckVersionState.res_version_latest,
                             Application.persistentDataPath + "/" + CheckVersionState.res_version, null);
            }

            if (downloadList.Count == 0)
            {
                updater.Reporter.CheckMd5Done(State.Succeed, null);
            }
            else
            {
                updater.Reporter.CheckMd5Done(State.DownloadRes, downloadList);
                updater.DownloadRes.Start(downloadList);
            }
        }
Beispiel #12
0
    private void _loadNextScene()
    {
        PersistentInfo Persistence = GameObject.Find("PersistentInfo").GetComponent <PersistentInfo>();

        Persistence.loadNextScene();
    }