Ejemplo n.º 1
0
    public void UpdateEntering()
    {
        _gameEntering.Update();
        if (_gameEntering.state == BattleGameEntering.STATE.OVER)
        {
            List <Unit> units = unitGroup.allUnits;
            foreach (Unit unit in units)
            {
                unit.StartFight();
            }

            float       avarageSpeed = 0;
            List <Unit> myUnits      = _unitGroup.myUnits;
            foreach (Unit unit in myUnits)
            {
                avarageSpeed += unit.unit.dataUnit.speed;
            }
            avarageSpeed /= myUnits.Count;

            //			UnitLayout layout = CameraHelper.CalcAllAliveTanksLayout ();
            Vector3 targetCenter = new Vector3(
                _mapGrid.GetMapWidth() / 2,                // - MapGrid.GRID_SIZE,
                0,
                _mapGrid.GetMapHeight() / 2);
            _mapCamera.cSmoothMove.Init(_mapCamera.cameraControl.cameraCenter, targetCenter, 10 / avarageSpeed);
//			_mapCamera.cSmoothMove.Init(_mapCamera.cLookAt.cameraCenter, targetCenter, 10 / avarageSpeed);
            _mapCamera.SetState(MapCamera.STATE.SMOOTH_MOVE);

            _battleStartTimeStamp = TimeHelper.GetCurrentTimestampScaled();

            SwitchState(STATE.BATTLE);
        }
    }