Inheritance: MonoBehaviour
 /// <summary>
 /// 发送给WIFI
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void MapIPFromWifi(object sender, DataTransmissionEventArgs args)
 {
     if (args.Token.ConnectSocket != null)
     {
         AsyncSocketUserToken socket = args.Token;
         long       ip         = ControllerManager.GetLongIPFromSocket(socket);
         Controller controller = ControllerManager.Instance().Get(ip);
         if (controller != null)
         {
             if (controller.SocketToken != null)
             {
                 AsyncServer.Instance().CloseClientSocketEx(controller.SocketToken);
             }
             controller.SocketToken = socket;
             if (SocketConnectOrCloseResponse != null)
             {
                 SocketConnectOrCloseResponse(this, new SocketConnectArgs(true, socket));
             }
             //新连接的客户端要对它发送泵类型指令
             if (SendPumpType2Wifi != null)
             {
                 SendPumpType2Wifi(this, new SocketConnectArgs(true, socket));
             }
         }
         else
         {
             if (m_Device != null)
             {
                 m_Device.CloseClientSocket(args.Token);
             }
             Logger.Instance().ErrorFormat("MapIPFromWifi()->ControllerManager.Instance().Get 错误,IP={0}", ip);
             return;
         }
     }
 }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        //looks for the proper update routine
        switch (currentState)
        {
        case GameState.MainMenu:
            //looks for player input using the Menu control scheme
            ControllerManager.MenuController();
            break;

        case GameState.GameStart:
            //looks for player input using the Gameplay control scheme
            ControllerManager.GameplayController();
            break;

        case GameState.GameOver:
            //looks for player input using the Menu control scheme
            ControllerManager.MenuController();
            break;

        default:

            break;
        }
    }
        /// <summary>
        /// 响应串口层上传的数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void ReceiveData(object sender, DataTransmissionEventArgs args)
        {
            AsyncSocketUserToken socket = args.Token;

            if (socket == null)
            {
                return;
            }
            long         ip     = ControllerManager.GetLongIPFromSocket(socket);
            SocketBuffer buffer = null;

            lock (m_HashReceivedBuffer)
            {
                if (m_HashReceivedBuffer.ContainsKey(ip))
                {
                    buffer = (SocketBuffer)m_HashReceivedBuffer[ip];
                }
                else
                {
                    buffer = new SocketBuffer();
                    m_HashReceivedBuffer.Add(ip, buffer);
                }
                buffer.RemoteSock = socket;
                //lxm 20161013修改,传入的字节流要进行一次转换,将字符字节两两合成一个16进制数据,比如:'F'和'5' 合成0xF5
                buffer.ReceivedCharBuffer.AddRange(args.EventData);
                args.EventData.Clear();
                buffer.IsReady = Char2Hex(buffer);
                if (buffer.IsReady)
                {
                    m_SemReceiveCommand.Release(1);
                }
            }
        }
Beispiel #4
0
        protected virtual void Dispose(bool disposing)
        {
            if (!IsDisposed)
            {
                if (disposing)
                {
                    ControllerManager.RemoveAllController();
                    ChannelManager.RemoveAllChannel();

                    ICollection <IRunDevice> devs = DeviceManager.GetValues();
                    foreach (IRunDevice dev in devs)
                    {
                        dev.Exit();
                    }

                    DeviceManager.RemoveAllDevice();
                }

                _monitorException.UnMonitor();

                IsDisposed = true;

                Logger.InfoFormat(false, "{0}-{1}", ServerName, "已经停止");
            }
        }
        public void Initialize(StillDesign.PhysX.Scene _scene)
        {
            scene = _scene;

            manager = scene.CreateControllerManager();



            CapsuleControllerDescription capsuleControllerDesc = new CapsuleControllerDescription(0.5f, 1);

            controllerHitReport            = new PlayerControllerHitReport();
            capsuleControllerDesc.Callback = controllerHitReport;

            /*{
             *  Callback = new ControllerHitReport()
             * };*/

            CapsuleController capsuleController = manager.CreateController <CapsuleController>(capsuleControllerDesc);

            capsuleController.Position   = player.Position.xna();
            capsuleController.Actor.Name = "PlayerController";
            capsuleController.SetCollisionEnabled(true);


            controller = capsuleController;
        }
Beispiel #6
0
        List <Entity> itemAttached;       //Item that attached to character

        public CharacterController(
            GameWorld world,
            ModCharacterDfnXML chaData,
            ModCharacterSkinDfnXML chaSkin,
            Mogre.Vector3 initPosition,
            bool isBot = true) : base(world.Camera)
        {
            this.world       = world;
            controlled       = !isBot;
            itemAttached     = new List <Entity>();
            charaMeshName    = chaSkin.Mesh;
            physicsScene     = world.PhysicsScene;
            physics          = physicsScene.Physics;
            cotrollerManager = physics.ControllerManager;
            this.chaData     = chaData;
            this.chaSkin     = chaSkin;

            setupBody(initPosition);
            if (controlled)
            {
                setupCamera(camera);
            }
            //setupAnimations();
            setupPhysics();
        }
        public void CreateControllerTest_InputAlienWave()
        {
            //Erzeugung Testumgebung

            ControllerManager target = new ControllerManager();
            //Nicht benötigt
            object sender = null;


            BehaviourEnum          behaviour   = BehaviourEnum.BlockMovement;
            LinkedList <IGameItem> controllees = new LinkedList <IGameItem>();

            controllees.AddFirst(new Alien(Vector2.Zero, new Vector2(5, 5), 1, 1, new PlayerNormalWeapon(), 7));

            DifficultyLevel difficultyLevel = DifficultyLevel.EasyDifficulty;



            ControllerEventArgs desiredController = new ControllerEventArgs(behaviour, controllees, difficultyLevel); // TODO: Initialize to an appropriate value


            //Test start
            target.CreateController(sender, desiredController);


            //Testergebnis
            Assert.AreEqual(target.Controllers.Count, 1);
        }
Beispiel #8
0
    void Turning()
    {
        float hori = ControllerManager.GetAxis(ControllerInputWrapper.Axis.RightStickX, joystickNum, true);
        float vert = ControllerManager.GetAxis(ControllerInputWrapper.Axis.RightStickY, joystickNum, true);

        if (Mathf.Abs(hori) > 0.01f || Mathf.Abs(vert) > 0.01f)
        {
            //Debug.Log ("Turning by right analog");
            Vector3    direction   = new Vector3(hori, 0f, vert);
            Quaternion newRotation = Quaternion.LookRotation(direction, transform.up);
            transform.rotation = newRotation;
            //Quaternion.Lerp (transform.rotation, newRotation, Time.deltaTime * 100f);


            //Debug.Log ("hori = " + hori);
            //Debug.Log ("vert = " + vert);
        }


        /*Ray camRay = Camera.main.ScreenPointToRay (Input.mousePosition);
         *
         * RaycastHit floorHit;
         *
         * if(Physics.Raycast(camRay, out floorHit, camRayLength, floorMask)){
         *      Vector3 playerToMouse = floorHit.point - transform.position;
         *      playerToMouse.y = 0f;
         *
         *      Quaternion newRotation = Quaternion.LookRotation(playerToMouse);
         *      playerRigidbody.MoveRotation(newRotation);
         *
         * }*/
    }
Beispiel #9
0
    // Use this for initialization
    void Start()
    {
        var controllerManager = ControllerManager.getInstance();
        var obj = controllerManager.gameObject;

        obj.transform.parent = transform;
    }
Beispiel #10
0
        public void OnRun(ControllerManager controllerManager)
        {
            var firstEye  = controllerManager.GetMatrixAt(0);
            var secondEye = controllerManager.GetMatrixAt(1);

            PushGrid(controllerManager, EyeSamples.CenterEye, secondEye);


            PushGrid(controllerManager, EyeSamples.CenterEye, firstEye);
            System.Threading.Thread.Sleep(1000);
            PushGrid(controllerManager, EyeSamples.Blink1, firstEye);
            System.Threading.Thread.Sleep(50);
            PushGrid(controllerManager, EyeSamples.Blink2, firstEye);
            System.Threading.Thread.Sleep(50);
            PushGrid(controllerManager, EyeSamples.Blink3, firstEye);
            System.Threading.Thread.Sleep(50);
            PushGrid(controllerManager, EyeSamples.Blink4, firstEye);
            System.Threading.Thread.Sleep(50);
            PushGrid(controllerManager, EyeSamples.Blink5, firstEye);
            System.Threading.Thread.Sleep(1250);
            PushGrid(controllerManager, EyeSamples.Blink4, firstEye);
            System.Threading.Thread.Sleep(50);
            PushGrid(controllerManager, EyeSamples.Blink3, firstEye);
            System.Threading.Thread.Sleep(50);
            PushGrid(controllerManager, EyeSamples.Blink2, firstEye);
            System.Threading.Thread.Sleep(50);
            PushGrid(controllerManager, EyeSamples.Blink1, firstEye);
            System.Threading.Thread.Sleep(50);
            PushGrid(controllerManager, EyeSamples.CenterEye, firstEye);
        }
	private void Start()
	{
        if (instance == null)
        {
            instance = this;
        }
	}
Beispiel #12
0
    // Use this for initialization
    void Start()
    {
        master = GameObject.Find ("ControllerManager").GetComponent<ControllerManager> ();
        master.loadLevel (Application.loadedLevelName);

        int numPlayers = master.getNumPlayers ();
        for (int i = 0; i < numPlayers; i++) {
            players[i].SetActive(true);
            score[i].text = "Player " + (i+1) + " Score: " + master.score[i];
            combo[i].text = "Largest Combo: " + master.maxCombo[i];
            missed[i].text = "Missed Notes: " + master.missedNotes[i];
        }
        string victoryType;
        if (master.victoryType == 0) {
            victoryType = " musical mastery!";
        } else {
            victoryType = " blood!";
        }
        victoryText.text = "Player " + (master.victor) + " wins by right of " + victoryType;

        if (master.victor == 0)
            cat.sprite = catWon;
        else if (master.victor == 1)
            dog.sprite = dogWon;
    }
Beispiel #13
0
 private void UploadAlarm(BaseCommand e)
 {
     if (e != null && e.RemoteSocket != null)
     {
         Controller controller = ControllerManager.Instance().Get(e.RemoteSocket);
         if (controller != null)
         {
             int       dockNo = controller.DockNo;
             AgingDock dock   = m_DockList.Find((x) => { return((int)x.Tag == dockNo); });//在每个货架内部保存报警信息
             if (dock != null)
             {
                 dock.UpdateAlarmInfo(e as GetAlarm);
             }
             else
             {
                 Logger.Instance().ErrorFormat("UploadAlarm()->货架没找到 DockNo={0}", dockNo);
             }
         }
         else
         {
             IPEndPoint point  = e.RemoteSocket.ConnectSocket.RemoteEndPoint as IPEndPoint;
             byte[]     ipByte = point.Address.GetAddressBytes();
             long       ip     = ControllerManager.Bytes2Long(ipByte);
             Logger.Instance().ErrorFormat("UploadAlarm()->控制器没找到 ip={0}", ip);
         }
     }
     else
     {
         Logger.Instance().Error("UploadAlarm()->传入的参数为空");
     }
 }
Beispiel #14
0
    public SectorData(int modulesPerSectorCount)
    {
        this.modulesPerSectorCount = modulesPerSectorCount;

        spawnsUnused    = new List <int>(new int[] { 0, 1, 2 });
        reachedFighting = new bool[ControllerManager.Get().MaximumUsable];
    }
Beispiel #15
0
 private App()
 {
     _controllerManager = new ControllerManager(this);
     _viewManager       = new ViewManager();
     this._services     = new Dictionary <string, IModuleService>();
     this.LoadServices();
 }
    // Use this for initialization
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);

            currentInputs  = new Dictionary <INPUTACTION, INPUTSNAPSHOT>();
            previousInputs = new Dictionary <INPUTACTION, INPUTSNAPSHOT>();

            // build the previous and current input lists.
            for (int i = 0; i < actions.Count; i++)
            {
                currentInputs[actions[i].action]  = new INPUTSNAPSHOT();
                previousInputs[actions[i].action] = new INPUTSNAPSHOT();
            }

            inputDefLookup = new Dictionary <string, InputDefinition>();
            for (int i = 0; i < inputDefinitions.Count; i++)
            {
                inputDefLookup[inputDefinitions[i].joystickName] = inputDefinitions[i];
            }

            string[] inputNames = Input.GetJoystickNames();

            /*for (int i = 0; i < Input.GetJoystickNames().Length; i++)
             * {
             *  Debug.Log(i + " input: " + inputNames[i]);
             * }*/
        }
    }
    //初始化
    public void Start()
    {
        //UI
        myControlManager = new ControllerManager();
        myControlManager.Inject(myFigureSystem);
        myStateManager = new PlayerStateGroup();
        myStateManager.Inject(myFigureSystem);
        myLoginManager = new LoginUIControl();
        myLoginManager.Inject(myFigureSystem);
        myFirstLoginManager = new FirstLoginControl();


        //Start
        myControlManager.Start();
        myStateManager.Start();
        myLoginManager.Start();
        myFirstLoginManager.Start();

        //系統
        myFigureSystem = new FigureSystem();
        mySceneSystem  = new SceneSystem();

        //Start
        myFigureSystem.Start();
        mySceneSystem.Start();
    }
    private void Awake()
    {
        // Master
        MasterView viewMaster = Instantiate( masterView );
        viewMaster.Initialize( gameSetting.masterSetting );
        Master master = new Master( viewMaster );
        MasterAIControl masterControl = new MasterAIControl( master );

        // AI
        List<AIControl> AIControlList = new List<AIControl>();
        List<Character> AICharacter = new List<Character>();
        for ( int i = 0; i < AINumber; ++i )
        {
            CharacterView view = Instantiate( characterPrefab );
            view.Initialize( gameSetting.characterSetting );
            Character character = new Character( view );
            AIControl aiControl = new AIControl( gameSetting.AIControlSetting, character, master );
            AIControlList.Add( aiControl );
            AICharacter.Add( character );
        }

        // Player
        CharacterView playerView = Instantiate( characterPrefab );
        playerView.Initialize( gameSetting.characterSetting );
        Character player = new Character( playerView );
        PlayerControl playerControl = new PlayerControl( player, AICharacter );

        GameTime gameTime = new GameTime();
        controllerManager = new ControllerManager(playerControl, AIControlList, masterControl);
        gameManager = new GameManager( gameTime, controllerManager, player, AICharacter, master );

        successPanel.SetGameTime( gameTime );
    }
Beispiel #19
0
 public override void OnSelect()
 {
     if (ControllerManager.Get().AvailabeJoystickCount >= 1)
     {
         GamestateManager.Get().ChangeState(GamestateType.TrainingSettings);
     }
 }
Beispiel #20
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseWebSockets();
            app.UseRouting();


            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapRazorPages();
            });

            app.Use(async(context, next) =>
            {
                if (context.Request.Path == "/ws")
                {
                    if (context.WebSockets.IsWebSocketRequest)
                    {
                        await ControllerManager.HandleSocketConnection(context);
                    }
                    else
                    {
                        context.Response.StatusCode = 400;
                    }
                }
                else
                {
                    await next();
                }
            });
        }
 /// <summary>
 /// 删除序列号
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void AntiMapIPFromWifi(object sender, DataTransmissionEventArgs args)
 {
     if (args.Token != null)
     {
         AsyncSocketUserToken socket = args.Token;
         if (socket.ConnectSocket == null || socket.ConnectSocket.RemoteEndPoint == null)
         {
             return;
         }
         if (SocketConnectOrCloseResponse != null)
         {
             SocketConnectOrCloseResponse(this, new SocketConnectArgs(false, socket));
         }
         long       ip         = ControllerManager.GetLongIPFromSocket(socket);
         Controller controller = ControllerManager.Instance().Get(ip);
         if (controller != null)
         {
             controller.SocketToken = null;
         }
         lock (m_HashReceivedBuffer)
         {
             if (m_HashReceivedBuffer.ContainsKey(ip))
             {
                 m_HashReceivedBuffer.Remove(ip);
             }
         }
     }
 }
    public virtual void Init(bool isPlayerOne, GameObject otherFighter)
    {
        GameObject canvas = GameObject.FindGameObjectWithTag("Canvas");

        gameManager            = GameObject.FindGameObjectWithTag("Game Manager").GetComponent <GameManager>();
        rb                     = GetComponent <Rigidbody>();
        this.isPlayerOne       = isPlayerOne;
        this.otherFighter      = otherFighter;
        otherFighterController = otherFighter.GetComponent <FighterController>();
        fighterControllerState = FighterControllerState.DetermineFighterControllerState(this);

        if (isPlayerOne)
        {
            controllerInput = ControllerManager.GetControllerInput(1);
            fighterUI       = canvas.transform.GetChild(0).GetComponent <FighterUI>();
        }
        else
        {
            controllerInput = ControllerManager.GetControllerInput(2);
            fighterUI       = canvas.transform.GetChild(1).GetComponent <FighterUI>();
        }
        anim          = GetComponent <Animator>();
        attackManager = GetComponent <AttackManager>();
        attackManager.Init();
        fighterUI.Init();

        startingPosition.Set(transform.position.x, transform.position.y, transform.position.z);
        startingRotation.Set(transform.rotation.x, transform.rotation.y, transform.rotation.z, transform.rotation.w);
        startingScale.Set(transform.localScale.x, transform.localScale.y, transform.localScale.z);
    }
        public virtual ActionResult _Index(Func <IQueryable, IQueryable> filter)
        {
            var page     = int.Parse(RequestManager.QueryStringDictionary["Page"].ToString());
            var pageSize = int.Parse(RequestManager.QueryStringDictionary["PageSize"].ToString());
            var orderBy  = RequestManager.QueryStringDictionary["OrderBy"].ToString();

            var viewModel = new DynamicIndexViewModel(DynamicEntitySearcher.DynamicEntityMetadata, RequestManager.QueryStringDictionary);

            var entityType = DynamicEntitySearcher.DynamicEntityMetadata.EntityMetadata.EntityType;
            var filters    = viewModel.GetDynamicFilters().Select(x => (Func <IQueryable, IQueryable>)x.Filter).ToList();

            if (filter != null)
            {
                filters.Add(filter);
            }
            var models = DynamicRepository.GetItems(entityType, filters, page, pageSize, orderBy, DynamicEntitySearcher.DynamicEntityMetadata.GetListIncludes().ToArray());

            viewModel             = new DynamicIndexViewModel(DynamicEntitySearcher.DynamicEntityMetadata, RequestManager.QueryStringDictionary, models);
            viewModel.RecordCount = DynamicRepository.GetRecordCount(DynamicEntitySearcher.DynamicEntityMetadata.EntityMetadata.EntityType, filters);

            var routeValueDictionary = viewModel.RouteValueDictionary.Clone();

            routeValueDictionary.Remove("ReturnUrl");
            viewModel.RouteValueDictionary["ReturnUrl"] = ReturnUrlCalculator.GetReturnUrl("Index", viewModel.DynamicEntityMetadata.EntityMetadata.TypeName, routeValueDictionary);

            return(ControllerManager.PartialView("_DynamicIndex", viewModel));
        }
    void Start()
    {
        _controllerManager = GameManager.controllerManager;
        _blackScreen       = GameManager.blackScreen.GetComponent <Image>();

        _pauseButtons = _pausePanel.GetComponentsInChildren <Button>();
    }
Beispiel #25
0
    // Update is called once per frame
    void Update()
    {
        if (rectTran.position.y < endY && isPlaying)
        {
            rectTran.Translate(0, scrollSpeed * Time.deltaTime, 0);

//				position.Set(rectTran.position.x, rectTran.position.y+scrollSpeed * Time.deltaTime
//			                      , rectTran.position.z);
            //Debug.Log("Scrolling");
        }
        else
        {
            isPlaying = false;
        }

        if (ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 1, true) ||
            ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 2, true) ||
            ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 3, true) ||
            ControllerManager.GetButton(ControllerInputWrapper.Buttons.B, 4, true) ||
            Input.GetMouseButtonDown(0))
        {
            selectAS.Stop();
            selectAS.Play();
            isPlaying   = false;
            interrupted = true;
            creditsPanel.SetActive(false);
            rectTran.position = startPos;
        }
    }
Beispiel #26
0
        internal ServerBase(IServerConfig config, IDeviceContainer deviceContainer = null, ILogContainer logContainer = null)
        {
            if (config == null)
            {
                throw new ArgumentNullException("配制信息", "参数为空");
            }
            ServerConfig = config;

            _deviceContainer = deviceContainer;
            if (_deviceContainer != null)
            {
                _deviceContainer.MouseRightContextMenu += Device_MouseRightContextMenu;
            }

            if (logContainer == null)
            {
                logContainer = new ConsoleContainer();
            }

            Logger = (new LogFactory()).GetLog(ServerName, logContainer);

            _monitorException = new MonitorException();

            ServiceManager      = new ServiceManager(Logger);
            GraphicsShowManager = new GraphicsShowManager(Logger);
            DeviceManager       = new DeviceManager(Logger);
            ChannelManager      = new ChannelManager(Logger);
            ControllerManager   = new ControllerManager(Logger);

            IsDisposed = false;
        }
Beispiel #27
0
        List <Entity> itemAttached;//Item that attached to character

        public CharacterController(
            Camera cam,
            NavmeshQuery query,
            Scene physicsScene,
            string meshName,
            ModCharacterSkinDfnXML skin,
            bool isBot,
            Mogre.Vector3 initPosition)
        {
            camera            = cam;
            this.controlled   = !isBot;
            itemAttached      = new List <Entity>();
            this.sceneMgr     = cam.SceneManager;
            charaMeshName     = meshName;
            this.physicsScene = physicsScene;
            physics           = physicsScene.Physics;
            cotrollerManager  = physics.ControllerManager;
            this.query        = query;
            setupBody(initPosition);
            if (controlled)
            {
                setupCamera(cam);
            }

            this.skin = skin;

            setupAnimations();
            setupPhysics();
        }
Beispiel #28
0
        public GameMap(GameWorld world, IGameMapLoader loader)
        {
            scriptLoader            = new ScriptLoader();
            actorNodeList           = new List <ActorNode>();
            this.world              = world;
            this.loader             = loader;
            loader.LoadMapFinished += Loader_LoadMapFinished;

            sceneManager     = world.SceneManager;
            modData          = world.ModData;
            camera           = world.Camera;
            physicsScene     = world.PhysicsScene;
            physics          = world.PhysicsScene.Physics;
            controllerMgr    = physics.ControllerManager;
            aimeshIndexData  = new List <Mogre.Vector3>();
            aimeshVertexData = new List <Mogre.Vector3>();
            editor           = new GameMapEditor(this);
            cameraHanlder    = new CameraHandler(this);
            gameObjects      = new Dictionary <string, List <GameObject> >();
            combineKey       = false;

            GameManager.Instance.mouse.MouseMoved     += Mouse_MouseMoved;
            GameManager.Instance.mouse.MousePressed   += Mouse_MousePressed;
            GameManager.Instance.mouse.MouseReleased  += Mouse_MouseReleased;
            GameManager.Instance.keyboard.KeyPressed  += Keyboard_KeyPressed;
            GameManager.Instance.keyboard.KeyReleased += Keyboard_KeyReleased;
        }
Beispiel #29
0
 public Keyboard(ControllerManager callback) : base(callback)
 {
     SetMapping(Keys.Q, GameEvent.QUIT);
     SetMapping(Keys.W, GameEvent.JUMP);
     SetMapping(Keys.Up, GameEvent.JUMP);
     SetMapping(Keys.A, GameEvent.MOVE_LEFT, KeyEvent.KEY_HELD);
     SetMapping(Keys.Left, GameEvent.MOVE_LEFT, KeyEvent.KEY_HELD);
     SetMapping(Keys.S, GameEvent.CROUCH);
     SetMapping(Keys.Down, GameEvent.CROUCH);
     SetMapping(Keys.S, GameEvent.CROUCH_RELEASE, KeyEvent.KEY_UP);
     SetMapping(Keys.Down, GameEvent.CROUCH_RELEASE, KeyEvent.KEY_UP);
     SetMapping(Keys.D, GameEvent.MOVE_RIGHT, KeyEvent.KEY_HELD);
     SetMapping(Keys.Right, GameEvent.MOVE_RIGHT, KeyEvent.KEY_HELD);
     SetMapping(Keys.Y, GameEvent.STANDARD_MARIO);
     SetMapping(Keys.U, GameEvent.SUPER_MARIO);
     SetMapping(Keys.I, GameEvent.FIRE_MARIO);
     SetMapping(Keys.O, GameEvent.DAMAGE);
     SetMapping(Keys.OemQuestion, GameEvent.QUESTION_BLOCK_HIT);
     SetMapping(Keys.X, GameEvent.USED_BLOCK_HIT);
     SetMapping(Keys.B, GameEvent.BRICK_BLOCK_HIT);
     SetMapping(Keys.H, GameEvent.HIDDEN_BLOCK_HIT);
     SetMapping(Keys.C, GameEvent.BOUNDING);
     SetMapping(Keys.Z, GameEvent.FIREBALL);
     SetMapping(Keys.R, GameEvent.RESET);
     SetMapping(Keys.M, GameEvent.MUTE);
     SetMapping(Keys.Space, GameEvent.START);
     SetMapping(Keys.L, GameEvent.COINSCHEAT);
     SetMapping(Keys.P, GameEvent.PAUSE);
     SetMapping(Keys.N, GameEvent.CONTINUE);
     SetMapping(Keys.E, GameEvent.INTERACT);
     SetMapping(Keys.T, GameEvent.WARP);
     SetMapping(Keys.K, GameEvent.STAR);
 }
Beispiel #30
0
        private void CreateServer()
        {
            //This will start the server helper process
            ControllerManager.Tick();

            _netManager = new NetManager(Network.EventListener, ServerConfiguration.MaximumConnections);

            _netManager.UpdateTime = Mathf.RoundToInt((1 / ServerConfiguration.ServerSendRate) * 100);
            _netManager.UnconnectedMessagesEnabled = ServerConfiguration.UnconnectedMessagesEnabled;
            _netManager.NatPunchEnabled            = ServerConfiguration.NATPunchthrough;
            _netManager.PingInterval      = ServerConfiguration.PingInterval;
            _netManager.DisconnectTimeout = ServerConfiguration.TimeoutTime;


            _netManager.SimulateLatency      = true;
            _netManager.SimulationMaxLatency = 200;
            _netManager.SimulationMinLatency = 50;

            _netManager.SimulatePacketLoss         = true;
            _netManager.SimulationPacketLossChance = 30;

            _netManager.Start(ServerConfiguration.Port);

            Application.targetFrameRate = ServerConfiguration.ServerSendRate;

            SetupEvents();
            CreateModManifest();
            SetupServerInformation();
        }
 // Update is called once per frame
 void Update()
 {
     if (!isLive() && ControllerManager.respawn())
     {
         spawn();
     }
 }
Beispiel #32
0
    public void tick()
    {
        CameraManager.Update();

        currentTimeToController += Time.deltaTime;
        if (currentTimeToController > timeToController)
        {
            ControllerManager.tick();
            currentTimeToController -= timeToController;
        }
        while (events.Count > 0)
        {
            GameEvent ge = events.Dequeue();
            broadcastEvent(ge);
        }

        foreach (EventManager manager in eventManagers)
        {
            manager.Tick();
        }

        foreach (Map map in MapManager.getInstance().getMapList())
        {
            map.tick();
        }
    }
    private void Update()
    {
        //If the game is paused, don't do anything, just return.
        if (GameManager.IsPause())
        {
            return;
        }

        //If player pressed Z and the player isn't dead, then change flashlight facing direction.
        if (ControllerManager.GetFlashDown() && !GameManager.IsPlayerDied())
        {
            //PLay the "Player Flashlight" sound.
            AudioManager.PlaySound(5);

            if (index < 3)
            {
                ++index;
            }

            if (index == 3)
            {
                index = 0;
            }
        }
    }
Beispiel #34
0
	public ControllerManager()
	{
		setUpPlatform();
		playerControls = new Dictionary<PlayerID, ControllerInputWrapper>();
		if(instance != this) {
			instance = this;
		}
	}
 private DynamicControllerManager DynamicControllerManager()
 {
     if (_dynamicControllerManager == null)
     {
         var controllerManager = new ControllerManager(View, RedirectToAction, RedirectToAction, PartialView, () => ModelState, (dynamic) => TryUpdateModel(dynamic), (dynamic, prefix) => TryUpdateModel(dynamic, prefix), Redirect, Json);
         _dynamicControllerManager = new DynamicControllerManager(Request, controllerManager, DynamicRepository, Url);
     }
     return _dynamicControllerManager;
 }
Beispiel #36
0
    public GameManager( GameTime gameTime, ControllerManager controllerManager, Character player, List<Character> aiCharacterList, Master master )
    {
        this.gameTime = gameTime;
        this.controllerManager = controllerManager;
        this.player = player;
        this.aiCharacterList = aiCharacterList;
        this.master = master;

        remainAINumber = aiCharacterList.Count;
    }
 public DynamicControllerManager(HttpRequestBase request, ControllerManager controllerManager, IDynamicRepository dynamicRepository, UrlHelper urlHelper)
 {
     RequestManager = new RequestManager(request);
     DynamicEntitySearcher = new DynamicEntitySearcher(RequestManager);
     RequestManager.QueryStringDictionary = RequestManager.QueryStringDictionary.RouteValueDictionaryTypeCorrection(DynamicEntitySearcher.DynamicEntityMetadata);
     ControllerManager = controllerManager;
     DynamicRepository = dynamicRepository;
     UrlManager = new UrlManager(urlHelper);
     ReturnUrlCalculator = new ReturnUrlCalculator(UrlManager);
 }
	void Awake() 
	{
		if(controllermanager != null && controllermanager != this)
		{
			Destroy(gameObject);
		}

		controllermanager = this;

		DontDestroyOnLoad(gameObject);
	}
Beispiel #39
0
    void Awake()
    {
        if (instance == null)
        {
			DontDestroyOnLoad(this);
            instance = this;
            cm = new ControllerManager();
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
Beispiel #40
0
        void Awake()
        {
            if(instance == null)
            {
                DontDestroyOnLoad(gameObject);
                instance = this;
                UpdatePanels(SplashPanel);
				ControllerManager manager = new ControllerManager();
            }
            else if (instance != this)
            {
                Destroy(gameObject);
            }
        }
Beispiel #41
0
    // Create a game with the passed in resolution and the msPerFrame
    public AD2Game(int baseWidth, int baseHeight, int msPerFrame)
    {
        #if DEBUG
            Utils.SetAssetDirectory(@"..\..\..\assets\");
        #else
            Utils.SetAssetDirectory(@"assets\");
        #endif
        this.BaseWidth = baseWidth;
        this.BaseHeight = baseHeight;

        // Set the games graphics Manager.
        Renderer.GraphicsDeviceManager = new GraphicsDeviceManager(this);

        // Set up the fixed FPS here.
        IsFixedTimeStep = true;
        TargetElapsedTime = TimeSpan.FromMilliseconds(msPerFrame);

        ControllerManager = new ControllerManager();
    }
Beispiel #42
0
    //Need to initalize stuff specific to the game? Do it here!
    public GS()
    {
        Inputs = new Input[4];
        GState = State.Title;

        KeyboardInput k = new KeyboardInput();
        k.UpKey = Keys.Up;
        k.DownKey = Keys.Down;
        k.LeftKey = Keys.Left;
        k.RightKey = Keys.Right;
        k.InventoryLKey = Keys.Q;
        k.FireKey = Keys.K;

        Inputs[0] = k;
        KeyboardInput k2 = new KeyboardInput();

        Inputs[1] = k2;
        Inputs[2] = k2;
        Inputs[3] = k2;
        /**
        for (int i = 1; i != 4; i++)
        {
            inputs[i] = new PInput();
            inputs[i].useKeyboard = false;
            inputs[i].controllerNo = 0;
            inputs[i].cA = 1;
            inputs[i].cB = 2;
            inputs[i].cL = 9;
            inputs[i].cR = 10;
            inputs[i].cS = 0;
            inputs[i].cX = 0;
            inputs[i].cY = 0;
        }
        */

        ControllerManager = new ControllerManager();
        Title = new Title();
        Logo = Utils.TextureLoader(@"misc\logo.png");
    }
Beispiel #43
0
 void Awake()
 {
     master = GameObject.Find ("ControllerManager").GetComponent<ControllerManager> ();
     master.loadLevel (Application.loadedLevelName);
     int numPlayers = master.getNumPlayers ();
     remaningPlayers = numPlayers;
     for (int i = 0; i < players.Length; i++) {
         players[i].GetComponent<PlayerClass>().loadPlayer(i+1, 0, 50*numPlayers);
         if (i >= numPlayers) {
             players[i].SetActive(false);
         }
     }
 }
Beispiel #44
0
 protected virtual void onControllerSwitch(ControllerManager.Controller controller)
 {
 }
Beispiel #45
0
	// Use this for initialization
	void Start () 
	{
		ControllerManager test = new ControllerManager();
		DontDestroyOnLoad(this.gameObject);
	}
	public static ControllerManager getInstance() {
		if (mManager == null) {
			mManager = new ControllerManager();
		}
		return mManager;
	}
Beispiel #47
0
 // Use this for initialization
 void Start()
 {
     instance = this;    //declare singleton
 }
Beispiel #48
0
	// Use this for initialization
	void Start () {
		ControllerManager test = new ControllerManager();
	}
 //get reference to controllermanager
 void Start()
 {
     CMRef = ControllerManager.GetReference();
 }
 protected override void onControllerSwitch(ControllerManager.Controller controller)
 {
     base.onControllerSwitch(controller);
     if (controller == ControllerManager.Controller.Gamepad) enabled = true;
     else enabled = false;
 }
 void Awake()
 {
     _selfReference = this;
 }
    void Awake()
    {
        instance = this;

        CheckForNewControllers ();
    }
 protected override void onControllerSwitch(ControllerManager.Controller controller)
 {
     base.onControllerSwitch(controller);
     if (ControllerManager.instance.isKeyboardActive()) enabled = true;
     else enabled = false;
 }
 public void SetDrone(GameObject drone)
 {
     controllerManager = drone.GetComponent<ControllerManager> ();
     Initialize ();
 }
Beispiel #55
0
 void Awake()
 {
     if (_instance == null) _instance = this;
     else { DestroyImmediate(this); return; }
 }
Beispiel #56
0
 //setup gamemanager references
 void Init()
 {
     controllerManager = this.GetComponent<ControllerManager> ();
 }