Пример #1
0
 internal PirateController(IPersonModel model, GameObject view,
                           IActionSystem actionSystem,
                           IPersonController hero)
     : base(model, view, actionSystem)
 {
     _hero = hero;
 }
Пример #2
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);
        }
Пример #3
0
        public void RegisterSystems()
        {
            actionSystems = new Dictionary <Type, IActionSystem>();
            propertyTypes = new Dictionary <Type, Type>();
            List <ActionData> actionDatas = new List <ActionData>();

            for (int i = 0; i < assemblies.Length; ++i)
            {
                GetActionSystemsFromAssembly(Assembly.Load(assemblies[i]),
                                             actionDatas);
            }

            int numDatas = actionDatas.Count;

            for (int i = 0; i < numDatas; ++i)
            {
                ActionData data = actionDatas[i];
                propertyTypes.Add(data.actionType, data.propertyType);
                IActionSystem instance = (IActionSystem)Activator.CreateInstance(data.actionSystemType);
                actionSystems.Add(data.actionType, instance);
                OnActionSystemRegistered(instance);
                Log($"Registered ActionSystem {data.actionSystemType} for action {data.actionType}");
            }

            // int numPlugins = systems.Count;
            // for (int i = 0; i < numPlugins; ++i) {
            //     systems[i].Ready();
            // }
        }
Пример #4
0
 public void Run()
 {
     if (this.name == "ElasticBand")
     {
         ItemLogic = new inv_ElasticBand(this.transform.gameObject, latchLayer, useDistance);
         ItemLogic.Run();
         Debug.Log("Item Logic is Running");
     }
 }
Пример #5
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);
        }
        public PersonController(IPersonModel model, GameObject view,
                                IActionSystem actionSystem)
        {
            Model = model;
            _view = view;

            _lootSystem = new PersonLootSystem()
            {
                View = _view, Model = Model
            };
            _actionSystem = new PersonActionSystem(actionSystem)
            {
                View = _view, Model = Model
            };
        }
Пример #7
0
        private void InitializePirates(
            ControllersStorage controllers, GameModel model,
            IActionSystem actionSystem,
            HeroController hero)
        {
            PiratesViewFabric viewFabric = new PiratesViewFabric();

            for (int i = 0; i < model.Pirates.Length; ++i)
            {
                var pirate = new PirateController(
                    model.Pirates[i], viewFabric.CreateGameObject(), actionSystem, hero);
                pirate.SelectAction(0);

                controllers.Add(pirate);
            }
        }
 public PersonActionSystem(IActionSystem actionStorage)
 {
     _actionSystem = actionStorage;
 }
 internal HeroController(IPersonModel model, GameObject view,
                         IActionSystem actionSystem)
     : base(model, view, actionSystem)
 {
 }
Пример #10
0
 public void ClearState()
 {
     this.currentState = null;
 }
Пример #11
0
 public void ChangeState(IActionSystem newActionSystem)
 {
     this.currentState = newActionSystem;
 }