///// <summary> ///// 获取路径最近的怪物 没有阵营区分 ///// </summary> ///// <param name="_gameStage"></param> ///// <param name="_player"></param> ///// <param name="_needAlive"></param> ///// <returns></returns> //public static SmartActor GetClosestSmartActor(PlayerBase _player,bool _needAlive,List<SmartActor> smartActors) //{ // List<SmartActor> mobs = smartActors; // Dictionary<int, float> distanceDic = new Dictionary<int, float>(); // Dictionary<int, SmartActor> mobDic = new Dictionary<int, SmartActor>(); // if (_needAlive) // { // foreach (SmartActor mob in mobs) // { // if (mob.gameObject != null && !mob.isDead && !mob.IsActor // ) // { // MOVEDES move = map.Find_Path(GameCenter.curGameStage.mapConfig, MYPOint.local2worldV3(_player.transform.localPosition), // MYPOint.local2worldV3(mob.gameObject.transform.position)); // if(move != null) // { // if(move.way.Count != 1) // distanceDic.Add(mob.id, move.CountDistance);//距离计算方法改变 by // else // distanceDic.Add(mob.id, Mathf.Sqrt((_player.transform.localPosition-mob.gameObject.transform.position).sqrMagnitude)); // mobDic.Add(mob.id, mob); // } // } // } // } // else // { // foreach (SmartActor mob in mobs) // { // if (mob.gameObject != null && !mob.IsActor // && ConfigMng.Instance.GetRelationType(GameCenter.curMainPlayer.Camp,mob.Camp) == RelationType.AUTOMATEDATTACKS) // { // Vector3 vec = _player.transform.position - mob.gameObject.transform.position; // distanceDic.Add(mob.id, vec.sqrMagnitude); // mobDic.Add(mob.id, mob); // } // } // } // int closestOne = -1; // float distance = -1; // foreach (var id in distanceDic.Keys) // { // if (distance <0 || distance >= distanceDic[id]) // { // closestOne = id; // distance = distanceDic[id]; // } // } // return mobDic.ContainsKey(closestOne) ? mobDic[closestOne] : null; //} /// <summary> /// 获得距离指定玩家最近的指定类型的NPC by吴江 /// </summary> /// <param name="_gameStage"></param> /// <param name="_player">指定的玩家</param> /// <param name="_type">指定的NPC类型</param> /// <returns></returns> public static NPC GetClosestTypeNPC(this GameStage _gameStage, PlayerBase _player, NPCType _type) { List <NPC> npcs = _gameStage.GetNPCs(); Dictionary <int, float> distanceDic = new Dictionary <int, float>(); Dictionary <int, NPC> npcDic = new Dictionary <int, NPC>(); for (int i = 0; i < npcs.Count; i++) { NPC npc = npcs[i]; if (npc.gameObject != null && npc.npcType == _type) { Vector3 vec = _player.transform.position - npc.gameObject.transform.position; if (vec.sqrMagnitude <= npc.cullDistance * npc.cullDistance) { distanceDic.Add(npc.id, vec.sqrMagnitude); npcDic.Add(npc.id, npc); } } } int closestOne = -1; float distance = -1; foreach (var id in distanceDic.Keys) { if (distance < 0 || distance >= distanceDic[id]) { closestOne = id; distance = distanceDic[id]; } } return(npcDic.ContainsKey(closestOne) ? npcDic[closestOne] : null); }
protected override int EvaluateRookRank(int pl, int rookSqInd, GameStage gameStage) { int score = base.EvaluateRookRank(pl, rookSqInd, gameStage); stats.RookRankScore[pl] += ApplySign(pl, score); return(score); }
/// <summary> /// Called when a stage is finished /// </summary> /// <param name="stage"></param> public void OnGameStageComplate(GameStage stage) { if (stage == GameStage.Preparation) { //start champion combat for (int x = 0; x < Map.hexMapSizeX; x++) { for (int z = 0; z < Map.hexMapSizeZ / 2; z++) { //there is a champion if (gridChampionsArray[x, z] != null) { //get character ChampionController championController = gridChampionsArray[x, z].GetComponent <ChampionController>(); //start combat championController.OnCombatStart(); } } } } if (stage == GameStage.Combat) { //totall damage player takes int damage = 0; //iterate champions //start champion combat for (int x = 0; x < Map.hexMapSizeX; x++) { for (int z = 0; z < Map.hexMapSizeZ / 2; z++) { //there is a champion if (gridChampionsArray[x, z] != null) { //get character ChampionController championController = gridChampionsArray[x, z].GetComponent <ChampionController>(); //calculate player damage for every champion if (championController.currentHealth > 0) { damage += championDamage; } } } } //player takes damage gamePlayController.TakeDamage(damage); ResetChampions(); AddRandomChampion(); // AddRandomChampion(); } }
protected void Sleep() { if (gameStage != null) { gameStage.RemoveObject(this); gameStage = null; } }
public AbandonedShip(GameStage stage, int crewCost, int dayCost, int reward) : base(stage) { RequiresOrder = true; LastResolved = 0; CrewCost = crewCost; DayCost = dayCost; Reward = reward; }
static void TitleScreen() { CurrentState = GameStage.TITLE; InitScreen(); DrawTitleScreen(); Console.ReadLine(); StartMainGame(); }
public void endGame() { stage = GameStage.GAME_END; if (GameListener != null) { GameListener.OnGameEnd(); } }
// Use this for initialization void Start() { sunAmount = GameObject.FindGameObjectWithTag("SunAmount").GetComponent <tk2dTextMesh>(); sunAmount.text = sun.ToString(); sunAmount.Commit(); currentGameStage = GameStage.NotStarted; MainLoop(); }
public void StopGame() { Debug.Log("RPC Stop Game Called"); gameStage = GameStage.ending; enteredTime = Time.time; counterText.enabled = true; GetComponent <TankWeapon>().UploadGameStat(); }
public void ArrivedAtPostman() { EnterRangeOfNPC(); PlayerInput input = player.GetComponent <PlayerInput>(); input.enabled = false; curGameStage = GameStage.Tutorial; }
public GameState(GameStage stage, int width, int height) { CurrentStage = stage; DisplayWidth = width; DisplayHeight = height; Score = 0; ShootCount = 0; }
public ScheduledEventSaveData(ScheduledEvent se, GameStage gameStage, EventSpecificSaveData specificData) { this.gameStage = gameStage; eventType = se.mEvent.GetType(); quarter = se.mQuarter; minDelay = se.mMinDelay; this.specificData = specificData; }
private void FireGameOverIfNeeded() { if (NumberOfSticks == 0) { gameStage = GameStage.GameOver; EndOfGame.Invoke(WhoseTurn); } }
public AbandonedStation(GameStage stage, int minimumCrew, int dayCost, IEnumerable <Ware> wares) : base(stage) { RequiresOrder = true; LastResolved = 0; MinimumCrew = minimumCrew; DayCost = dayCost; Wares = wares; }
private void moveEnemies() { stage = GameStage.unitsMoving; for (int i = 0; i < movers.Count; i++) { movers[i].Move(); } }
public void EndGame() { foreach (var item in HUDItems) { item.Reset(); } this.CurrentStage = GameStage.GameOver; }
// shows the new session ui public void NewSession() { currentStage = GameStage.SessionSetup; LevelSetupUI.SetActive(true); HUD.SetActive(false); LevelEndUI.SetActive(false); GameEndUI.SetActive(false); }
public IEnumerator RunStageClicked(string eventId, GameStage stage) { EventMonitor.StartEvent(eventId); OnHideStages.Invoke(stage.Level, stage.Stage); yield return(new WaitForSeconds(1f)); EventMonitor.EndEvent(eventId); yield return(null); }
private void OnStagePrepareEnter(string gameEvent, GameStage stage) { if (isChanging) { isChanging = false; } isAllDead = false; }
protected void OnDestroy() { if (!isCache_ && gameStage != null) { gameStage.RemoveObject(this); gameStage = null; } Destroy(gameObject); }
/// <summary> /// 加载 /// </summary> public override void init() { gameStage = game.ctrl.gameStage; /* 随机一个形状 */ string[] strArr = new string[] { S_BOX, Z_BOX, L_BOX, J_BOX, I_BOX, O_BOX, T_BOX }; Random rd = new Random(); DropNewBox(strArr[rd.Next(strArr.Length)]); }
/******************************** *ステージにゴールしたよと送る ********************************/ public void SendGameStageGOAL() { gamestage = transform.GetComponentInParent <GameStage>(); if (gamestage.GetGameStageSta == 0) { //print("ゴールベルsend"); gamestage.SendStageMGGOAL(); } }
public void GenerateMissions(GamePlayer p, GameStage stage) { var missions = MissionGenerator.GetInstance().GenerateMissions(p, stage, 4); SetCurrentMissions(missions); ProgressPanel.MissionView.ClearMissions(); ProgressPanel.MissionView.GenerateMissionsButtons(p, missions); ProgressPanel.MissionView.ToggleMissions(); }
public static bool ParticipatedOnTheStage(this Player player, GameStage stage) { if (player.Actions.Any(x => x.GameStage == stage)) { return(true); } return(!player.Folded()); }
public void FinishPostmanConversation() { ExitRangeOfNPC(); PlayerInput input = player.GetComponent <PlayerInput>(); input.enabled = true; player.AddXP(110); curGameStage = GameStage.MainGame; }
// 1000,1000 public void StateChanged(GameStage state, Int32 inSpeed, Int32 outSpeed, Color color) { FadeBegin = true; NextState = state; FadeInSpeed = inSpeed; FadeOutSpeed = outSpeed; if (color == Color.White) FadeTexture = SoildWhite; if (color == Color.Black) FadeTexture = SoildBlack; }
public Encounter(GameStage stage, int firepower, int dayCost, PenaltyT penalty, RewardT reward) : base(stage) { RequiresOrder = true; LastResolved = 0; Firepower = firepower; DayCost = dayCost; Penalty = penalty; Reward = reward; }
/** * Updates game window to display trade offer confirmed by the currentPlayer. */ public void SendTradeOffer(Card card, float money) { selectedItem = card; float offeredMoney = window.GetOfferedMoney(); window.ShowTradeOffer((selectedItem).Name, offeredMoney, propertyManager.WhoOwns(selectedItem)); GameState = GameStage.TRADE_CONFIRM; }
public void SetGameStage(GameStage newGameStage) { if (newGameStage != _gameStage) { OnExitStage(_gameStage); OnEnterStage(newGameStage); _gameStage = newGameStage; } }
/** * Called when gameButton2 was clicked, it analyses the game situation (using GameState attribute) * and then handles the click button accordingly. */ private void Button2_action() { if (GameState == GameStage.NO_ACTION) { return; } Card card = propertyManager .CardAt(gameplan.PlayerPosition(currentPlayer)); GameStage state = GameState; GameState = GameStage.NO_ACTION; switch (state) { case GameStage.DICE: SaveButton_action(); GameState = GameStage.DICE; break; case GameStage.NO_FUNDS_PAY: window.ShowMortgagedProperties(propertyManager.GetMortgagedProperties(currentPlayer, false), true); GameState = GameStage.MORTGAGE_TAKE; break; case GameStage.WHAT_NEXT: window.ShowMortgageMenu(); GameState = GameStage.MORTGAGE_MENU; break; case GameStage.TRADE_CONFIRM: window.ShowPlayerInfo(currentPlayer); window.ShowMessage("Your offer was declined!"); Thread.Sleep(2000); break; case GameStage.MORTGAGE_MENU: window.ShowMortgagedProperties(propertyManager.GetMortgagedProperties(currentPlayer, true), false); GameState = GameStage.MORTGAGE_PAY; break; default: break; } if (GameState == GameStage.NO_ACTION) { ShowWhatNext(currentPlayer); } if (currentPlayer is AIPlayer) { AIDecider.PlayTurn((AIPlayer)currentPlayer, window, this, propertyManager .CardAt(gameplan.PlayerPosition(currentPlayer))); } }
public virtual void ChangeStage(GameStage type) { if (currentStage != null) { currentStage.End(); } currentStage = GetStage(type); currentStage.Begin(); }
public GameState() { channel = null; sd = null; sid = 0; players = new Dictionary<string, bool>(); stage = GameStage.Stopped; deck = new CardDeck(); deck.Shuffle(); //Just in case dealerCards = new Hand(); }
public IEnumerator LaunchGameStage(GameStage gst) { yield return new WaitForSeconds (0.5f); switch (gst) { case GameStage.StartScreen: StartCoroutine(PrepareStartScreenScene()); break; case GameStage.Level: StartCoroutine(PrepareLevelScene()); break; default: break; } }
public void Disconnect() { if (!Connected) return; Connected = false; Stage = GameStage.Disconnected; TimeDisconnected = SMain.Envir.Time; lock (SMain.Envir.StatusConnections) SMain.Envir.StatusConnections.Remove(this); /* _sendList = null; _receiveList = null; _retryList = null; */ _rawData = null; if (_client != null) _client.Client.Dispose(); _client = null; }
public void DrawFade(GameTime time) { if (FadeBegin) { if (FadeAlpha <= 0) FadeScreen = Fade.FadeIn; if (FadeAlpha >= 255) { FadeScreen = Fade.FadeOut; CurrentStage = NextState; } if (FadeInSpeed < time.ElapsedGameTime.Milliseconds && FadeOutSpeed < time.ElapsedGameTime.Milliseconds) { FadeAlpha = -1; CurrentStage = NextState; } else { if (FadeScreen == Fade.FadeIn) { if (FadeInSpeed < time.ElapsedGameTime.Milliseconds) FadeAlpha = 256; else FadeAlpha += (255 / (FadeInSpeed / (float)time.ElapsedGameTime.Milliseconds)); } if (FadeScreen == Fade.FadeOut) { if (FadeOutSpeed < time.ElapsedGameTime.Milliseconds) FadeAlpha = -1; else FadeAlpha -= (255 / (FadeOutSpeed / (float)time.ElapsedGameTime.Milliseconds)); } } DrawFadeState.Begin(); DrawFadeState.Draw(FadeTexture, new Rectangle(0, 0, 1280, 720), Color.FromNonPremultiplied(255, 255, 255, (Byte)MathHelper.Clamp(FadeAlpha, 0, 255))); DrawFadeState.End(); if (FadeAlpha < 0) { FadeBegin = false; FadeAlpha = 0; } } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (gameStage == GameStage.SplashScreen) { if (gameTime.TotalGameTime.CompareTo(lastTime) >= 0) { BackgroundMusic(meniuMusic); timeClick = gameTime.TotalGameTime.Subtract(new TimeSpan(0, 0, 1)); setupMenu(); gameStage = GameStage.Meniu; } } else if (gameStage == GameStage.Meniu) { if (Mouse.GetState().LeftButton == ButtonState.Pressed && (timeClick.Add(new TimeSpan(0, 0, 0, 0, 250)).CompareTo(gameTime.TotalGameTime) <= 0)) { timeClick = gameTime.TotalGameTime; MeniuClick(mainMenu); } MeniuUpdate(mainMenu); } else if (gameStage == GameStage.Options) { if (Mouse.GetState().LeftButton == ButtonState.Pressed && (timeClick.Add(new TimeSpan(0, 0, 0, 0, 250)).CompareTo(gameTime.TotalGameTime) <= 0)) { timeClick = gameTime.TotalGameTime; MeniuClick(optionsMenu); } MeniuUpdate(optionsMenu); } else if (gameStage == GameStage.Credits) { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) gameStage = GameStage.Meniu; } else if (gameStage == GameStage.Paused) { if (Keyboard.GetState().IsKeyDown(Keys.P) && pauseTime.Add(new TimeSpan(0, 0, 0, 0, 200)).CompareTo(gameTime.TotalGameTime) <= 0) { gameStage = gameType; pauseTime = gameTime.TotalGameTime; } } //only if we play single player else if (gameStage == GameStage.SinglePlayerWBorders || gameStage == GameStage.SinglePlayerBorderless) { SinglePlayerUpdate(gameTime); if (Keyboard.GetState().IsKeyDown(Keys.P) && pauseTime.Add(new TimeSpan(0, 0, 0, 0, 200)).CompareTo(gameTime.TotalGameTime) <= 0) { gameStage = GameStage.Paused; pauseTime = gameTime.TotalGameTime; } } else if (gameStage == GameStage.Highscores) { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { gameStage = GameStage.Meniu; highScore = null; } } base.Update(gameTime); }
IEnumerator GameProgression() { stage = GameStage.TUTORIAL; // uiLowerText.text = "\\\\ PRESS TRIGGER TO CONTINUE //"; lowerTextRoutine = SetTextRoutine( uiLowerText, "PRESS TRIGGER TO CONTINUE", true, .03f ); StartCoroutine( lowerTextRoutine ); // Basic tutorial, teach how to move and goal foreach (string thisTextStr in introTutorialTextStrings) { yield return new WaitForSeconds(.2f); centerTextRoutine = SetTextRoutine( uiCenterText, thisTextStr, false, .05f ); StartCoroutine( centerTextRoutine ); while ( Input.GetAxis("Submit") != 1f ) { yield return null; } } // Teach player how to shoot the meteor stage = GameStage.SHOOTING; meteorMove.StartMeteor(); // Check if player shooting controller has ammo while ( Input.GetAxis("Submit") != 1f ) { yield return null; } StopCoroutine( centerTextRoutine ); uiCenterText.text = ""; while ( stage == GameStage.SHOOTING ) { yield return null; } }
public void InitialBetExpire(object sender, ElapsedEventArgs e) { stage &= ~GameStage.InitialBetting; //Turn off the flag, so no one can keep trying. if ( players.Count == 0 ) { SayChannel( "Huh.. I guess no one wanted to play after all." ); stage = GameStage.Stopped; return; } /*if ( deck.ValueLeft < 21 * ( players.Count + 2 ) ) { SayUser( "Deck Value: " + deck.ValueLeft + ", Safe value calculated: " + (21 * (players.Count + 2 )).ToString() + ".. Resetting deck.", "Aaron" ); deck.ResetDeck(); deck.Shuffle(); } else { SayUser( "Deck Value: " + deck.ValueLeft, "Aaron" ); }*/ LinkedList<string> blackJackPlayers = new LinkedList<string>(); //Ughh byte[] ctemp; Player play = null; string card = null, output; char suit = '\0'; foreach ( string player in players.Keys ) { try { play = BJMain.serverData[sid].p[player]; } catch ( KeyNotFoundException ) { SayChannel( "Something horrendously wrong just happened, please alert the bot manager." ); break; } ctemp = deck.GetCards(2); play.currentCards.AddCards( ctemp ); CardDeck.TranslateCard( ctemp[0], ref card, ref suit ); //if ( suit == 'H' || suit == 'D' ) card = "\u00034" + card + "\u0003 " + suit; /*else*/ card = "\u0002 " + card + "\u0002" + suit; output = "Your cards are:" + card; CardDeck.TranslateCard( ctemp[1], ref card, ref suit ); //if ( suit == 'H' || suit == 'D' ) card = "\u00034 " + card + "\u0003" + suit; /*else*/ card = "\u0002 " + card + "\u0002" + suit; int lowsum = play.currentCards.GetSum( SumType.Low ); int hisum = play.currentCards.GetSum( SumType.High ); output += "," + card + " (" + ( ( lowsum == hisum ) ? hisum.ToString() : lowsum.ToString() + "/" + hisum.ToString() ) + ")"; if ( hisum == 21 ) { output += ".. \u0002BlackJack!\u0002"; play.state |= PlayerState.Stand; blackJackPlayers.AddLast( player ); //players[play.nick] = true; //He's not gonna wanna change his blackjack. } SayUser( output, player ); } foreach ( string s in blackJackPlayers ) { players[s] = true; } ctemp = deck.GetCards(2); dealerCards.AddCards( ctemp ); CardDeck.TranslateCard( ctemp[0], ref card, ref suit ); if ( suit == 'H' || suit == 'D' ) card = "\u0002\u00034 " + card + "\u0003\u0002" + suit; else card = "\u0002 " + card + "\u0002" + suit; output = "House's visible card is:" + card + ", play your hand now!"; SayChannel( output ); //Wait for action now, give people 30s to play their hand. stage = GameStage.Started | GameStage.OpenedForAction; if ( players.Count == blackJackPlayers.Count ) gameTimer = new Timer( 500 ); else gameTimer = new Timer( 60000 ); gameTimer.Elapsed += new ElapsedEventHandler( PlayerStageOver ); gameTimer.AutoReset = false; gameTimer.Enabled = true; gameTimer.Start(); }
/// <summary> /// Checks to see if the game is currently in gs stage. /// </summary> /// <param name="gs">The gamestage to check for.</param> /// <returns>Wether or not we're in this stage.</returns> public bool InStage(GameStage gs) { return (stage & gs) != 0; }
private void ClientVersion(C.ClientVersion p) { if (Stage != GameStage.None) return; if (Settings.CheckVersion) if (!Functions.CompareBytes(Settings.VersionHash, p.VersionHash)) { Disconnecting = true; List<byte> data = new List<byte>(); data.AddRange(new S.ClientVersion {Result = 0}.GetPacketBytes()); BeginSend(data); SoftDisconnect(10); SMain.Enqueue(SessionID + ", Disconnnected - Wrong Client Version."); return; } Enqueue(new S.ClientVersion { Result = 1 }); Stage = GameStage.Login; }
void ExecuteAllCommand() { Debug.Log("stage:" + stage); do { Debug.Log("fightStage:" + fightStage); Result<Command> result = CommandManager.Instance.GetNextCommand(); if (result.Success) { Command nextCommand = result.Obj; Minion minion = MinionManager.Instance.GetMinionByID(nextCommand.minionID); if (minion == null) { Debug.LogError("No Minion when ExecuteCommand"); return; } switch(nextCommand.type) { case CommandType.StandBy: minion.StandBy(); break; case CommandType.Attack: minion.Attack(nextCommand.target); break; case CommandType.Move: Debug.Log("Move"); minion.Move(nextCommand.target); break; case CommandType.Skill: minion.UseSkill(nextCommand.target); break; default: break; } } else { if (result.Reason == "No Commands in this stage") { if (fightStage == FightStage.Skill) { stage = GameStage.Command; } else { ++fightStage; CommandManager.Instance.SetFightStage(fightStage); } } } } while (stage == GameStage.Fight); }
public void LoadScene(GameStage gst) { gameStage = gst; Application.LoadLevel (stageScenesDict[gst]); }
public void LogOut() { if (Stage != GameStage.Game) return; if (SMain.Envir.Time < Player.LogTime) { Enqueue(new S.LogOutFailed()); return; } Player.StopGame(23); Stage = GameStage.Select; Player = null; Enqueue(new S.LogOutSuccess { Characters = Account.GetSelectInfo() }); }
// Update is called once per frame void Update() { ActiveOptions.Values.CopyTo(activeOptionsDebugValues,0); strategyCards.Values.CopyTo(strategyCardsDebug,0); // Game setup, early initializations if (stage == GameStage.MainMenus) { stage = GameStage.InitializingManagers; InitializeManagers(); } else if (stage == GameStage.ManagersInitialized && Application.loadedLevel == 1) { stage = GameStage.InitializingOther; if (NetworkMgr.IsMasterClient()) { PlayerMgr.InitializePlayers(); CardMgr.PrepareDecks(); ComponentMgr.PrepareComponents(); } else { CardMgr.ReadyToPlay = true; ComponentMgr.ReadyToPlay = true; } } if (PlayerMgr.ReadyToPlay && CardMgr.ReadyToPlay && ComponentMgr.ReadyToPlay && stage == GameStage.InitializingOther) { stage = GameStage.Menus; } }
public void LogOut() { if (Stage != GameStage.Game) return; Player.StopGame(); Stage = GameStage.Select; Player = null; Enqueue(new S.LogOutSuccess { Characters = Account.GetSelectInfo() }); }
void Awake() { //hide message text gameOverText.gameObject.SetActive(false); isGameOver = false; //get manager mItemManager = GetComponent<ItemManager>(); mMonsterManager = GetComponent<MonsterManager>(); mMapManager = GetComponent<MapManager>(); //get character setting mSetUp = (SetUpManager)FindObjectOfType<SetUpManager> (); mPlayerData = new List<CharacterSetupManager>(mSetUp.transform.GetComponentsInChildren<CharacterSetupManager>()); PlayerCount = mPlayerData.Count; PlayerLeft = PlayerCount; Debug.Log ("playerCount: " + PlayerCount); //get map setting mMapManager.setMapList (mSetUp.mapList); //build player list mPlayerList = new List<Damagable> (); mPlayerPositionIndex = new List<int>(); //build item list mItemOnMapList = new List<Item>(); mItemOnMapPositionIndex = new List<int>(); mItemSpawnCounters = new List<float>(); //build monster list //.... mGameStage = GameStage.Init; }
public void GameOver(Damagable winner) { isGameOver = true; gameOverText.gameObject.SetActive(true); gameOverText.DOFade(1.0f, 1.5f).OnComplete(() => (mGameStage = GameStage.GameOver)); //mGameStage = GameStage.GameOver; gameOverText.text = "WINNER " + winner.name + " !"; }
void Prepare() { timer = CountDown; gameOverText.text = ((int) timer+1.0f).ToString(); gameOverText.gameObject.SetActive(true); mGameStage = GameStage.Prepare; }
void Update() { if (mGameStage == GameStage.Init) return; else if (mGameStage == GameStage.Prepare) { timer -= Time.deltaTime; if (timer < 0.0f) { ReleasePlayers(); gameOverText.text = "BATTLE START!"; gameOverText.DOFade(0.0f, 1.5f).OnComplete(() => gameOverText.gameObject.SetActive(false)); mGameStage = GameStage.Battle; return; } else gameOverText.text = ((int)timer + 1.0f).ToString(); } else if (mGameStage == GameStage.Battle) { if (mMap.itemSpawnSpots.Count > 0) { updateItemOnMapList(); updateItemSpawnCounter(); } } else if (mGameStage == GameStage.GameOver) { if (Input.anyKey) { Application.LoadLevel("settingcharacterscenetest"); } } }
private void Reinitialize() { snake = new Snake(); scoreTime = new TimeSpan(0, 0, 0); scoreY = 0f; highScore = null; CreateFood(); highScore = new HighScores(10); BackgroundMusic(meniuMusic); gameStage = GameStage.Meniu; }
public void Disconnect(byte reason) { if (!Connected) return; Connected = false; Stage = GameStage.Disconnected; TimeDisconnected = SMain.Envir.Time; lock (SMain.Envir.Connections) SMain.Envir.Connections.Remove(this); lock (Envir.AccountLock) { if (Player != null) Player.StopGame(reason); if (Account != null && Account.Connection == this) Account.Connection = null; } Account = null; _sendList = null; _receiveList = null; _retryList = null; _rawData = null; if (_client != null) _client.Client.Dispose(); _client = null; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here //to be changed gameStage = GameStage.SplashScreen; gameType = GameStage.SinglePlayerWBorders; snake = new Snake(); food = null; rnd = new Random(); lastTime = new TimeSpan(0, 0, 3); bClickAvailable = false; volSfx = 1f; volBg = 1f; scoreY = 0f; bMovingScore = true; bTongueOut = false; actualName = ""; scoreTime = new TimeSpan(0, 0, 0); pauseTime = new TimeSpan(0, 0, 0); tongueTime = new TimeSpan(0, 0, 0); base.Initialize(); }
public void SoftDisconnect(byte reason) { Stage = GameStage.Disconnected; TimeDisconnected = SMain.Envir.Time; lock (Envir.AccountLock) { if (Player != null) Player.StopGame(reason); if (Account != null && Account.Connection == this) Account.Connection = null; } Account = null; }
public void StartGame() { stage = GameStage.Started | GameStage.InitialBetting; //deck.ResetDeck(); //deck.Shuffle(); dealerCards.ResetHand(); players.Clear(); SayChannel( "Place your initial bets now!" ); gameTimer = new Timer( 20000 ); gameTimer.Enabled = true; gameTimer.AutoReset = false; gameTimer.Elapsed += new ElapsedEventHandler( this.InitialBetExpire ); gameTimer.Start(); }
public void StartFight(InputObject _inputObject) { stage = GameStage.Fight; fightStage = FightStage.StandBy; CommandManager.Instance.StartFight(); ExecuteAllCommand(); }
public void PlayerStageOver(object sender, ElapsedEventArgs e) { stage &= ~GameStage.OpenedForAction; //Turn off the flag so no one can keep trying. if ( sender != null && e != null ) { //Trim players that did not play LinkedList<string> trimPlayers = new LinkedList<string>(); //Ughh Dictionary<string, bool>.Enumerator iter = players.GetEnumerator(); while ( iter.MoveNext() ) { if ( !iter.Current.Value ) { //This person did not submit their bet, trim him. trimPlayers.AddLast( iter.Current.Key ); } } iter.Dispose(); foreach ( string p in trimPlayers ) { SayUser( "You failed to finish your hand within the time limit, you have been trimmed from this game.", p ); Player pz = BJMain.serverData[sid].p[p]; pz.state = PlayerState.Out; pz.bet = 0; pz.currentCards.ResetHand(); pz.secondHand.ResetHand(); players.Remove( p ); } } if ( players.Count == 0 ) { SayChannel( "Huh.. I guess no one wanted to play after all." ); stage = GameStage.Stopped; return; } byte[] ctemp = new byte[10]; string card = null, output; char suit = '\0'; byte tcard; int sum; bool houseBust; bool houseBJ; //Reveal second card tcard = dealerCards.First; CardDeck.TranslateCard( tcard, ref card, ref suit ); if ( suit == 'H' || suit == 'D' ) card = "\u0002\u00034 " + card + "\u0003\u0002" + suit; else card = "\u0002 " + card + "\u0002" + suit; output = "House hand is:" + card; tcard = dealerCards.Last; CardDeck.TranslateCard( tcard, ref card, ref suit ); if ( suit == 'H' || suit == 'D' ) card = "\u0002\u00034 " + card + "\u0003\u0002" + suit; else card = "\u0002 " + card + "\u0002" + suit; sum = dealerCards.GetSum( SumType.Smart ); output += "," + card + " (" + sum.ToString() + ")"; //SayChannel( output ); //AI Hits until hard 17 sum = dealerCards.GetSum( SumType.Smart ); while ( sum < 17 ) { tcard = deck.NextCard; dealerCards.AddCard( tcard ); CardDeck.TranslateCard( tcard, ref card, ref suit ); if ( suit == 'H' || suit == 'D' ) card = "\u0002\u00034 " + card + "\u0003\u0002" + suit; else card = "\u0002 " + card + "\u0002" + suit; sum = dealerCards.GetSum( SumType.Smart ); output += ".." + card + " (" + sum.ToString() + ")"; } if ( sum > 21 ) { output += ".. Bust:\u0002 " + sum.ToString() + "\u0002."; houseBust = true; houseBJ = false; } else if ( sum == 21 && dealerCards.Count == 2 ) { output += ".. House Blackjack!"; houseBJ = true; houseBust = false; } else { output += ".. Stand:\u0002 " + sum.ToString() + "\u0002."; houseBust = false; houseBJ = false; } SayChannel( output ); int playerSum; Dictionary<string, bool>.Enumerator itera = players.GetEnumerator(); while ( itera.MoveNext() ) { Player p = BJMain.serverData[sid].p[itera.Current.Key]; #region HouseBust if ( houseBust ) { if ( p.HasState( PlayerState.Surrender ) ) { p.surrenders++; } else if ( p.HasState( PlayerState.Bust ) ) { p.money -= p.bet / 2; SayUser( "House busted, you keep half your bet: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.busts++; } #region SplitHouseBust else if ( p.HasState( PlayerState.Split ) ) { if ( p.HasState( PlayerState.SplitLeftBust ) ) { p.money -= p.bet / 4; SayUser( "House busted, your left deck gets half it's bet back: \u0002" + Player.MoneyFormat( p.bet / 4 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.busts++; } else { p.money += p.bet / 2; SayUser( "House busted, your left deck wins: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.wins++; } if ( p.HasState( PlayerState.SplitRightBust ) ) { p.money -= p.bet / 4; SayUser( "House busted, your right deck gets half it's bet back: \u0002" + Player.MoneyFormat( p.bet / 4 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.busts++; } else { p.money += p.bet / 2; SayUser( "House busted, your right deck wins: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.wins++; } } #endregion #region NoSplitHouseBust else { if ( p.currentCards.GetSum( SumType.Smart ) == 21 && p.currentCards.Count == 2 ) { p.money += p.bet * 3; SayUser( "You BlackJacked this hand! House pays out 3:1!! \u0002" + Player.MoneyFormat( p.bet * 3 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.wins++; p.blackjacks++; } else { p.money += p.bet; SayUser( "House busted, you win: \u0002" + Player.MoneyFormat( p.bet ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.wins++; } } } #endregion #endregion #region No House Bust else { //Examine if this player won against the house. if ( p.HasState( PlayerState.Surrender ) ) { p.surrenders++; } else if ( p.HasState( PlayerState.Bust ) ) { p.money -= p.bet; SayUser( "You lost your bet of: \u0002" + Player.MoneyFormat( p.bet ) + "\u0002." + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.busts++; } #region SplitNoHouseBust else if ( p.HasState( PlayerState.Split ) ) { if ( !p.HasState( PlayerState.SplitLeftBust ) ) { //Check the first hand. playerSum = p.currentCards.GetSum( SumType.Smart ); if ( houseBJ ) { p.money -= p.bet / 2; SayUser( "You lost your left hand bet of: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); } else if ( playerSum > sum ) { p.money += p.bet / 2; SayUser( "You won on the left hand! You win: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002!" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.wins++; } else if ( playerSum == sum ) { SayUser( "You tied the house on the left hand! You keep its bet: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002!" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.ties++; } else { p.money -= p.bet / 2; SayUser( "You lose on the left hand! You've lost: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002!" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); } } else { p.money -= p.bet / 2; SayUser( "You lost your left hand bet of: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002." + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.busts++; } if ( !p.HasState( PlayerState.SplitRightBust ) ) { playerSum = p.secondHand.GetSum( SumType.Smart ); if ( houseBJ ) { p.money -= p.bet / 2; SayUser( "You lost your right hand bet of: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); } else if ( playerSum > sum ) { p.money += p.bet / 2; SayUser( "You won on the right hand! You win: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.wins++; } else if ( playerSum == sum ) { SayUser( "You tied the house on the right hand! You keep its bet: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.ties++; } else { p.money -= p.bet / 2; SayUser( "You lose on the right hand! You've lost: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); } } else { p.money -= p.bet / 2; SayUser( "You lost your right hand bet of: \u0002" + Player.MoneyFormat( p.bet / 2 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.busts++; } } #endregion #region NoSplitNoHouseBust else { playerSum = p.currentCards.GetSum( SumType.Smart ); if ( houseBJ ) { if ( playerSum == 21 && p.currentCards.Count == 2 ) { SayUser( "You tied the house this hand! You keep your bet: \u0002" + Player.MoneyFormat( p.bet ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.ties++; } else { p.money -= p.bet; SayUser( "You lose this hand! You've lost: \u0002" + Player.MoneyFormat( p.bet ) + "\u0002!" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); } } else if ( playerSum == 21 && p.currentCards.Count == 2 ) { p.money += p.bet * 3; SayUser( "You BlackJacked this hand! House pays out 3:1!! \u0002" + Player.MoneyFormat( p.bet * 3 ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.wins++; p.blackjacks++; } else if ( playerSum > sum ) { p.money += p.bet; SayUser( "You won this hand! You win: \u0002" + Player.MoneyFormat( p.bet ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.wins++; } else if ( playerSum == sum ) { SayUser( "You tied the house this hand! You keep your bet: \u0002" + Player.MoneyFormat( p.bet ) + "\u0002" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); p.ties++; } else { p.money -= p.bet; SayUser( "You lose this hand! You've lost: \u0002" + Player.MoneyFormat( p.bet ) + "\u0002!" + " [" + Player.MoneyFormat( p.money ) + "]", p.nick ); } } #endregion } #endregion if ( p.money < 10 ) { SayUser( "House feels bad for horrible player, you've graciously been given another \u0002" + Player.MoneyFormat( 50 - p.money ) + "\u0002 [" + Player.MoneyFormat( 50 ) + "]", p.nick ); p.money = 50; p.moneyResets++; } p.hands += ( p.HasState( PlayerState.Split ) ) ? (ulong)2 : (ulong)1; if ( p.highestMoney < p.money ) p.highestMoney = p.money; if ( p.HasState( PlayerState.DoubleDown ) ) p.dds++; if ( p.HasState( PlayerState.Split ) ) p.splits++; p.state = PlayerState.Out; p.bet = 0; p.channel = string.Empty; p.currentCards.ResetHand(); p.secondHand.ResetHand(); } itera.Dispose(); //All players should be processed. Start a new game. StartGame(); }
IEnumerator WinRoutine() { stage = GameStage.WIN; uiLowerText.text = "\\\\ PRESS TRIGGER TO CONTINUE //"; centerTextRoutine = SetTextRoutine( uiCenterText, "CITY SAVED", false, .5f ); yield return new WaitForSeconds( 6f ); while ( Input.GetAxis("Submit") != 1f ) { yield return null; } SceneManager.LoadScene(0); }
public void SetStage(GameStage pStage) { stage = pStage; }
private void MeniuClick(MenuItemManager menu) { string strResult = menu.onClick(Mouse.GetState().X, Mouse.GetState().Y); if (strResult == "Play") { BackgroundMusic(playMusic); gameStage = gameType; } else if (strResult == "Exit") End(); else if (strResult == "Options") { setupOptionsMenu(); gameStage = GameStage.Options; } else if (strResult == "Credits") gameStage = GameStage.Credits; else if (strResult == "Back") { setupMenu(); gameStage = GameStage.Meniu; } else if (strResult == "Sound FX") { optionsMenu.ToggleAct("Sound FX"); if (optionsMenu.IsActivated("Sound FX")) volSfx = 1f; else volSfx = 0f; } else if (strResult == "Background Music") { optionsMenu.ToggleAct("Background Music"); if (optionsMenu.IsActivated("Background Music")) { volBg = 1f; BackgroundMusic(meniuMusic); } else { volBg = 0f; BackgroundMusic(meniuMusic); } } else if (strResult == "Borders") { optionsMenu.ToggleAct("Borders"); if(optionsMenu.IsActivated("Borders")) gameType = GameStage.SinglePlayerWBorders; else gameType = GameStage.SinglePlayerBorderless; } else if (strResult == "Moving Score") { optionsMenu.ToggleAct("Moving Score"); if (optionsMenu.IsActivated("Moving Score")) { bMovingScore = true; } else { bMovingScore = false; } } else if (strResult == "Highscores") { gameStage = GameStage.Highscores; highScore = HighScores.LoadHighScores(); } }
public void InitializeManagers() { LanguageMgr.Initialize (); TechMgr.Initialize (); //Dependency: Language file BoardMgr.Initialize (); //Dependency: Language file CardMgr.Initialize (); //Dependency: Language file readStrategyCards (); //Dependency: Language file ComponentMgr.Initialize (); //Dependency: Language file UnitMgr.Initialize (); //Dependency: Tech file stage = GameStage.ManagersInitialized; }