Пример #1
0
    private void Awake()
    {
        tf     = transform;
        pos    = tf.position.ToV2();
        dir    = Random.insideUnitCircle.normalized;
        facing = dir;

        halfWidth  = tf.localScale.x / 2;
        halfHeight = tf.localScale.z / 2;

        bounds = BoidBase.bounds;
        sets   = BoidBase.sets;
    }
    private void Start()
    {
        startFrame = Time.frameCount;
        startTime  = Time.time;
        if (useMenuSettings)
        {
            sets = menuSettings;
        }
        BoidBase.bounds = sets.bounds;
        BoidBase.sets   = sets;
        type            = sets.type;

        if (type == QtTestType.Physics2D || type == QtTestType.PhysicsXY)
        {
            Camera.main.transform.position = new Vector3(sets.bounds.width / 2, sets.bounds.height / 2, -50);
            Camera.main.transform.Rotate(new Vector3(-90, 0, 0));
        }
        else
        {
            Camera.main.transform.position = new Vector3(sets.bounds.width / 2, 50, sets.bounds.height / 2);
        }

        Camera.main.orthographicSize = sets.bounds.height / 1.6f;


        r = new System.Random(12345);
        //insert boids
        switch (type)
        {
        case QtTestType.Physics:
            InitPhysics();
            break;

        case QtTestType.Quadtree:
            InitQuadtree();
            break;

        case QtTestType.LooseQuadtree:
            InitLooseQuadtree();
            break;

        case QtTestType.UGrid:
            InitUGrid();
            break;

        case QtTestType.LooseDGrid:
            InitLDGrid();
            break;

        case QtTestType.Physics2D:
            InitPhysics2D();
            break;

        case QtTestType.PhysicsXY:
            InitPhysicsXY();
            break;

        default:
            break;
        }

        framerateResults.gameObject.SetActive(sets.showFPS);
        framerateResults.text += " (" + frames.ToString() + " frames)";
    }