Beispiel #1
0
    // Start is called before the first frame update
    void Start()
    {
        trafficController = FindObjectOfType <LocalTraffic>();

        actualTopSpeed = Random.Range(topSpeed - topSpeedDelta, topSpeed + topSpeedDelta);      // Calculates initial random top speed

        State = DrivingState.MovingToNextPoint;                                                 // Set to start driving

        iAmTurningLeft = false;                                                                 // Not turning left
        iAmAvoidingLeftPittsburghLeft = false;                                                  // Don't have to slow down to avoid a left turn
        upDir         = this.transform.up;
        initialUpDir  = this.transform.up;
        lastBankAngle = 0;
    }
    public static void Execute(Action getSnapshot)
    {
        const string message = "SysGarbage was optimized";

        getSnapshot();
        var local = Create<LocalTraffic>(LocalTraffic.Count);
        var sysGarbage = Create<object>(Garbage.SystemCount);

        //preventing optimization
        if (sysGarbage.Length < Garbage.SystemCount)
          throw new Exception(message);

        getSnapshot();

        var local1 = new LocalTraffic();

        getSnapshot();

        GC.KeepAlive(local);
        GC.KeepAlive(local1);
    }
    public static void Execute(Action getSnapshot)
    {
        const string message = "SysGarbage was optimized";

        getSnapshot();
        var local      = Create <LocalTraffic>(LocalTraffic.Count);
        var sysGarbage = Create <object>(Garbage.SystemCount);

        //preventing optimization
        if (sysGarbage.Length < Garbage.SystemCount)
        {
            throw new Exception(message);
        }

        getSnapshot();

        var local1 = new LocalTraffic();

        getSnapshot();

        GC.KeepAlive(local);
        GC.KeepAlive(local1);
    }