void PauseGame(bool _pause) { if (!playerUI) { playerUI = GameManager.instance.SpawnedPlayer.UI; } if (_pause) { playerUI.PauseMenuSetActive(true); if (freezeOnPause) { Time.timeScale = 0; } } else { playerUI.PauseMenuSetActive(false); if (freezeOnPause) { Time.timeScale = 1; } } }
protected override void Awake() { instance = this; startCursorSettings.ActivateSettings(); SetMenuUI(); InitializeAimFXHandlers(); }
// 帧回调 void Update() { // 更新玩家信息 UIPlayer local = gameui.players[CurrentPlayer.Ins.user.color]; UIPlayer oppoent = gameui.players[CurrentPlayer.Ins.opponent.color]; // 名字 local.name.text = CurrentPlayer.Ins.user.username; oppoent.name.text = CurrentPlayer.Ins.opponent.username; // 状态 gameui.players[game.color].state.text = "落子中..."; gameui.players[game.GetOppenentColor()].state.text = ""; // 游戏开始 if (isGameStart) { isGameStart = false; StartGame(); } // 游戏结束 if (isGameOver) { isGameOver = false; GameOver(); } // 对手落子 if (isOppenMoved) { isOppenMoved = false; // 界面落子 GoUIManager.Ins.setMove(oppenPos, game.color); // 逻辑落子 if (game.SetMove(oppenPos, game.color)) { PlayerChange(); } else { Debug.Log("对手落子异常!"); } } // AI落子 if (GameType == 1 && game.color == CurrentPlayer.Ins.opponent.color && isAICanMove) { isAICanMove = false; // 玩家下棋成功后AI下棋 StartCoroutine(GNUComputerMove()); } // 请求结算 if (isReqCheckOut) { isReqCheckOut = false; gameui.checkoutDialog.SetActive(true); } }
private void Awake() { aiPlayer = FindObjectOfType <AIPlayer>(); uiPlayer = FindObjectOfType <UIPlayer>(); addDifficultyTimer = nextDifficultyDelay; startScreen.SetActive(true); }
void Awake() { instance = this; if (!useMobileConsole) { consoleUIPanel.SetActive(false); } }
void Awake() { if (I == null) { I = this; } else { Destroy(gameObject); } }
// Start is called before the first frame update void Start() { myAnimator = GetComponentInChildren <Animator>(); rb = GetComponent <Rigidbody>(); uiPlayer = FindObjectOfType <UIPlayer>(); main = FindObjectOfType <GameMain>(); // get the distance to ground distToGround = GetComponent <Collider>().bounds.extents.y; }
public static void Load() { if (!loaded) { Clear(); } if (Match.self.activeEvent == null) { return; } if (self != null) { foreach (Player p in Match.self.activeEvent.Players) { self.Add(p); } loaded = true; } // clear the ones who left bool exists = false; foreach (Player i in players) { exists = false; foreach (Player j in Match.self.activeEvent.Players) { // TODO make it with hashed ID if (i.PlayerName == j.PlayerName) { exists = true; // update the player's character foreach (GameObject po in objects) { UIPlayer uip = po.GetComponent <UIPlayer>(); if (uip.player.PlayerName == j.PlayerName) { uip.Set(j); break; } } break; } } if (!exists) { self.Delete(i); } } }
public void SKill1Reset() { if (isSkill1CTime) { Skill1CTime -= Time.deltaTime; if (Skill1CTime <= 0) { UIPlayer.SkillSetUp(0); Skill1CTime = Stat.skillCTime[0]; isSkill1CTime = false; } } }
public void Skill3Reset() { if (isSkill3CTime) { Skill3CTime -= Time.deltaTime; if (Skill3CTime <= 0) { UIPlayer.SkillSetUp(2); Skill3CTime = Stat.skillCTime[2]; Skill3_End.SetActive(false); isSkill3CTime = false; } } }
public void Skill2Reset() { if (isSkill2CTime) { Skill2CTime -= Time.deltaTime; if (Skill2CTime <= 0) { UIPlayer.SkillSetUp(1); Skill2CTime = Stat.skillCTime[1]; isSkill2 = false; isSkill2CTime = false; Skill2_Normal.SetActive(false); Skill2_Special.SetActive(false); } } }
public GameObject InitUIPlayer(Player player) { GameObject go = Instantiate(_UIPlayer.gameObject) as GameObject; if (go != null) { go.SetActive(true); _playerGrid.AddChild(go.transform); go.transform.localScale = Vector3.one; UIPlayer uiplayer = go.GetComponent <UIPlayer>(); uiplayer.Init(player.playerName, player.IconIndex.ToString()); _playerGrid.Reposition(); player.MyUIPlayer = uiplayer; } return(go); }
void CheckGameOver() { var gm = GameManager.instance; if (gm) { if (gm.IsGameOver) { if (!playerUI) { playerUI = GameManager.instance.SpawnedPlayer.UI; if (playerUI) { playerUI.SetSystemCursor(true, false); } } } } }
public override void AskForAction(ActionType actionType, object callbackObject, InfoDescription error) { unityComputer.TurnTimeoutHandler.StartTurnTimer(this, actionType, callbackObject); LogManager.Log(unityComputer.transform.name + " : " + actionType.ToString("G")); staticCallBackObject = callbackObject; if (error == InfoDescription.NoError) { // NO ERROR TurnArrowController.SetActive(UIPlayer.GetRelativePlayerSeat(base.GetPlayersSeat())); awaitingAction = actionType; unityComputer.WaitForAction(); } else { // SHOW ERROR TurnArrowController.SetActive(UIPlayer.GetRelativePlayerSeat(GetPlayersSeat())); LogManager.Log(error.ToString()); } }
//warning: works only when using human players! private IEnumerator ChangeActivePlayerUI(UIPlayer player, float delay) { player.GetPlayerUI().transform.SetAsLastSibling(); //yield return new WaitForSeconds(delay); int numPlayers = GameGlobals.players.Count; for (int i = 0; i < numPlayers; i++) { if (GameGlobals.players[i] == player) { player.GetPlayerMarkerUI().SetActive(true); player.GetPlayerDisablerUI().SetActive(true); continue; } UIPlayer currPlayer = (UIPlayer)GameGlobals.players[i]; currPlayer.GetPlayerMarkerUI().SetActive(false); currPlayer.GetPlayerDisablerUI().SetActive(false); } return(null); }
private void InitCharacters() { Tile foodTile = food.CurrentTile; Random rand = new Random(); int tileX = rand.Next(0, Context.Instance.TileWidth); int tileY = rand.Next(0, Context.Instance.TileHeight); while (Math.Abs(tileX - foodTile.X) < (Context.Instance.TileWidth - 1) / 2 || Math.Abs(tileY - foodTile.Y) < (Context.Instance.TileHeight - 1) / 2) { tileX = rand.Next(0, Context.Instance.TileWidth); tileY = rand.Next(0, Context.Instance.TileHeight); } player = new Player(world); uiPlayer = new UIPlayer(player, world); player.Width = uiPlayer.Width; player.InitPositionWithTile(world.GetTileAt(tileX, tileY)); player.Notify(); player.Direction = MoveDirection.NIL; player.ShouldMove = true; tileX = rand.Next(0, Context.Instance.TileWidth); tileY = rand.Next(0, Context.Instance.TileHeight); while ((Math.Abs(tileX - foodTile.X) < (Context.Instance.TileWidth - 1) / 2 || Math.Abs(tileY - foodTile.Y) < (Context.Instance.TileHeight - 1) / 2) || (tileX == player.CurrentTile.X && tileY == player.CurrentTile.Y)) { tileX = rand.Next(0, Context.Instance.TileWidth); tileY = rand.Next(0, Context.Instance.TileHeight); } aiPlayer = new AIPlayer(world); uiAIPlayer = new UIAIPlayer(aiPlayer, world); aiPlayer.Width = uiAIPlayer.Width; aiPlayer.InitPositionWithTile(world.GetTileAt(tileX, tileY)); aiPlayer.Notify(); aiPlayer.Direction = MoveDirection.NIL; aiPlayer.Path = pathFinder.Find(food.CurrentTile, aiPlayer.CurrentTile); aiPlayer.Go(); player.Speed = 2 * aiPlayer.Speed; }
// Use this for initialization void Start() { if (isLocalPlayer) { MyUIMain.Init(); MyUIMain.SetActiveDealBtn(isServer); } if (MyUIPlayer == null) { MyUIPlayer = gameObject.GetComponent <UIPlayer>(); } MyUIMain._playerGrid.AddChild(transform); transform.localScale = Vector3.one; MyUIPlayer.Init(playerName, IconIndex.ToString()); MyUIMain._playerGrid.Reposition(); if (NetworkGameManager.sInstance != null) {//we MAY be awake late (see comment on _wasInit above), so if the instance is already there we init Init(); } }
// Awake is called when this class is first initialized void Awake() { _controller = GetComponent <PlayerController>(); _playerUI = FindObjectOfType <UIPlayer>(); }
private void Awake() { instance = this; }
private IEnumerator InitGameGlobals() { string configText = ""; GameProperties.configurableProperties = new DynamicallyConfigurableGameProperties(); //Assign configurable game properties from file if any //Application.ExternalEval("console.log('streaming assets: "+ Application.streamingAssetsPath + "')"); string path = Application.streamingAssetsPath + "/config.cfg"; if (path.Contains("://") || path.Contains(":///")) //url instead of path { WWW www = new WWW(path); yield return(www); configText = www.text; } else { configText = File.ReadAllText(path); } UpdateGameConfig(configText); GameGlobals.numberOfSpeakingPlayers = 0; GameGlobals.currGameId++; GameGlobals.currGameRoundId = 0; GameGlobals.albumIdCount = 0; GameGlobals.gameDiceNG = new RandomDiceNG(); GameGlobals.audioManager = new AudioManager(); //GameGlobals.playerIdCount = 0; //GameGlobals.albumIdCount = 0; GameGlobals.albums = new List <Album>(GameProperties.configurableProperties.numberOfAlbumsPerGame); //destroy UIs if any if (GameGlobals.players != null && GameGlobals.players.Count > 0) { UIPlayer firstUIPlayer = null; int pIndex = 0; while (firstUIPlayer == null && pIndex < GameGlobals.players.Count) { firstUIPlayer = (UIPlayer)GameGlobals.players[pIndex++]; if (firstUIPlayer != null) { firstUIPlayer.GetWarningScreenRef().DestroyPoppupPanel(); Destroy(firstUIPlayer.GetPlayerCanvas()); } } } GameGlobals.players = new List <Player>(GameProperties.configurableProperties.numberOfPlayersPerGame); GameGlobals.gameLogManager = new MongoDBLogManager(); GameGlobals.gameLogManager.InitLogs(); //only generate session data in the first game if (GameGlobals.currGameId == 1) { //GameGlobals.gameLogManager = new DebugLogManager(); string date = System.DateTime.Now.ToString("ddHHmm"); //generate external game code from currsessionid and lock it in place //gamecode is in the format ddmmhhmmss<3RandomLetters>[TestGameCondition] string generatedCode = date; //sb.ToString(); //generate 3 random letters for (int i = 0; i < 3; i++) { generatedCode += (char)('A' + Random.Range(0, 26)); } GameGlobals.currSessionId = generatedCode; //update the gamecode UI //GameObject UIGameCodeDisplay = Object.Instantiate(UIGameCodeDisplayPrefab); //UIGameCodeDisplay.GetComponentInChildren<Text>().text = "Game Code: " + GameGlobals.currSessionId; //Object.DontDestroyOnLoad(UIGameCodeDisplay); } else { this.UIStartGameButton.interactable = true; } if (GameProperties.configurableProperties.isAutomaticalBriefing) //generate condition automatically (asynchronous) { GameGlobals.gameLogManager.GetLastSessionConditionFromLog(YieldedActionsAfterGet); //changes session code } else { //create session parameterization SessionParameterization mock = new SessionParameterization("mock"); GameProperties.configurableProperties.possibleParameterizations.Add(mock); this.UIStartGameButton.interactable = true; GameProperties.configurableProperties.numSessionGames = 0; //not used } //init fatima strings GameGlobals.FAtiMAScenarioPath = "/Scenarios/ForTheRecord-EN.iat"; AssetManager.Instance.Bridge = new AssetManagerBridge(); GameGlobals.FAtiMAIat = IntegratedAuthoringToolAsset.LoadFromFile(GameGlobals.FAtiMAScenarioPath); }
public void InitGame() { interruptionRequests = 0; InterruptGame(); //interrupt game update while loading... choosePreferedInstrumentResponseReceived = false; playForInstrumentResponseReceived = false; levelUpResponseReceived = false; lastDecisionResponseReceived = false; currPlayerIndex = 0; //get player poppups (can be from any player) and set methods if (GameGlobals.players.Count > 0) { UIPlayer firstUIPlayer = null; int pIndex = 0; while (firstUIPlayer == null && pIndex < GameGlobals.players.Count) { firstUIPlayer = (UIPlayer)GameGlobals.players[pIndex++]; if (firstUIPlayer != null) { firstUIPlayer.GetWarningScreenRef().AddOnShow(InterruptGame); firstUIPlayer.GetWarningScreenRef().AddOnHide(ContinueGame); } } } infoPoppupLossRef = new PoppupScreenFunctionalities(false, InterruptGame, ContinueGame, poppupPrefab, canvas, GameGlobals.monoBehaviourFunctionalities, Resources.Load <Sprite>("Textures/UI/Icons/InfoLoss"), new Color(0.9f, 0.8f, 0.8f), "Audio/albumLoss"); infoPoppupWinRef = new PoppupScreenFunctionalities(false, InterruptGame, ContinueGame, poppupPrefab, canvas, GameGlobals.monoBehaviourFunctionalities, Resources.Load <Sprite>("Textures/UI/Icons/InfoWin"), new Color(0.9f, 0.9f, 0.8f), "Audio/albumVictory"); infoPoppupNeutralRef = new PoppupScreenFunctionalities(false, InterruptGame, ContinueGame, poppupPrefab, canvas, GameGlobals.monoBehaviourFunctionalities, Resources.Load <Sprite>("Textures/UI/Icons/Info"), new Color(0.9f, 0.9f, 0.9f), "Audio/snap"); //these poppups load the end scene endPoppupLossRef = new PoppupScreenFunctionalities(false, InterruptGame, ContinueGame, poppupPrefab, canvas, GameGlobals.monoBehaviourFunctionalities, Resources.Load <Sprite>("Textures/UI/Icons/InfoLoss"), new Color(0.9f, 0.8f, 0.8f), delegate() { /*end game*/ if (this.gameMainSceneFinished) { GameSceneManager.LoadEndScene(); } return(0); }); endPoppupWinRef = new PoppupScreenFunctionalities(false, InterruptGame, ContinueGame, poppupPrefab, canvas, GameGlobals.monoBehaviourFunctionalities, Resources.Load <Sprite>("Textures/UI/Icons/InfoWin"), new Color(0.9f, 0.9f, 0.8f), delegate() { /*end game*/ if (this.gameMainSceneFinished) { GameSceneManager.LoadEndScene(); } return(0); }); ChangeActivePlayerUI(((UIPlayer)(GameGlobals.players[0])), 2.0f); gameMainSceneFinished = false; preferredInstrumentsChoosen = false; //diceRollDelay = UIRollDiceForInstrumentOverlay.GetComponent<Animator>().GetCurrentAnimatorStateInfo(0).length; diceRollDelay = 4.0f; canCheckAlbumResult = false; checkedAlbumResult = false; canSelectToCheckAlbumResult = true; int numPlayers = GameGlobals.players.Count; Player currPlayer = null; for (int i = 0; i < numPlayers; i++) { currPlayer = GameGlobals.players[i]; currPlayer.ReceiveGameManager(this); currPlayer.ReceiveTokens(1); } GameGlobals.currGameRoundId = 0; //first round numMegaHits = 0; marketLimit = Mathf.FloorToInt(GameProperties.configurableProperties.numberOfAlbumsPerGame * 4.0f / 5.0f) - 1; currNumberOfMarketDices = GameProperties.configurableProperties.initNumberMarketDices; rollDiceForInstrumentOverlayAnimator = UIRollDiceForInstrumentOverlay.GetComponent <Animator>(); ContinueGame(); }
private void Awake() { uiP = GetComponent <UIPlayer>(); }
public override void PlayCard(Common.Card cardToPlay) { PlayedCardsController.PlayCard(cardToPlay, UIPlayer.GetRelativePlayerSeat(GetPlayersSeat()), this); }
public void SetPlayerUI(UIPlayer _playerUI) { playerUI = _playerUI; }
public void ReceiveInvoker(UIPlayer invoker) { this.invoker = invoker; speechBalloon = invoker.GetSpeechBaloonUI(); }