示例#1
0
    public void InitTankFlocks(SimData simData)
    {
        int[] tankCounts = simData.GetTankCounts();
        int[,] tankSpecs = simData.GetTankSpecs();

        for (int side = 0; side < 2; side++)
        {
            int count = tankCounts[side];
            for (int i = 0; i < count; i++)
            {
                // put tank in flock
                int[]      specs   = { tankSpecs[side, 0], tankSpecs[side, 1], tankSpecs[side, 2] };
                GameObject newTank = tankFacotry.createTank(specs, simObserver, "Tank" + side + i);
                flocks[side].addTank(newTank);

                // place in position
                Vector3 newPosition = spawnPoints[side].position;
                newPosition.z += (i * 3);
                newTank.transform.position = newPosition;
            }
        }

        // add tank to gamemanager
        gameManager.SetCameraTargets(flocks, tankCounts);
    }