示例#1
0
        private HeroController InitializeCameraAndPlayer(
            ViewsFabric viewsFabric,
            ControllersStorage controllers, GameModel model,
            IPlayerInput playerInput,
            IActionSystem actionSysterm)
        {
            GameObject heroView = viewsFabric.CreateAnastasia();

            heroView.transform.position = model.Hero.InitPosition;
            var hero = new HeroController(model.Hero, heroView, actionSysterm);

            GameObject cameraView = viewsFabric.CreateCamera();

            cameraView.transform.position = model.Camera.InitPosition;
            var camera = new CameraController(model.Camera, cameraView);

            GameObject zondView        = viewsFabric.CreateZond();
            GameObject frontCameraView = viewsFabric.CreateFrontCamera();
            var        zondController  = new ZondController(frontCameraView, zondView, heroView);

            var player = new PlayerController(playerInput, cameraView, hero);

            player.Go_To_Point   += camera.AddNewTargetPosition;
            player.Current_Point += zondController.SetPosition;

            controllers.Add(player);
            controllers.Add(hero);
            controllers.Add(camera);
            controllers.Add(zondController);

            return(hero);
        }
示例#2
0
        public InitGame(ControllersStorage controllers, GameModel model,
                        IPlayerInput playerInput)
        {
            ViewsFabric viewsFabric = new ViewsFabric();


            IActionSystem actionsController = InitActions(controllers);

            HeroController hero = InitializeCameraAndPlayer(viewsFabric,
                                                            controllers, model, playerInput, actionsController);

            InitializeChests(controllers, model);
            InitializePirates(controllers, model, actionsController, hero);
        }