Inheritance: MonoBehaviour
コード例 #1
0
 /// <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;
         }
     }
 }
コード例 #2
0
ファイル: GameManager.cs プロジェクト: ghbryan/MoonBounce
    // 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;
        }
    }
コード例 #3
0
        /// <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);
                }
            }
        }
コード例 #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, "已经停止");
            }
        }
コード例 #5
0
        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;
        }
コード例 #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();
        }
コード例 #7
0
        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);
        }
コード例 #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);
         *
         * }*/
    }
コード例 #9
0
    // Use this for initialization
    void Start()
    {
        var controllerManager = ControllerManager.getInstance();
        var obj = controllerManager.gameObject;

        obj.transform.parent = transform;
    }
コード例 #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);
        }
コード例 #11
0
	private void Start()
	{
        if (instance == null)
        {
            instance = this;
        }
	}
コード例 #12
0
ファイル: ResultsManager.cs プロジェクト: CatsFromMars/Jam
    // 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;
    }
コード例 #13
0
ファイル: DockWindow.xaml.cs プロジェクト: minilxm/ADAS
 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()->传入的参数为空");
     }
 }
コード例 #14
0
ファイル: SectorData.cs プロジェクト: gormed/darwin
    public SectorData(int modulesPerSectorCount)
    {
        this.modulesPerSectorCount = modulesPerSectorCount;

        spawnsUnused    = new List <int>(new int[] { 0, 1, 2 });
        reachedFighting = new bool[ControllerManager.Get().MaximumUsable];
    }
コード例 #15
0
 private App()
 {
     _controllerManager = new ControllerManager(this);
     _viewManager       = new ViewManager();
     this._services     = new Dictionary <string, IModuleService>();
     this.LoadServices();
 }
コード例 #16
0
    // 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]);
             * }*/
        }
    }
コード例 #17
0
    //初始化
    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();
    }
コード例 #18
0
    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 );
    }
コード例 #19
0
 public override void OnSelect()
 {
     if (ControllerManager.Get().AvailabeJoystickCount >= 1)
     {
         GamestateManager.Get().ChangeState(GamestateType.TrainingSettings);
     }
 }
コード例 #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();
                }
            });
        }
コード例 #21
0
 /// <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);
             }
         }
     }
 }
コード例 #22
0
    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));
        }
コード例 #24
0
    void Start()
    {
        _controllerManager = GameManager.controllerManager;
        _blackScreen       = GameManager.blackScreen.GetComponent <Image>();

        _pauseButtons = _pausePanel.GetComponentsInChildren <Button>();
    }
コード例 #25
0
ファイル: ScrollPanel.cs プロジェクト: kkiniaes/Fire-On-Ice
    // 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;
        }
    }
コード例 #26
0
ファイル: ServerBase.cs プロジェクト: zmk523/ServerSuperIO
        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;
        }
コード例 #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();
        }
コード例 #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;
        }
コード例 #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);
 }
コード例 #30
0
ファイル: Server.cs プロジェクト: DanielEverland/Dead-Air
        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();
        }
コード例 #31
0
 // Update is called once per frame
 void Update()
 {
     if (!isLive() && ControllerManager.respawn())
     {
         spawn();
     }
 }
コード例 #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();
        }
    }
コード例 #33
0
    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;
            }
        }
    }
コード例 #34
0
ファイル: ControllerManager.cs プロジェクト: imtn/Rangers
	public ControllerManager()
	{
		setUpPlatform();
		playerControls = new Dictionary<PlayerID, ControllerInputWrapper>();
		if(instance != this) {
			instance = this;
		}
	}
コード例 #35
0
 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;
 }
コード例 #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;
    }
コード例 #37
0
 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);
 }
コード例 #38
0
	void Awake() 
	{
		if(controllermanager != null && controllermanager != this)
		{
			Destroy(gameObject);
		}

		controllermanager = this;

		DontDestroyOnLoad(gameObject);
	}
コード例 #39
0
ファイル: InputTester.cs プロジェクト: imtn/Rangers
    void Awake()
    {
        if (instance == null)
        {
			DontDestroyOnLoad(this);
            instance = this;
            cm = new ControllerManager();
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
コード例 #40
0
ファイル: MenuManager.cs プロジェクト: dvalles/Rangers
        void Awake()
        {
            if(instance == null)
            {
                DontDestroyOnLoad(gameObject);
                instance = this;
                UpdatePanels(SplashPanel);
				ControllerManager manager = new ControllerManager();
            }
            else if (instance != this)
            {
                Destroy(gameObject);
            }
        }
コード例 #41
0
ファイル: AD2Game.cs プロジェクト: WJLiddy/AD2-Engine
    // 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();
    }
コード例 #42
0
ファイル: GS.cs プロジェクト: WJLiddy/CastleSpire
    //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");
    }
コード例 #43
0
ファイル: GameController.cs プロジェクト: CatsFromMars/Jam
 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);
         }
     }
 }
コード例 #44
0
ファイル: PlayerInputs.cs プロジェクト: Rirols/HitsPlayJam
 protected virtual void onControllerSwitch(ControllerManager.Controller controller)
 {
 }
コード例 #45
0
ファイル: InputTester.cs プロジェクト: dvalles/Rangers
	// Use this for initialization
	void Start () 
	{
		ControllerManager test = new ControllerManager();
		DontDestroyOnLoad(this.gameObject);
	}
コード例 #46
0
	public static ControllerManager getInstance() {
		if (mManager == null) {
			mManager = new ControllerManager();
		}
		return mManager;
	}
コード例 #47
0
 // Use this for initialization
 void Start()
 {
     instance = this;    //declare singleton
 }
コード例 #48
0
ファイル: InputTester.cs プロジェクト: AmbroseC/Rangers
	// Use this for initialization
	void Start () {
		ControllerManager test = new ControllerManager();
	}
コード例 #49
0
 //get reference to controllermanager
 void Start()
 {
     CMRef = ControllerManager.GetReference();
 }
コード例 #50
0
 protected override void onControllerSwitch(ControllerManager.Controller controller)
 {
     base.onControllerSwitch(controller);
     if (controller == ControllerManager.Controller.Gamepad) enabled = true;
     else enabled = false;
 }
コード例 #51
0
 void Awake()
 {
     _selfReference = this;
 }
コード例 #52
0
    void Awake()
    {
        instance = this;

        CheckForNewControllers ();
    }
コード例 #53
0
 protected override void onControllerSwitch(ControllerManager.Controller controller)
 {
     base.onControllerSwitch(controller);
     if (ControllerManager.instance.isKeyboardActive()) enabled = true;
     else enabled = false;
 }
コード例 #54
0
 public void SetDrone(GameObject drone)
 {
     controllerManager = drone.GetComponent<ControllerManager> ();
     Initialize ();
 }
コード例 #55
0
 void Awake()
 {
     if (_instance == null) _instance = this;
     else { DestroyImmediate(this); return; }
 }
コード例 #56
0
ファイル: GameManager.cs プロジェクト: rmontes1/Momentum
 //setup gamemanager references
 void Init()
 {
     controllerManager = this.GetComponent<ControllerManager> ();
 }