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


C# GameState类代码示例

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


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

示例1: Start

	// Use this for initialization
	void Start() {    
		//Set high to be out of pickable range
		location = 0;
		//
		minZombies = 4;
		maxZombies = 5;
		zombieSpeed = 3;
		zombieSpawn = 5;
		timeToSpawn = 5;
		
		// Init Lists //
		zombies = new List<GameObject>();
		currentZombies = new List<GameObject>();
		zombieWave = new List<int>();

		//Add Zombies to List//
		zombies.Add(zombie1);
		zombies.Add(zombie2);
		zombies.Add(zombie3);
		zombies.Add(zombie4);
		//
		spawnLocations = new List<Vector3>();
		//Store locations in list
		for (int x = -150; x < 180; x += 30) {
			spawnLocations.Add(new Vector3(x, 0, 1500));
		}
		//LINK Scripts//
		bc = gameObject.GetComponent<BuildingControl>();
		gs = GameObject.Find ("GameController").GetComponent<GameState>();

	}
开发者ID:wangfeilong321,项目名称:Zombie-Sim-Project,代码行数:32,代码来源:SpawnZombie.cs

示例2: Draw

        protected override void Draw(GameTime gameTime)
        {
            if(_state == GameState.Menu)
            {
                if (GamePad.GetState(PlayerIndex.One).Buttons.Start == ButtonState.Pressed)
                    _state = GameState.Menu;

                GraphicsDevice.Clear(Color.CornflowerBlue);
                spriteBatch.Begin();
                play.Draw(spriteBatch);
                options.Draw(spriteBatch);
                exit.Draw(spriteBatch);
                spriteBatch.Draw(Textures.Bullet, new Vector2(Mouse.GetState().X, Mouse.GetState().Y), Color.Gray);
                spriteBatch.End();
            }
            if (_state == GameState.Game)
            {
                GraphicsDevice.Clear(Color.WhiteSmoke);
                spriteBatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend);
                handler.Draw(gameTime, spriteBatch);
                spriteBatch.End();
            }
            if (_state == GameState.Pause)
            {
                GraphicsDevice.Clear(Color.White);
                spriteBatch.Begin(SpriteSortMode.Deferred,BlendState.AlphaBlend);
                handler.Draw(gameTime, spriteBatch);
                spriteBatch.Draw(_pauseScreen, Vector2.Zero, Color.White);
                play.Draw(spriteBatch);
                exit.Draw(spriteBatch);
                spriteBatch.Draw(Textures.Bullet, new Vector2(Mouse.GetState().X, Mouse.GetState().Y), Color.Gray);
                spriteBatch.End();
            }
            base.Draw(gameTime);
        }
开发者ID:Andilutten,项目名称:CsharpShooter,代码行数:35,代码来源:Game1.cs

示例3: PauseGame

 public void PauseGame()
 {
     gameState = GameState.PAUSE;
     timer.StopTimer();
     fillterController.StopBlinking();
     fillterController.Change2Black();
 }
开发者ID:teamECS,项目名称:CapsuleAdventurer,代码行数:7,代码来源:GameController.cs

示例4: Move

        /// <summary>
        /// This will be run on each turns. It must return a direction fot the bot to follow
        /// </summary>
        /// <param name="state">The game state</param>
        /// <returns></returns>
        public string Move(GameState state)
        {
            myFinder = new Pathfinder(state);

            string direction;

            switch (random.Next(0, 5)) {
                case 0:
                    direction = Direction.East;
                    break;

                case 1:
                    direction = Direction.West;
                    break;

                case 2:
                    direction = Direction.North;
                    break;

                case 3:
                    direction = Direction.South;
                    break;

                default:
                    direction = Direction.Stay;
                    break;
            }

            direction = myFinder.GetNextMoveToGetToDestination(2, 2);

            Console.WriteLine("Completed turn {0}, going {1}", state.currentTurn, direction);
            Console.WriteLine(DateTime.Now - delta);
            return direction;
        }
开发者ID:malmuki,项目名称:Comeo,代码行数:39,代码来源:RandomBot.cs

示例5: Defeat

 public void Defeat()
 {
     defeatUI.SetActive(true);
     replayBtn.SetActive(true);
     catAnimator.runtimeAnimatorController = happyAnima;
     state = GameState.GAME_OVER;
 }
开发者ID:jiangsyk,项目名称:WZSJM,代码行数:7,代码来源:GameController.cs

示例6: Generate

		public void Generate(PlayerInfo owner, GameState state, ActionCandidates candidates)
		{
			if (!owner.IsBallOwner || owner.CanBeTackled.Any()) { return; }

			foreach (var direction in WalkingDirections)
			{
				var target = owner.Position + direction;

				// Don't try to leave the field.
				if(Game.Field.IsOnField(target))
				{
					var dribble = PlayerPath.Create(owner, target, MaximumDribbleLength, Distance.Tackle);
					var catchUp = dribble.GetCatchUps(state.Current.OtherPlayers).FirstOrDefault();

					// don't start (too) short walks.
					if(catchUp == null || catchUp.Turn >= MinimumDribbleLength)
					{
						if (catchUp != null) { target = dribble[catchUp.Turn - 2]; }

						var action = Actions.Move(owner, target);
						var length = catchUp == null ? dribble.Count : catchUp.Turn - 1;
						candidates.Add(Evaluator.GetPositionImprovement(owner, target, length), action);
					}
				}
			}
		}
开发者ID:Corniel,项目名称:CloudBall.LostKeysUnited,代码行数:26,代码来源:DribbleGenerator.cs

示例7: Start

    // Use this for initialization
    void Start()
    {
        gameState = GameState.InGame;
        //SAFE CODE : Check si il existe un autre gamemanager si c'est le cas, je m'autodetruit
        if (gameController != null && gameController != this)
        {
            Destroy(this.gameObject);
            return;
        }

        // pour qu'on puisse y accéder dans les methodes statiques
        gameController = this;

        // L'objet n'est pas détruit quand on change de scène
        //DontDestroyOnLoad(this.gameObject);
        SettingTarget();
        BrowseLists();
        //chargement de menu
        //Application.LoadLevel("Menu");
        //Application.LoadLevel("arena");
        foreach (GameObject go in Killers)
        {
            LoadObjectives(go);
        }
    }
开发者ID:MaximeRichard,项目名称:ModusOperanDie,代码行数:26,代码来源:GameController.cs

示例8: Start

	// Use this for initialization
	void Start () {
		
		GameState freedom = new GameState(){RoomPrompt=StringsStore.Freedom_Prompt};
		GameState lock_1 = new GameState(){RoomPrompt=StringsStore.Lock_1_Prompt};
		GameState cell_mirror = new GameState(){RoomPrompt=StringsStore.Cell_Mirror_Prompt};
		GameState sheets_1 = new GameState(){RoomPrompt=StringsStore.Sheets_1_Prompt};
		GameState mirror_0 = new GameState(){RoomPrompt=StringsStore.Mirror_0_Prompt};
		GameState lock_0 = new GameState(){RoomPrompt=StringsStore.Lock_0_Prompt};
		GameState sheets_0 = new GameState(){RoomPrompt=StringsStore.Sheets_0_Prompt};
		GameState cell_0 = new GameState(){RoomPrompt=StringsStore.PrisonCell_0_Prompt};
		
		cell_0.UserChoices.Add(new UserChoice (KeyCode.S, StringsStore.GoToSheets, sheets_0));
		cell_0.UserChoices.Add(new UserChoice (KeyCode.M, StringsStore.GoToMirror, mirror_0));
		cell_0.UserChoices.Add(new UserChoice (KeyCode.D, StringsStore.GoToDoor, lock_0));
		
		sheets_0.UserChoices.Add(new UserChoice (KeyCode.R, StringsStore.ReturnToCenterCell, cell_0));
		lock_0.UserChoices.Add(new UserChoice(KeyCode.R, StringsStore.ReturnToCenterCell, cell_0));
		mirror_0.UserChoices.Add(new UserChoice (KeyCode.T, StringsStore.SmashMirror, cell_mirror));
		mirror_0.UserChoices.Add(new UserChoice(KeyCode.R, StringsStore.ReturnToCenterCell, cell_0));
		sheets_1.UserChoices.Add(new UserChoice (KeyCode.R, StringsStore.ReturnToBrokenMirror, cell_mirror));
		cell_mirror.UserChoices.Add(new UserChoice (KeyCode.S, StringsStore.GoToSheets, sheets_1));
		cell_mirror.UserChoices.Add(new UserChoice(KeyCode.D, StringsStore.GoToDoor, lock_1));
		lock_1.UserChoices.Add(new UserChoice (KeyCode.O, StringsStore.OpenDoorWithShard, freedom));
		lock_1.UserChoices.Add(new UserChoice(KeyCode.R, StringsStore.ReturnToBrokenMirror, cell_mirror));
		freedom.UserChoices.Add(new UserChoice(KeyCode.P, StringsStore.PlayAgain, cell_0));
		
		MoveToState(cell_0);
	}
开发者ID:davidneumann,项目名称:UnityCourseText101,代码行数:29,代码来源:TextController.cs

示例9: Game

        public Game()
        {
            this.sideOnePoints = PointState.Love;
            this.sideTwoPoints = PointState.Love;

            this.state = GameState.PriorToDeuce;
        }
开发者ID:dtryon,项目名称:tennis,代码行数:7,代码来源:Game.cs

示例10: CaptureAll

 public bool CaptureAll(GameState state, Coords start, Coords end, Direction dir, out IEnumerable<Coords> capture)
 {
     if (pattern.Count() == 0)
     {
         capture = new List<Coords>();
         return true;
     }
     if (end != null && !OnSameLine(start, end))
     {
         capture = new List<Coords>();
         return false;
     }
     if (!pattern.ElementAt(0).IsTarget)
     {
         throw new NotImplementedException("Target other than the beginning is not supported yet.");
     }
     List<Coords> cAll = new List<Coords>();
     bool retVal = false;
     foreach (var incrementer in ToIncrementers(dir))
     {
         // Try every direction
         List<Coords> c = new List<Coords>();
         if (FindMatch(state, start, end, incrementer, pattern, out c))
         {
             cAll.AddRange(c);
             retVal = true;
         }
     }
     capture = cAll;
     return retVal;
 }
开发者ID:hgabor,项目名称:boardgame,代码行数:31,代码来源:Pattern.cs

示例11: Match

 public bool Match(GameState state, Coords start, Coords end, Direction dir)
 {
     if (pattern.Count() == 0)
     {
         return true;
     }
     if (end != null && !OnSameLine(start, end))
     {
         return false;
     }
     if (!pattern.ElementAt(0).IsTarget)
     {
         throw new NotImplementedException("Target other than the beginning is not supported yet.");
     }
     foreach (var incrementer in ToIncrementers(dir))
     {
         // Try every direction
         List<Coords> c;
         if (FindMatch(state, start, end, incrementer, pattern, out c))
         {
             return true;
         }
     }
     return false;
 }
开发者ID:hgabor,项目名称:boardgame,代码行数:25,代码来源:Pattern.cs

示例12: Proceed

        public override void Proceed(GameState caller)
        {
            //Clear the score stacks.
            Screen.Player.ScoreBar.ClearStacks();

            if (caller is AgroState)
            {
                //AgroState does all the logic work. No need to add much logic here.
                Spawner spawner = Spawner.GetInstance();

                if (spawner.FriendliesPerEnemies > 2)
                {
                    spawner.FriendliesPerEnemies -= 2;
                    spawner.MaximumAlive += 50;
                }
            }
            else if (caller is RegularState)
            {
                RegularState temp = (RegularState)caller;
                PushState(new AgroState(this, temp.AgroBorder));
            }

            //Call the base.
            base.Proceed(caller);
        }
开发者ID:Whojoo,项目名称:Bubble-popper,代码行数:25,代码来源:RegularStateMachine.cs

示例13: startGame

    public void startGame(Game game)
    {
        Game.current = game;
        State = GameState.Building;

        camera.maxPosition = new Vector3 ((Game.current.Chunk)*34f, 25f, 0f);
        camera.calculateBounds();

        world.clearChunks();
        for (int i=0; i<Game.current.Chunk; i++) {
            GameObject ch = world.generateChunk (i);
            if (Game.current.Team == 1) {
                ch.GetComponent<MeshRenderer>().materials = WhiteMaterial;
            } else {
                ch.GetComponent<MeshRenderer>().materials = BlackMaterial;
            }
        }

        currentBeam = (GameObject) Instantiate(beam);

        GameObject c = (GameObject) Instantiate(character);
        c.transform.position = new Vector3 (1f, 20f, 0f);

        Grunt ai = c.GetComponent<Grunt>();
            ai.isHero = true;
            ai.team = Game.current.Team;
        EnemyController cont = c.GetComponent<EnemyController>();
            cont.maxSpeed = 2.5f;

        camera.target = c.transform;
    }
开发者ID:MaxBorsch,项目名称:CubeConqueror,代码行数:31,代码来源:GameManager.cs

示例14: Button

 public Button(Texture2D img, Rectangle rect, GameState click)
 {
     image = img;
     boundingRect = rect;
     clickFunction = click;
     roomIndex = -1;
 }
开发者ID:jhedin,项目名称:Tilt,代码行数:7,代码来源:Button.cs

示例15: Parse

        public bool Parse(GameState game, GameState.Entity enchant)
        {
            this.card_id = enchant.CardId;
            this.creator_entity_id = enchant.GetTagOrDefault(GameTag.CREATOR, -1);

            return true;
        }
开发者ID:peter1591,项目名称:hearthstone-ai,代码行数:7,代码来源:Enchantment.cs


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