Ejemplo n.º 1
0
        public void Run(string name, TcpClient client)
        {
            IOutputSystem outputSystem = new ConsoleOutput();
            ISystemInput  systemInput  = new SystemInput();

            //IMenuBuilder launcRocket = new TextMenuBuilder("Launch Menu : ", outputSystem, systemInput);

            ServerHandler serverHandler      = new ServerHandler(name, client);
            IMenuBuilder  managerMenuBuilder = new NumberMenuBuilder("Manager options : ", outputSystem, systemInput)
                                               .AddOptions("Add user from group", new AddUserToChatOption(name, serverHandler))
                                               .AddOptions("Remove user from group", new RemoveUserFromChatOption(name, serverHandler))
                                               .AddOptions("Add user as admin", new AddManagerPermissionOption(name, serverHandler))
                                               .AddOptions("Remove user as admin", new RemoveManagerPermissionOption(name, serverHandler));



            IMenu numberMenuBuilder = new NumberMenuBuilder("Chat options : ", outputSystem, systemInput).
                                      AddOptions("Get All Chats", new GetAllChatOption(serverHandler)).
                                      AddOptions("Create Private Chat", new PrivateChatCreatorOption(name, serverHandler)).
                                      AddOptions("Create Group Chat", new GroupChatCreatorOption(name, serverHandler)).
                                      AddOptions("Manager Options", new NavigateMenuOption(managerMenuBuilder.Build())).
                                      AddOptions("Go into chat", new InsertToChatOption(serverHandler)).
                                      AddOptions("Exit from Group", new ExitChatOption(name, serverHandler)).
                                      AddOptions("Exit from chat", new MenuExitOption())
                                      .Build();

            managerMenuBuilder.AddOptions("MoveBack", new NavigateMenuOption(numberMenuBuilder));


            //launcRocket.AddOptions("MoveBack", new NavigateMenu(numberMenuBuilder))


            numberMenuBuilder.Run();
        }
Ejemplo n.º 2
0
    private void Start()
    {
        _inputModel  = new InputModel();
        _systemInput = new SystemInput(_inputModel);

        _playerMove = new PlayerMoveSystem(_inputModel, player);

        _mazeManager = new Maze.MazeManager(Tessellation, Maze.GenerationAlgorithmEnum.RecursiveBacktracker);

        switch (Tessellation)
        {
        case TessellationType.Orthigonal:
            _mazeManager.CreateMaze(new Vector3(0, 0), CellSize, MazeWidth, MazeHeight);
            break;

        case TessellationType.Theta:
            _mazeManager.CreateMaze(new Vector3(0, 0), CellSize, OuterDiameter, InnerDiameter, AmountCellInFirstLayer, 0);
            break;
        }

        player.transform.position = new Vector3()
        {
            x = 0,
            y = 0
        };
    }
Ejemplo n.º 3
0
    private void Update()
    {
        float delta = Time.deltaTime * moveSpeed;

        Vector2 position = SystemInput.GetCursorPosition();

        //TODO: Add keyboard keys to SystemInput so we don't need focus to read Input
//		if (SystemInput.GetKey(KeyCode.Keypad8))

        if (Input.GetKey(KeyCode.Keypad8))
        {
            position += Vector2.down * delta;
        }

        if (Input.GetKey(KeyCode.Keypad5))
        {
            position += Vector2.up * delta;
        }

        if (Input.GetKey(KeyCode.Keypad4))
        {
            position += Vector2.left * delta;
        }

        if (Input.GetKey(KeyCode.Keypad6))
        {
            position += Vector2.right * delta;
        }

        SystemInput.SetCursorPosition(new Vector2Int(Mathf.RoundToInt(position.x), Mathf.RoundToInt(position.y)));
    }
Ejemplo n.º 4
0
        private void CreateSystems()
        {
            SystemManager systemManager = SystemManager.Instance();

            Game_Engine.Systems.System newSystem;

            newSystem = new SystemRender(entityCamera);
            systemManager.AddRenderSystem(newSystem);

            newSystem = new SystemRender(mapCamera);
            systemManager.AddRenderSystem(newSystem);

            newSystem = new SystemInput();
            systemManager.AddUpdateSystem(newSystem);

            newSystem = new SystemPhysics();
            systemManager.AddUpdateSystem(newSystem);

            newSystem = new SystemCollision();
            systemManager.AddUpdateSystem(newSystem);

            newSystem       = new SystemArtificialInput(map);
            artificialInput = (SystemArtificialInput)newSystem;
            systemManager.AddUpdateSystem(newSystem);

            newSystem = new SystemAnimation();
            systemManager.AddUpdateSystem(newSystem);

            newSystem = new SystemAudio();
            systemManager.AddUpdateSystem(newSystem);
        }
Ejemplo n.º 5
0
 public void DisableKeyboardCapture()
 {
     if ((int)kbHookHandle != 0)
     {
         SystemInput.UnhookWindowsHookEx(kbHookHandle);
     }
 }
Ejemplo n.º 6
0
    private void StartGame()
    {
        _cameraObject = Instantiate(_cameraPrefab);

        var   camera   = _cameraObject.GetComponent <Camera>();
        float widthCam = camera.orthographicSize * camera.aspect;

        fieldBoundary = new Vector2(widthCam, 1f);

        _inputModel  = new InputModel();
        _systemInput = new SystemInput(_inputModel);

        _playerManager     = new PlayerManager(_playerPrefab, _playerUIPrefab, _playerData);
        _playerMoveSystem  = new PlayerMoveSystem(_inputModel, _playerManager.PlayerModel, fieldBoundary);
        _playerShootSystem = new PlayerShootSystem(_inputModel, _playerManager.PlayerModel);

        _enemyManager    = new EnemyManager(_enemyDatas, _enemyPrefabs, fieldBoundary.x);
        _enemyMoveSystem = new EnemyMoveSystem(_enemyManager, _playerManager.PlayerModel, fieldBoundary);

        _scoringSystem    = new ScoringSystem(_playerManager.PlayerModel, _enemyManager);
        _spawnEnemySystem = new SpawnEnemySystem(_enemyManager);

        _playerManager.Destroy += EndGame;


        _playerManager.SpawnPlayer(Vector3.zero, Quaternion.identity);
        inGame = true;
    }
Ejemplo n.º 7
0
        private static Vector2 GetMousePosition()
        {
            var mousePos  = SystemInput.GetMousePosition();
            var mousePosV = new Vector2(mousePos.x, mousePos.y);

            return(mousePosV);
        }
    void Update()
    {
        if (useSystemInput)
        {
            SystemInput.Process();
        }

        SetClickThrough();
    }
        /// <summary>
        /// Initialize the finite state machine (FSM) with the fighter
        /// being controlled by the AI system and the intial state
        /// (of the FSM).
        /// </summary>
        /// <param name="intelligentFighter">Intelligent fighter.</param>
        /// <param name="initialState">Initial state.</param>
        /// <param name="tacticalMindInput">Tactical mind input. This can be null.</param>
        public void Initialize(IFighter intelligentFighter, IState initialState, SystemInput tacticalMindInput)
        {
            if (intelligentFighter == null)
            {
                throw new System.ArgumentException("IFighter reference not found.");
            }

            if (initialState == null)
            {
                throw new System.ArgumentException("IState reference not found.");
            }

            _intelligentCharacter = new IntelligentCharacter(intelligentFighter, this);
            _currentState         = initialState;
            _tacticalMindInput    = tacticalMindInput;
        }
    void Update()
    {
        if (useSystemInputIfAvailable)
        {
            if (SystemInput.GetMouseButtonDown(1))
            {
                InstantiatePrefab();
            }

            return;
        }

        if (Input.GetMouseButtonDown(1))
        {
            InstantiatePrefab();
        }
    }
Ejemplo n.º 11
0
        private void CreateSystems()
        {
            ISystem newSystem;

            newSystem = new SystemMinimap(minimap);
            systemManager.AddSystem(newSystem);
            newSystem = new SystemRender();
            systemManager.AddSystem(newSystem);
            newSystem = new SystemLighting();
            systemManager.AddSystem(newSystem);
            newSystem = new SystemInput();
            systemManager.AddSystem(newSystem);
            newSystem = new SystemPhysics();
            systemManager.AddSystem(newSystem);
            newSystem = new SystemAI();
            systemManager.AddSystem(newSystem);
            newSystem = new SystemPickUp();
            systemManager.AddSystem(newSystem);
            newSystem = new SystemAudio();
            systemManager.AddSystem(newSystem);
        }
Ejemplo n.º 12
0
 public void InitKeyboardCapture()
 {
     SystemInput.KeyHandler  = null;
     SystemInput.KeyHandler += SystemInput.KeyCallback;
     kbHookHandle            = SystemInput.SetWindowsHookEx(2, SystemInput.KeyHandler, IntPtr.Zero, (int)SystemInput.GetCurrentThreadId());
 }
Ejemplo n.º 13
0
 private static Vector2 GetMousePosition()
 {
     SystemInput.POINT cursorPos;
     SystemInput.GetCursorPos(out cursorPos);
     return(new Vector2(cursorPos.X, cursorPos.Y));
 }