Ejemplo n.º 1
0
        public void UseNitro()
        {
            if (ControllableCar == null)
            {
                return;
            }

            ControllableCar.UseNitro();
        }
Ejemplo n.º 2
0
        private void StopMoving(bool wonFlag, Racing3DGameModel.GameoverReason stopReason, bool showGameOverUI = true)
        {
            OpponentCar.StopMoving();
            ControllableCar.StopMoving();

            if (showGameOverUI)
            {
                view.ShowGameOverUI(wonFlag, stopReason);
            }
        }
Ejemplo n.º 3
0
        public void StartGame()
        {
            Application.targetFrameRate = 60;
            var self = GameServices.RealTime.GetSelf();

            selfId = self.ParticipantId;
            var opponent = GameServices.RealTime.GetConnectedParticipants().Where(p => !p.ParticipantId.Equals(selfId)).FirstOrDefault();

            opponentId = opponent.ParticipantId;
            model      = new Racing3DGameModel(selfId, opponentId);
            IsPlaying  = true;

            ClearOldPowerUps();
            ClearSideObjects();

            if (model.IsHost)
            {
                var powerUpsPosition = GenerateRandomPositions();
                InstantiatePowerUps(powerUpsPosition);
                model.PowerUpsPosition = powerUpsPosition;

                var sideObjectsPosition = GenerateRandomSidePositions();
                InstantiateSideObjects(sideObjectsPosition);
                model.SideObjectsPosition = sideObjectsPosition;

                isStartMessageReceived = false;
                shouldSendStartMessage = true;
            }

            ControllableCar.ResetValues();
            ControllableCar.Controllable = true;
            OpponentCar.ResetValues();
            OpponentCar.Controllable = false;

            cameraControl.transform.position = ControllableCar.PrepareCameraPosition;
            view.ShowPrepareText();
            view.ShowInGameUI();
            LoadInfos(self, opponent);
        }
Ejemplo n.º 4
0
 private void StartMoving()
 {
     ControllableCar.StartMoving(true);
     OpponentCar.StartMoving(false);
     cameraControl.StartFollowing(ControllableCar.gameObject);
 }