当前位置: 首页>>代码示例>>C#>>正文


C# StateManager类代码示例

本文整理汇总了C#中StateManager的典型用法代码示例。如果您正苦于以下问题:C# StateManager类的具体用法?C# StateManager怎么用?C# StateManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StateManager类属于命名空间,在下文中一共展示了StateManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ArenaState

 //stops us from sending multiple rpc calls to display the gui if it is already being displayed
 public ArenaState(StateManager manager)
 {
     this.manager = manager;
     manager.StartCoroutine ("BreakDelay");
     timeUntilNextWave = Time.time + timeBetweenWaves;
     waveNumber = 0;
 }
开发者ID:DanHarasymiw,项目名称:COSC4087-Gladiator-Scripts,代码行数:8,代码来源:ArenaState.cs

示例2: InitialzeStateManager

    private void InitialzeStateManager()
    {
        _stateManager = new StateManager(_muffinAnimator);

        IdleState 		idle = new IdleState(_stateManager, transform);
        MoveState 		move = new MoveState(_stateManager, transform);
        TrapState 		trap = new TrapState(_stateManager, transform);
        DieState 		die	= new DieState(_stateManager, transform);
        SpinState		spin = new SpinState(_stateManager, transform);
        BlastState		blast = new BlastState(_stateManager, transform);
        ChocoRushState	chocoRush = new ChocoRushState(_stateManager, transform);

        PauseState		pause = new PauseState(_stateManager, transform);

        _stateManager.AddCharacterState(idle);
        _stateManager.AddCharacterState(move);
        _stateManager.AddCharacterState(trap);
        _stateManager.AddCharacterState(die);
        _stateManager.AddCharacterState(spin);
        _stateManager.AddCharacterState(blast);
        _stateManager.AddCharacterState(chocoRush);

        _stateManager.AddCharacterState(pause);

        _stateManager.SetDefaultState("Pause");
    }
开发者ID:kishoreven1729,项目名称:MuffinV3,代码行数:26,代码来源:MuffinControl.cs

示例3: ExecuteContinousInvalidCommand

        public void ExecuteContinousInvalidCommand()
        {
            var stateManager = new StateManager();
            var game = new TestGameImplementation();
            game.Initialize<DefaultPlayer>(null);

            var commands = CommandFactory.GetCommands(new Assembly[] { Assembly.GetExecutingAssembly() });

            if (commands.Count() == 0)
            {
                Assert.Fail("No commands were fetched from the factory.");
            }

            stateManager.Initialize(game.Player, commands);

            stateManager.PerformCommand(new ReceivedInputMessage("CommandWithInput"));

            Assert.IsTrue(game.Messages.Count > 0);
            Assert.IsNotNull(game.Player.StateManager.CurrentState);
            Assert.IsTrue(game.Player.StateManager.CurrentState.GetType() == typeof(ReceivingInputState));

            stateManager.PerformCommand(new ReceivedInputMessage("someRandomStuff"));

            Assert.IsTrue(game.Messages.Count > 0);
            Assert.IsNotNull(game.Player.StateManager.CurrentState);
            Assert.IsTrue(game.Player.StateManager.CurrentState.GetType() == typeof(TestState));

            stateManager.PerformCommand(new ReceivedInputMessage("randomMessage"));

            Assert.IsTrue(game.Messages.Pop() == "Invalid command used!" + Environment.NewLine);
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:31,代码来源:StateManagerTests.cs

示例4: PlayState2

				//private PlayerScript controller;
		
				public PlayState2 (StateManager managerRef)
				{ //Constructor
						manager = managerRef;
						Debug.Log ("Constructing PlayState2");
						manager.darkState = false; 
			
						"Stage2".LoadScene ();
						//if (Application.loadedLevelName != "Stage2")
						//		Application.LoadLevel ("Stage2");
			
						StaticMethods.SetOneActive ("Following Camera", manager.gameDataRef.cameras); //Camera that follows the Player, setOneActive method

						player = GameObject.FindGameObjectWithTag ("Player"); //the Player GameObject is now active and can be found
						player.GetComponent<Rigidbody2D> ().isKinematic = false; //Player is now affected by physics
			
						player.transform.SetPositionXY (-6.0f, -0.4f); //set starting position for Player
						skin = Resources.Load ("GUISkin") as GUISkin;
				
						//darkness = GameObject.FindGameObjectWithTag ("Darkness");
						//dark.a += 0f;
						//darkness.GetComponent<Renderer>().material.color = dark; 
			
						//darkness.GetComponent<Renderer>().material.color.a;
						//Color dark = darkness.renderer.material.color;
						//dark.a -= 0;
						//darkness.renderer.material.color = color;
				}
开发者ID:katerinakat,项目名称:Platform_Game,代码行数:29,代码来源:PlayState2.cs

示例5: PlayStateScene2

        public PlayStateScene2(StateManager managerRef)
        {
            manager = managerRef;
            if(Application.loadedLevelName != "Scene2")
                Application.LoadLevel("Scene2");

            player = GameObject.Find("Player");
            controller = player.GetComponent < PlayerControl > ();

            player.rigidbody.isKinematic = false;

            foreach(var camera in manager.gameDataRef.cameras)
            {
                if(camera.name != "Following Camera")
                {
                    if (camera != null)
                        camera.SetActive(false);
                }
                else
                {
                    if (camera != null)
                        camera.SetActive(true);
                }
            }
        }
开发者ID:russboss,项目名称:VisTest2,代码行数:25,代码来源:PlayStateScene2.cs

示例6: BeginState

 //Constructor for BeginState
 public BeginState(StateManager managerRef)
 {
     manager = managerRef;
     if(Application.loadedLevelName != "Scene0Menu"){
         Application.LoadLevel("Scene0Menu");
     }
 }
开发者ID:CJPilcher,项目名称:IndividualGamSivDev,代码行数:8,代码来源:BeginState.cs

示例7: BeginState

 // Constructor
 public BeginState(StateManager manageRef)
 {
     manager = manageRef;
     futureTime = screenDuration + Time.realtimeSinceStartup;
     Debug.Log("Constructing BeginState");
     Time.timeScale = 1;
 }
开发者ID:ahansen9,项目名称:aHansenInteractiveScripting,代码行数:8,代码来源:BeginState.cs

示例8: ShouldStartAndStopListening

        public void ShouldStartAndStopListening()
        {
            var fixtureSnapshot = new Fixture { Id = "TestId", MatchStatus = "30", Sequence = 1 };
            var plugin = new Mock<IAdapterPlugin>();

            var resource = new Mock<IResourceFacade>();
            var connector = new Mock<IAdapterPlugin>();
            var eventState = new Mock<IEventState>();
            
            var marketFilterObjectStore = new StateManager(_settings.Object,plugin.Object);
            
            resource.Setup(r => r.Sport).Returns("Football");
            resource.Setup(r => r.Content).Returns(new Summary());
            resource.Setup(r => r.StartStreaming()).Raises(r => r.StreamConnected += null, EventArgs.Empty);
            resource.Setup(r => r.StopStreaming()).Raises(r => r.StreamDisconnected += null, EventArgs.Empty);
            resource.Setup(r => r.GetSnapshot()).Returns(FixtureJsonHelper.ToJson(fixtureSnapshot));
            resource.Setup(r => r.Id).Returns("TestId");
            eventState.Setup(e => e.GetCurrentSequence(It.IsAny<string>(), It.IsAny<string>())).Returns(-1);

            var listener = new StreamListener(resource.Object, connector.Object, eventState.Object, marketFilterObjectStore,_settings.Object);
            
            listener.MonitorEvents();
            
            listener.Start();

            listener.Stop();

            listener.ShouldRaise("OnConnected");
            listener.ShouldNotRaise("OnError");
            listener.ShouldRaise("OnStop");
            listener.ShouldNotRaise("OnDisconnected","The disconnection is triggered by the user");

            connector.Verify(c => c.ProcessSnapshot(It.IsAny<Fixture>(), false), Times.Once());
        }
开发者ID:luxbet,项目名称:SS.Integration.Adapter,代码行数:34,代码来源:StreamListenerTests.cs

示例9: resetReferencesForNewLevel

    public static void resetReferencesForNewLevel()
    {
        // Managers
        manager = GameObject.FindGameObjectWithTag("Manager");
        stateManager = manager.GetComponent<StateManager>();
        stateTiming = manager.GetComponent<StateTiming>();

        // Game stats and information
        gameStats = manager.GetComponent<GameStats>();
        itemDatabase = manager.GetComponent<Item_Database>();
        inventory = manager.GetComponent<Inventory>();
        market = manager.GetComponent<Market>();
        marketArrays = manager.GetComponent<MarketArrays>();
        soundEffects = GameObject.FindObjectOfType<SoundEffectsDatabase>().GetComponent<SoundEffectsDatabase>();

        // Cameras
        realtimeCamera = GameObject.FindGameObjectWithTag("Camera_Realtime").GetComponent<Camera>();
        strategicCamera = GameObject.FindGameObjectWithTag("Camera_Strategic").GetComponent<Camera>();

        // Game entities
        player = GameObject.FindGameObjectWithTag("Player");
        castle = GameObject.FindGameObjectWithTag("Castle");
        soundEffect = (GameObject)Resources.Load("OneTimeSoundEffect", typeof(GameObject));

        // Data
        lastLevelIndex = Application.loadedLevel;
        currentLevel = 1;
    }
开发者ID:B-LiTE,项目名称:MemeTeam,代码行数:28,代码来源:References.cs

示例10: SpaceDefenderPlayingState

        public SpaceDefenderPlayingState(StateManager gameStateManager)
        {
            _gameStateManager = gameStateManager;

            IDrawableGameComponent backdrop = new Backdrop(new Vector2(GameRoot.ScreenSize.X / 2.0f, GameRoot.ScreenSize.Y / 2.0f));
            _gameComponents.Add("backdrop", backdrop);

            var projectiles = new ProjectileList(Vector2.Zero);
            _gameComponents.Add("projectiles", projectiles);

            IDrawableGameComponent player = new Player(new Vector2(GameRoot.ScreenSize.X / 2.0f, GameRoot.ScreenSize.Y - 50.0f), projectiles);
            _gameComponents.Add("player", player);

            IDrawableGameComponent alien1 = new Alien(new Vector2(GameRoot.ScreenSize.X / 2.0f, GameRoot.ScreenSize.Y / 2.0f));
            _gameComponents.Add("alien1", alien1);

            IDrawableGameComponent alien2 = new Alien2(new Vector2(100.0f, 100.0f));
            _gameComponents.Add("alien2", alien2);

            //IDrawableGameComponent explosion = new AnimatedSprite("toets", Vector2.Zero, 1, 16, 1, 50);
            IDrawableGameComponent explosion = new Explosion(Vector2.Zero);
            explosion.IsAlive = false;
            _gameComponents.Add("explosion", explosion);

            IDrawableGameComponent hud = new Hud { Score = 0, Lives = 3 };
            _gameComponents.Add("hud", hud);

            _random = new Random();
        }
开发者ID:gmoller,项目名称:SpaceDefender,代码行数:29,代码来源:SpaceDefenderPlayingState.cs

示例11: SetUpMocks

        public static void SetUpMocks()
        {
            _settings = new Mock<ISettings>();
            _settings.Setup(x => x.MarketFiltersDirectory).Returns(".");
            _settings.Setup(x => x.EventStateFilePath).Returns(".");
            _settings.Setup(x => x.ProcessingLockTimeOutInSecs).Returns(10);
            
            _plugin = new Mock<IAdapterPlugin>();

            _resource = new Mock<IResourceFacade>();
            _resource.Setup(r => r.Sport).Returns("FantasyFootball");
            _resource.Setup(r => r.StartStreaming()).Raises(r => r.StreamConnected += null, new EventArgs());
            _objectProvider = new Mock <IObjectProvider<Dictionary<string, FixtureOverview>>>();
            
            var stateManager = new StateManager(new Mock<ISettings>().Object,_plugin.Object);

            _supervisor = new Supervisor(_settings.Object,_objectProvider.Object);
            _supervisor.StateManager = stateManager;

            var supervisorService = new Mock<ISupervisorService>();
            supervisorService.Setup(x => x.StreamingService).Returns(new Mock<ISupervisorStreamingService>().Object);


            _supervisor.Service = supervisorService.Object;
            _supervisor.Proxy = new Mock<ISupervisorProxy>().Object;
            
            new SuspensionManager(stateManager, _plugin.Object);

        }
开发者ID:luxbet,项目名称:SS.Integration.Adapter,代码行数:29,代码来源:SupervisorTest.cs

示例12: ShouldBeCreatedWithNoStates

        public void ShouldBeCreatedWithNoStates()
        {
            var manager = new StateManager<IGameLogicState>(null);

            Assert.AreEqual(0, manager.StateCount);
            Assert.IsNull(manager.Current);
        }
开发者ID:gbenatti,项目名称:TDWorld,代码行数:7,代码来源:StateManagerFixture.cs

示例13: Adapter

        public Adapter(ISettings settings, IServiceFacade udapiServiceFacade, IAdapterPlugin platformConnector, IStreamListenerManager listenersManager)
        {
            _listenersManager = listenersManager;
            
            Settings = settings;
            UDAPIService = udapiServiceFacade;
            PlatformConnector = platformConnector;

            var statemanager = new StateManager(settings,platformConnector);
            StateManager = statemanager;
            StateProviderProxy.Init(statemanager);

            listenersManager.StateManager = statemanager;

            if (settings.StatsEnabled)
                StatsManager.Configure();

            // we just need the initialisation
            new SuspensionManager(statemanager, PlatformConnector);

            platformConnector.Initialise();
            statemanager.AddRules(platformConnector.MarketRules);


            ThreadPool.SetMinThreads(500, 500);
            
            _sports = new List<string>();
            
            _stats = StatsManager.Instance["adapter.core"].GetHandle();

            PopuplateAdapterVersionInfo();
        }
开发者ID:luxbet,项目名称:SS.Integration.Adapter,代码行数:32,代码来源:Adapter.cs

示例14: KinectHelpState

        public KinectHelpState(string name, StateManager manager, string mainWindow, string whereWindow, bool avatar)
            : base(name, manager)
        {
            mInput = manager.Coordinator.GetPlugin<KinectMovementPlugin>();

            mMainWindow = manager.Coordinator[mainWindow];

            mWhereWindow = whereWindow;
            mWhereButton = new ImageHoverTrigger(mMainWindow.OverlayManager, new DialCursorRenderer(), new OverlayImage(new Bitmap(mWhereAmIImage), .65f, .25f, mainWindow));
            mWhereButton.Triggered += new Action(mWhereButton_Triggered);

            mCloseWhereButton = new ImageHoverTrigger(Manager.Coordinator[whereWindow].OverlayManager, new DialCursorRenderer(), mWhereButton.Image);
            mCloseWhereButton.Triggered += new Action(mCloseWhereButton_Triggered);

            mClickTrigger = new CursorTrigger(new CircleRenderer(100), mMainWindow);

            SkeletonFeature helpSkeleton = new SkeletonFeature(.065f, 0f, avatar ? .23f : .13f, 125f, mainWindow);
            AddFeature(helpSkeleton);
            AddFeature(new OverlayImage(new Bitmap(avatar ? mHelpAvatarImages : mHelpFlycamImages), .05f, avatar ? .2f : .1f, mainWindow));
            AddFeature(mClickTrigger);
            //AddFeature(mWhereButton);

            mWhereButton.Active = false;
            mCloseWhereButton.Active = false;
        }
开发者ID:JohnMcCaffery,项目名称:ChimeraClean,代码行数:25,代码来源:KinectHelpState.cs

示例15: SetupState

        public SetupState(StateManager managerRef)
        {
            manager = managerRef;
            if(Application.loadedLevelName != "Scene0")
                Application.LoadLevel("Scene0");
            //player = GameObject.Find("Player");
            //controller = player.GetComponent <PlayerControl>();
            mainCamera = GameObject.Find("Main Camera");
            //mainCamera = GameObject.Find("OVRPlayerController");
            // Import data
            newCube = GameObject.Find("Cube");

            // Grab a camera

            foreach(GameObject camera in manager.gameDataRef.cameras)
            {
                //if(camera.name != "OVRPlayerController")
                if(camera.name != "Main Camera")
                {
                    if (camera != null)
                        camera.SetActive(false);
                }
                else
                {
                    if (camera != null)
                        camera.SetActive(true);
                }
            }
            import(fileDirectory);
        }
开发者ID:russboss,项目名称:VisTest2,代码行数:30,代码来源:SetupState.cs


注:本文中的StateManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。