示例#1
0
    private int maxLines = 33; //Tested, based on 24pt Min.
    #endregion


    // Use this for initialization
    void Awake()
    {
        if (GameObject.FindGameObjectsWithTag("CBUG").Length > 1)
        {
            CBUG.SrsError("There must be only one CBUG per scene!");
        }


        logText     = GetComponent <Text>();
        lines       = new LinkedList <string>();
        occurrences = new LinkedList <int>();
        if (DisableOnScreen)
        {
            logText.color = new Color(0, 0, 0, 0);
        }
        if (ClearTime == 0)
        {
            neverClear = true;
        }
        if (ClearAll)
        {
            ClearAmount = -1;
        }

        transform.tag = "CBUG";
        previousClear = Time.time;
    }
示例#2
0
    public float HeatRateModStatic; //Static is a word which here means, unchanged by code.

    // Use this for initialization
    void Start()
    {
        VolumeChangeWaitTime = 0f;

        CanBoil    = false;
        boilBuffer = new WaitForSeconds(BoilBufferTime);

        targetSqrAvgSpd = 0;

        IsPaused = false;

        HeatUpEnabled = false;

        PartSys             = GetComponent <ParticleSystem>();
        partArray           = new ParticleSystem.Particle[PartSys.main.maxParticles];
        mainPartSys         = PartSys.main;
        heatUpWaitTime      = HeatUpMaxWaitTime;
        deltaHeatUpWaitTime = HeatUpMaxWaitTime / heatUpStates;
        minHeatUpWaitTime   = HeatUpMaxWaitTime - (deltaHeatUpWaitTime * (float)(heatUpStates));
        if (minHeatUpWaitTime < 0)
        {
            CBUG.SrsError("MIN HEAT RATE TOO LOW, LOWER DELTA or RAISE MAXSECONDS: " + minHeatUpWaitTime);
        }
        sqrAvgSpd = mainPartSys.startSpeed.constant * mainPartSys.startSpeed.constant;
    }
示例#3
0
        //Order: [date1] [citycode1] [statecode1] [truckid1]
        public DataPoint(string Time, string CityCode, string StateCode, string TruckID)
        {
            this.TruckID    = TruckID;
            this.Time       = Time;
            this.CityCode   = CityCode;
            this.StateCode  = StateCode;
            TruckIDLength   = 4;
            TimeLength      = 10;
            CityCodeLength  = 7;
            StateCodeLength = 2;
            TotalLength     = TimeLength + TruckIDLength + CityCodeLength + StateCodeLength;

            if (Time.Length != TimeLength)
            {
                CBUG.SrsError("BAD TIME LENGTH! Must be " + TimeLength + " characters long.");
            }
            if (CityCode.Length != CityCodeLength)
            {
                CBUG.SrsError("BAD CITY CODE LENGTH! Must be " + CityCodeLength + " characters long.");
            }
            if (StateCode.Length != StateCodeLength)
            {
                CBUG.SrsError("BAD STATE CODE LENGTH! Must be " + StateCodeLength + " characters long.");
            }
            if (TruckID.Length != TruckIDLength)
            {
                CBUG.SrsError("BAD TRUCK ID LENGTH! Must be " + TruckIDLength + " characters long.");
            }
        }
示例#4
0
    private bool checkFormat(string url)
    {
        string newURL;

        if (!url.Contains("?"))
        {
            CBUG.SrsError("URL DOES NOT CONTAIN '?': " + url);
            return(false);
        }
        //Making sure there is only 1 "?".
        int qLocation = url.LastIndexOf("?");

        if (url.LastIndexOf("?", qLocation - 1) != -1)
        {
            CBUG.SrsError("URL CONTAINS TOO MANY '?'s: " + url);
            return(false);
        }
        int startPoint = url.LastIndexOf("?");

        newURL = url.Substring(startPoint + 1);
        DataPoint t = new DataPoint("");
        int       dataPointLength = t.TotalLength;

        if (newURL.Length % dataPointLength != 0)
        {
            CBUG.SrsError("BAD URL: " + url + " ARG LENGTH! Must be divisible by: " + dataPointLength);
            return(false);
        }
        return(true);
    }
示例#5
0
    private List <DataPoint> _getDataFromURL(string url)
    {
        if (checkFormat(url) == false)
        {
            CBUG.SrsError("BAD URL! Didn't pass format check!: " + url);
            return(null);
        }
        int              startPoint      = url.LastIndexOf("?");
        string           newURL          = url.Substring(startPoint + 1);
        DataPoint        t               = new DataPoint("");
        int              dataPointLength = t.TotalLength;
        float            totalDataPoints = newURL.Length / dataPointLength;
        List <DataPoint> newPoints       = new List <DataPoint>();

        //Order: [date1] [citycode1] [statecode1] [truckid1]
        for (int x = 0; x < totalDataPoints; x++)
        {
            newPoints.Add(new DataPoint(
                              newURL.Substring(x * dataPointLength, t.TimeLength),
                              newURL.Substring(x * dataPointLength + t.TimeLength, t.CityCodeLength),
                              newURL.Substring(x * dataPointLength + t.TimeLength + t.CityCodeLength, t.StateCodeLength),
                              newURL.Substring(x * dataPointLength + t.TimeLength + t.CityCodeLength + t.StateCodeLength, t.TruckIDLength)
                              )
                          );
        }
        return(newPoints);
    }
示例#6
0
 private void Awake()
 {
     if (GameObject.FindGameObjectsWithTag("NeighbourhoodManager").Length > 1)
     {
         CBUG.SrsError("MORE THAN ONE EXISTS");
         PhotonNetwork.Destroy(gameObject);
     }
 }
示例#7
0
    public GameObject SpawnSingletonResource(string singletonName)
    {
        //todo ??? network-ize this.
        GameObject singleton = SpawnObject(singletonName);

        if (singleton == null)
        {
            CBUG.SrsError("No singleton is available for name: " + singletonName);
            return(null);
        }
        singletons.Add(singletonName, singleton);
        return(singleton);
    }
示例#8
0
文件: NetIDs.cs 项目: eliot2/Sunset
    public static void Remove(int netID)
    {
        if (roomIDsList == null)
        {
            roomIDsList = new List <int>();
        }

        bool removedSuccessfully = roomIDsList.Remove(netID);

        if (!removedSuccessfully)
        {
            CBUG.SrsError("Attempted to remove a NetID that doesn't exist!");
        }
    }
示例#9
0
    // Use this for initialization
    void Start()
    {
        if (GameObject.FindGameObjectsWithTag("URLLoader").Length > 1)
        {
            CBUG.SrsError("There must be only one URLLoader per scene!");
        }

        //If the URL contains a '?' then everything before it is the root.
        //If not, then everything is the root.
        if (Application.absoluteURL.Contains("?"))
        {
            rootURL = Application.absoluteURL.Substring(0, Application.absoluteURL.LastIndexOf("?"));
        }
        else
        {
            rootURL = Application.absoluteURL;
        }
        DoneInstatiating = true;
    }
示例#10
0
    private IEnumerator __delayAnim(Animator anim, float time,
                                    string clipName   = "",
                                    string trigger    = "",
                                    float floatParam  = -1f,
                                    int intParam      = -1,
                                    bool boolParam    = false,
                                    bool hasBoolParam = false)
    {
        if (time <= 0f)
        {
            yield return(0f);
        }
        else
        {
            yield return(new WaitForSeconds(time));
        }

        if (clipName != "" && trigger == "")
        {
            CBUG.SrsError("clipName Required!");
        }

        if (hasBoolParam)
        {
            anim.SetBool(clipName, boolParam);
        }
        else if (trigger != "")
        {
            anim.SetTrigger(trigger);
        }
        else if (floatParam != -1f)
        {
            anim.SetFloat(clipName, floatParam);
        }
        else if (intParam != -1)
        {
            anim.SetFloat(clipName, intParam);
        }
    }
示例#11
0
    // Use this for initialization
    void Start()
    {
        if (GameObject.FindGameObjectsWithTag("ParseManager").Length > 1)
        {
            CBUG.SrsError("There must be only one ParseManager per scene!");
        }

        rootPath    = Application.streamingAssetsPath;
        cityCSVPath = System.IO.Path.Combine(rootPath, CityCSV);
        CBUG.Do("CityCSVPath: " + cityCSVPath);
        stateCSVPath = System.IO.Path.Combine(rootPath, StateCSV);
        //for testing:
        //Application.ExternalEval("window.open('" + stateCSVPath + "');");
        CBUG.Do("StateCSVPath: " + stateCSVPath);
        cityDataByState = new List <City> [TotalStates];
        fillArrayWithClass <List <City> >(ref cityDataByState);
        engine_CityData  = new FileHelperEngine <CityData>();
        engine_StateData = new FileHelperEngine <StateData>();
        StateNameToID    = new Dictionary <string, int>();
        StateAbbrToID    = new Dictionary <string, int>();
        dataLoaded       = false;
        currentCity      = -1;
        currentState     = 0;
        if (Application.isEditor)
        {
            _cityData  = engine_CityData.ReadFile(cityCSVPath);
            _stateData = engine_StateData.ReadFile(stateCSVPath);
            makeCityList();
        }
        else
        {
            //"http://paultproductions.com/trackerS2/StreamingAssets/IDToCityToState.csv"
            StartCoroutine(loadCityDataWeb(cityCSVPath));
            StartCoroutine(loadStateDataWeb(stateCSVPath));
        }
    }