Esempio n. 1
0
    // Use this for initialization
    void Awake()
    {
        GuestManager.LoadGuestData();

        GuestManager.CurrentRaceresults.Clear();
        for (int i = 0; i <= 9; i++)
        {
            //TurtlesInTheRace[i].name = AllTurtlesData[i].name;
            TurtlesInTheRace[i].name = gameObject.GetComponent <TurtleNamer>().GiveNewRandomName();
        }
        DeactivateObjects(possibleTracks);
        DeactivateObjects(possibleFinishLines);

        int randomTrack  = Random.Range(0, possibleTracks.Length);
        int randomLength = Random.Range(0, possibleFinishLines.Length);

        possibleTracks[randomTrack].SetActive(true);
        possibleFinishLines[randomLength].SetActive(true);

        RaceInfoSurface.text = "Surface: " + possibleTracks[randomTrack].name;
        RaceInfoLength.text  = "Length: " + possibleFinishLines[randomLength].name;

        FinishLineCam.gameObject.transform.position = new Vector3(FinishLineCam.transform.position.x, FinishLineCam.transform.position.y, possibleFinishLines[randomLength].transform.position.z);
        FinishLineLocator.transform.position        = possibleFinishLines[randomLength].transform.position;

        isBettingOpen = true;
        string exampleName = TurtlesInTheRace[Random.Range(2, 5)].name;

        bettingOpenInstructions.text = "Type ''" + exampleName + " Win 10'' to bet 10 on " + exampleName + " to win!";
    }
Esempio n. 2
0
    // Use this for initialization
    void Awake()
    {
        Debug.Log("Loading data...");
        GuestManager.LoadGuestData();
        //Debug.Log("Clearing race results...");
        GuestManager.CurrentRaceresults.Clear();
        TurtleAuctionManager.TurtlesForAuction.Clear();
        for (int i = 0; i <= 9; i++)
        {
            //TurtlesInTheRace[i].name = AllTurtlesData[i].name;
            if (GuestManager.NextRacesTurtles.Count <= i) //If there are less custom turtles entered than the number of names we have filled out
            {
                //Debug.Log("GuestManager.NextRacesTurtles.Count is at " + GuestManager.NextRacesTurtles.Count + " and i is at " + i);
                //print(i + " nextracesturtlescount " + GuestManager.NextRacesTurtles.Count);
                TurtlesInTheRace[i].name = gameObject.GetComponent <TurtleNamer>().GiveNewRandomName();
                TurtleAI thisAI = TurtlesInTheRace[i].GetComponent <TurtleAI>();
                thisAI.myTurtleData.MyScaleX = Random.Range(-10, 10);
                thisAI.myTurtleData.MyScaleY = Random.Range(-10, 10);
                //print("making a fake turtle name");
            }
            else
            {
                TurtlesInTheRace[i].GetComponent <TurtleAI>().myTurtleData = GuestManager.NextRacesTurtles[i];
            }
        }
        //Debug.Log("Deactivating objects...");
        DeactivateObjects(possibleTracks);
        DeactivateObjects(possibleFinishLines);

        int randomTrack  = Random.Range(0, possibleTracks.Length - 1);
        int randomLength = Random.Range(0, possibleFinishLines.Length - 1);

        if (PlayerPrefs.HasKey("NextSurface"))
        {
            randomTrack  = PlayerPrefs.GetInt("NextSurface");
            randomLength = PlayerPrefs.GetInt("NextLength");
            //Debug.Log("Oh shit we loaded the random legnth from playerprefs, this has caused issues, it is " + randomLength);
        }
        if (PlayerPrefs.HasKey("NextPurse"))
        {
            Purse = PlayerPrefs.GetInt("NextPurse");
        }

        //Debug.Log("Picking random track...");
        possibleTracks[randomTrack].SetActive(true);
        //Debug.Log("Picking random finish line...");
        possibleFinishLines[randomLength].SetActive(true);
        //Debug.Log("Picking track name...");
        TrackName            = possibleTracks[randomTrack].name;
        RaceInfoSurface.text = "Surface: " + TrackName;
        //Debug.Log("Writing track length...");
        RaceInfoLength.text = "Length: " + possibleFinishLines[randomLength].name;

        //Debug.Log("Setting up finish line...");
        FinishLineCam.gameObject.transform.position = new Vector3(FinishLineCam.transform.position.x, FinishLineCam.transform.position.y, possibleFinishLines[randomLength].transform.position.z);
        FinishLineLocator.transform.position        = possibleFinishLines[randomLength].transform.position;

        isBettingOpen = true;
        //Debug.Log("picking random name for HUD...");
        string exampleName = TurtlesInTheRace[Random.Range(2, 5)].name;

        bettingOpenInstructions.text = "Type ''" + exampleName + " Win 10'' to bet 10 on " + exampleName + " to win!";
    }
Esempio n. 3
0
 void Awake()
 {
     GuestManager.LoadGuestData();
     GuestManager.NextRacesTurtles.Clear();
 }
Esempio n. 4
0
 void Awake()
 {
     GuestManager.LoadGuestData();
 }