public RenderingExplosion(ContentManager Content) : base(Content) { spriteBatch = Content.ServiceProvider.GetService(typeof(SpriteBatch)) as SpriteBatch; explosionTexture = Content.Load<Texture2D>("TroopTexture/explosion"); stateGame = Content.ServiceProvider.GetService(typeof(StateGame)) as StateGame; }
// //////////////////////////////////////////////// Action !!! public void DoAction() { // Set Variable Objects.. if (!mCurState.mDidExecute_Entry) { int num = arrVar.Count; for (int i = 0; i < num; i++) { AgVariable curVar = arrVar [i]; curVar.SetValueBy(mCurState.mName); } for (int i = 0; i < num; i++) { AgVariable curVar = arrVar [num - i - 1]; if (curVar.IsItClearStage(mCurState.mName)) { arrVar.RemoveAt(i); } } } mCurState = (StateGame)mCurState.Action(); if (mCurState != null) { if (!mCurState.mDidExecute_Entry) // [2012:10:15:MOON] XXX { mCurState = (StateGame)mCurState.Action(); } } }
public void Reset() { State = StateGame.RESET_GAME; _block.Movement.Stop(); GameManager.Instance.ScoreManager.Stage = 1; OnExitRound(); }
public void AddAdditionalActionOf(string pName, string pType, Action pAction) { // [2013:4:19:MOON] Added StateGame aObj = (StateGame)GetObjectNameOf(pName); //(" HtStateArray :: AddAdditionalActionOf " + aObj.mName).HtLog (); aObj.AddAnActionTo(pType, pAction); }
private void OnNextBlock(BlockCollision block) { GameManager.Instance.ScoreManager.ModifyScore(+1, block.transform.localScale.x * block.transform.localScale.z); if (GameManager.Instance.ScoreManager.Score == GameManager.Instance.ScoreManager.LimitBlocksInRound) { _fxWin.Play(); _audioWin.Play(); if (GameManager.Instance.ScoreManager.Stage == GameManager.Instance.ScoreManager.MaxStages) { State = StateGame.WIN_STATE; GameManager.Instance.ScoreManager.LimitBlocksInRound++; } OnExitRound(); GameManager.Instance.ScoreManager.Stage += 1; return; } //if (GameManager.Instance.ScoreManager.Score != 0 && GameManager.Instance.ScoreManager.Score % 2 == 0) // GameManager.Instance.FogColor.FogColor = GameManager.Instance.Gradient.RandomColor(); _baseMovement.Target = (GameManager.Instance.Base.transform.position + Vector3.down * block.transform.localScale.y); _block.Collision.EventNextBlock -= OnNextBlock; _block.Movement.EventExit -= OnExitRound; SpawnBlock(block.transform); }
public void OnExitRound() { if (GameManager.Instance.ScoreManager.Score != GameManager.Instance.ScoreManager.LimitBlocksInRound && State != StateGame.WIN_STATE) { GameManager.Instance.ScoreManager.Stage = 1; State = StateGame.LOSE_ROUND; Vibration.Lose(); } _block.Collision.EventNextBlock -= OnNextBlock; _block.Movement.EventExit -= OnExitRound; foreach (var remainder in GameManager.Instance.Remainders) { Destroy(remainder.gameObject); } GameManager.Instance.Remainders.Clear(); GameManager.Instance.Base.GetComponentInChildren <BlockCollisionBase>().Collision = BlockCollisionBase.TypeCollision.Second; GameManager.Instance.BackgroundGroundFX.Stop(); if (GameManager.Instance.ScoreManager.Score != GameManager.Instance.ScoreManager.LimitBlocksInRound) { Destroy(_block.gameObject); } StartCoroutine(WaitDel()); }
//Function to set info in main window about number cards on board and hand. private void SetCardsOnBoardAndHand(StateGame list) { //Temps vars. int numCardsInHand = 0; int numCardsInTable = 0; //Foreach to set number of cards. foreach (PlaceCard elem in list.Rectangles) { if (elem.CardCode != "face") { if (elem.LocalPlayer) { if (elem.TopLeftY > limitToCheckBoardAndHand) { numCardsInTable++; } else { numCardsInHand++; } } } } //Show in local window. CardsInTable.Text = $"Board: {numCardsInTable}"; CardsInHand.Text = $"Hand: {numCardsInHand}"; }
void Awake() { currentScore = 0; currentLevel = 1; uiManager = GetComponent <UIManager>(); spawnObjManager = GetComponent <SpawnObjectManger>(); soundController = GetComponent <SoundController> (); scoreNextLevel = UnityEngine.Random.Range(10, 15) + currentScore; uiManager.ChangeScoreText(currentScore); // Start Loading screen stateGame = StateGame.Loading; player.transform.position = new Vector2(-8 * DISTANCE_OBJ, player.transform.position.y); StartCoroutine(Loading()); // Check play first time to show tutorial firstPlay = CheckFirstPlay(); // Get list obj change gradien to control listCreatures = new List <GradientColorChangeObject>(); GradientColorChangeObject[] array = FindObjectsOfType <GradientColorChangeObject>(); foreach (GradientColorChangeObject obj in array) { listCreatures.Add(obj); } currentSeason = Season.Spring; }
public RenderingTroop(ContentManager Content) : base(Content) { spriteBatch = Content.ServiceProvider.GetService(typeof(SpriteBatch)) as SpriteBatch; red_tank = Content.Load<Model>("ModelTroops/gunship"); blue_tank = Content.Load<Model>("ModelTroops/bomber"); battle = Content.Load<Texture2D>("TroopTexture/war"); font = Content.Load<SpriteFont>("Fonts/DefaultFont"); //bounding sphere red boundingSphereModelShipRed = new BoundingSphere(); foreach (ModelMesh mesh in red_tank.Meshes) { if (boundingSphereModelShipRed.Radius == 0) boundingSphereModelShipRed = mesh.BoundingSphere; else boundingSphereModelShipRed = BoundingSphere.CreateMerged(boundingSphereModelShipRed, mesh.BoundingSphere); } stateGame = Content.ServiceProvider.GetService(typeof(StateGame)) as StateGame; //bounding sphere blue boundingSphereModelShipBlue = new BoundingSphere(); foreach (ModelMesh mesh in blue_tank.Meshes) { if (boundingSphereModelShipBlue.Radius == 0) boundingSphereModelShipBlue = mesh.BoundingSphere; else boundingSphereModelShipBlue = BoundingSphere.CreateMerged(boundingSphereModelShipBlue, mesh.BoundingSphere); } }
public ExaState createState(int id, object[] parameters) { //Initialize ExaState NewState = null; //Check ID switch(id) { case ExaState.TITLE: if (parameters != null && parameters.Length >= 1) NewState = new StateTitle((StateGame)parameters[0]); break; case ExaState.GAME: NewState = new StateGame(); break; case ExaState.PAUSE: break; case ExaState.RESULT: if (parameters != null && parameters.Length >= 2) NewState = new StateResult ((StateGame)parameters [0], (float)parameters[1]); break; } //Return return NewState; }
/// <summary> /// Выпускает блок игрока. /// </summary> /// <param name="x">Столбец в котором блок</param> public void FirePlayerBlock(int x) // вызывается при нажатии мышки на блок снизу { if (stateGame != StateGame.Waiting) { return; } Debug.Log("FIRE"); stateGame = StateGame.Fly; currentPlayerBlock.transform.localPosition = new Vector3(Helper.TransformBlockX(x), currentPlayerBlock.transform.localPosition.y, currentPlayerBlock.transform.localPosition.z); //перемещает кубик в точку выстрела вверх Debug.Log("Игрок выстреливает блоком."); int y = GetYEmptyCell(x); // получает y пустой ячейку по вертикале по номеру нижней currentPlayerBlock.transform.SetParent(gameGrid.transform); currentPlayerBlock.transform.position = new Vector3(currentPlayerBlock.transform.position.x, currentPlayerBlock.transform.position.y, 15f); if (y != -1) { StartCoroutine(UpdateNormalMove(x, y)); } else { StartCoroutine(UpdateLoseMove()); } }
// Use this for initialization void Start() { stateGame = StateGame.stateGame; userLoged = stateGame.userLoged; NotificationCenter.DefaultCenter().AddObserver(this, "Increment"); NotificationCenter.DefaultCenter().AddObserver(this, "GameOver"); }
IEnumerator StartGame() { showBanner = 0; while (lettersOfBegin.Length > showBanner) { if (lettersOfBegin.Length - 1 == showBanner) { foreach (Card card in _cards) { card.CloseCard(); } } BannerText.text = lettersOfBegin[showBanner++]; yield return(new WaitForSeconds(1)); } BannerText.text = string.Empty; _stateGame = StateGame.play; if (!IsExecuterWorking) { StartCoroutine(StateExecute()); } if (!IsTimeLeftWorking) { StartCoroutine(TimeLeft()); } }
private void ExecuteState(StateItem item) { switch (item.stateItemType) { case StateItem.StateItemType.NewLevel: StartNewLevel(); break; case StateItem.StateItemType.Hiden: _openCards[0].HideCard(); _openCards[1].HideCard(); _openCards[0] = null; _openCards[1] = null; FoundPair++; Score += Random.Range(1, 4); // randomize prize UpdateScore(); if (FoundPair == 7) { previousLevelTimeLeft = (int)slider.value; _stateGame = StateGame.level_finished; } break; case StateItem.StateItemType.Open: //item.card.OpenCard(); break; case StateItem.StateItemType.Close: _openCards[0].CloseCard(); _openCards[0] = null; _openCards[1].CloseCard(); _openCards[1] = null; break; } }
public void SetStartLevel() { textLevelCur.text = curLevel.ToString(); scoreAdd = 0; textScoreAdd.text = scoreAdd.ToString(); foreach (Transform item in tTemp) { Destroy(item.gameObject); } enableCamFollowPlayer = true; textTouchToPlay.gameObject.SetActive(true); winPanel.SetActive(false); losePanel.SetActive(false); stateGame = StateGame.PressToPlay; if (tMap.childCount > 0) { Destroy(tMap.GetChild(0).gameObject); } for (int i = 0; i < curLevel; i++) { imgShowLevel[i].color = new Color(0, .5f, 1, 1); } GameObject g = Instantiate(Resources.Load("Level/" + "Level " + curLevel) as GameObject, tMap); }
public Game(bool isHost) { InitializeComponent(); fourship.IsChecked = true; HorizontalOrientation.IsChecked = true; _shipToggles = new ShipToggles(); _seaPlayer = new Sea(playerSquare); _seaOpponent = new Sea(opponentSquare); AddTooggles(); if (isHost) { _stateGame = StateGame.OpponentWaiting; SetEnableControls(_stateGame); ClientManager.Instance.Callback.SetHandler <CurentGameResponse>(GetOpponent); } else { _stateGame = StateGame.PreparationGame; SetEnableControls(_stateGame); } ClientManager.Instance.Callback.SetHandler <SendOpponentIsReadyResponse>(ResultOpponentSendReady); ClientManager.Instance.Callback.SetHandler <StartGameResponse>(StartGame); ClientManager.Instance.Callback.SetHandler <EndGameResponse>(EndGameGame); ClientManager.Instance.Callback.SetHandler <ShotResponse>(ResultFire); ClientManager.Instance.Callback.SetHandler <AbortGameResponse>(AbortGame); }
public void ChangeStateGame(StateGame stateGame) { this.stateGame = stateGame; switch (stateGame) { case StateGame.GamePlay: spawnObjManager.InitalSpawnObj(); player.Reset(); player.transform.position = Vector2.zero; player.gameObject.SetActive(true); break; case StateGame.Home: break; case StateGame.GameOver: soundController.SoundGameOverOn(); soundController.SoundBackgroundOff(); spawnObjManager.StopSpawn(); ai.StopMove(); SaveScoreData(); uiManager.CallGameOVer(); // StartCoroutine(CallRestartGame()); break; } }
public void setState(StateGame state) { Debug.Log(stateGame); stateGame = state; Debug.Log(stateGame); switch (stateGame) { case StateGame.Play: { Time.timeScale = 1.0f; break; } case StateGame.Stop: { Time.timeScale = 0.0f; break; } case StateGame.End: { menu.SetActive(true); break; } } }
//IEnumerator CallRestartGame() //{ // yield return new WaitForSeconds(2.0f); // RestartGame(); //} public void RestartGame() { // Reset particle particleRain.SetActive(false); particleSnow.SetActive(false); currentScore = 0; uiManager.ChangeScoreText(currentScore); spawnObjManager.ResetSpawn(); player.transform.position = Vector2.zero; player.gameObject.SetActive(true); player.Reset(); soundController.SoundGameOverOff(); soundController.SoundBackgroundOn(); // Reset level game currentLevel = 1; scoreNextLevel = UnityEngine.Random.Range(10, 15) + currentScore; if (currentSeason != Season.Spring) { ChangeSeason(Season.Spring); } Camera.main.GetComponent <CameraFollowPlayer>().Reset(); stateGame = StateGame.GamePlay; }
//Function to set screen resolution and limits. private void SetLimits(StateGame game) { //Setting resolution game and limits. screenHeightGame = (ushort)((game.Screen == null) ? 0 : game.Screen["ScreenHeight"]); limitHeightCardTracked = screenHeightGame * 0.34; limitToCheckBoardAndHand = screenHeightGame * 0.121; }
public SpriteControl() { InitializeComponent(); player = new Sprite2D(); stateGame = StateGame.Idle; tmrTick.Enabled = true; }
//Function to set graveyards. private void SetGraveyards(StateGame currentGame) { //Loop to add card in graveyard local player. foreach (Card card in deckTrack) { if (!currentGame.Rectangles.Exists(x => x.CardID == card.CardID)) { if (!graveyardTrack.Exists(x => x.CardID == card.CardID)) { graveyardTrack.Add(card); } } } //Loop to add card in graveyard opponent player. foreach (Card card in deckTrackOpponent) { if (!currentGame.Rectangles.Exists(x => x.CardID == card.CardID)) { if (!graveyardTrackOpponent.Exists(x => x.CardID == card.CardID)) { graveyardTrackOpponent.Add(card); } } } }
public SoundManager(ContentManager content) { //gameState = content.ServiceProvider.GetService(typeof(GameState)) as GameState; stateGame = content.ServiceProvider.GetService(typeof(StateGame)) as StateGame; renderingState = content.ServiceProvider.GetService(typeof(RenderingState)) as RenderingState; selection = content.Load<SoundEffect>("Sounds/select"); explosion = content.Load<SoundEffect>("Sounds/explosion2"); laser = content.Load<SoundEffect>("Sounds/laser"); cameraListener = new AudioListener(); cameraListener.Position = new Vector3( renderingState.spriteBatch.GraphicsDevice.Viewport.Width / 2, renderingState.spriteBatch.GraphicsDevice.Viewport.Height / 2, 0); explosionEmitter = new List<AudioEmitter>(); explosionInstance = new List<SoundEffectInstance>(); explosionPos = new List<Vector3>(); laserEmitter = new List<AudioEmitter>(); laserInstance = new List<SoundEffectInstance>(); laserPos = new List<Vector3>(); isSoundActive = true; }
public void AddTimeOutProcess(float pLimitTime, Action pTimeout) { StateGame lastGame = (StateGame)arrState [arrState.Count - 1]; lastGame.mfLimitTime = pLimitTime; lastGame.mfnTimeOutProcess = pTimeout; }
public StateResult(StateGame game, float health) : base(RESULT) { //Save game m_Game = game; //Get quote Debug.Log("health " + health + " / 10 " + (int)((100 - health) / 10)); int Index = (int)((int)(100 - health) / 5) + Random.Range(0,2); string Quote1 = '"' + "" + (int)((100 - health) / 10) + "/10 ... " + Quotes1[Index]; string Quote2 = Quotes2[Index] + '"' + " - " + TwitterHandles[Random.Range(0, 10)]; if (Quotes2[Index].Length <= 0) Quote1 += Quote2; //Create labels FLabel Title = new FLabel("font", health > 0 ? "THE GAME CRASHED!" : "THE GAME FINISHED!") { x = Constants.UNITY_CENTER_X, y = Constants.UNITY_CANVAS_BOTTOM + (Constants.UNITY_CANVAS_HEIGHT * 0.78f) }; FLabel Status = new FLabel("font", "Player is at " + (int)health + "% health") { x = Constants.UNITY_CENTER_X, scale = 0.9f }; FLabel Tweet1 = new FLabel("font", Quote1) { x = Constants.UNITY_CENTER_X, y = Constants.UNITY_CENTER_Y, scale = 0.8f }; FLabel Tweet2 = new FLabel("font", Quote2) { x = Constants.UNITY_CENTER_X, scale = 0.8f }; FSprite Background = new FSprite("rect") { x = Constants.UNITY_CENTER_X, y = Constants.UNITY_CENTER_Y, width = Constants.UNITY_CANVAS_WIDTH, height = Constants.UNITY_CANVAS_HEIGHT, color = new Color(0, 0, 0, 0.5f) }; Status.y = Constants.UNITY_CANVAS_BOTTOM + (Constants.UNITY_CANVAS_HEIGHT * 0.78f) - Title.textRect.height + 4; Tweet2.y = Constants.UNITY_CENTER_Y - (Tweet1.textRect.height * 0.8f); //Add AddChild(Background); if (health > 0) AddChild(Status); AddChild(Tweet1); if (Quotes2[Index].Length > 0) AddChild(Tweet2); AddChild(Title); //Create buttons m_ButtonRetry = new FButton("button", "button-hover", "button", "cursor") { x = Constants.UNITY_CENTER_X, y = Constants.UNITY_CANVAS_BOTTOM + (Constants.UNITY_CANVAS_HEIGHT * 0.15f)}; m_ButtonRetry.AddLabel("font", "Restart Game", Color.white); m_ButtonRetry.SignalRelease += onPress; AddChild(m_ButtonRetry); }
public StateTitle(StateGame game) : base(TITLE) { //Initialize m_Game = game; m_Time = BLINK_DURATION * 2; m_StartTime = START_DURATION * 2; //Create background FSprite Background = new FSprite("rect") { x = Futile.screen.halfWidth, y = Futile.screen.halfHeight, width = Futile.screen.width, height = Futile.screen.height, color = new Color(0, 0, 0, 0.5f) }; AddChild(Background); //Create stuff m_Title = new FSprite("logo") { x = Futile.screen.halfWidth, y = Futile.screen.height * 0.6f }; m_Instruction1 = new FLabel("font", "Tap screen to play") { x = Futile.screen.halfWidth, y = Futile.screen.height * 0.2f }; AddChild(m_Instruction1); AddChild(m_Title); //Credit /*FLabel Credit1 = new FLabel("visitor-small", "A game by Karunia Ramadhan, Namira Chaldea, and Raka Mahesa") { x = Futile.screen.halfWidth }; Credit1.y = 4 + (Credit1.textRect.height * 0.5f); AddChild(Credit1);*/ //Play music FSoundManager.PlayMusic("bgm", 1f); }
public void DeSerialize(DataLocal dataLocal) { score = dataLocal.score; highScore = dataLocal.highScore; stateGame = dataLocal.stateGame; countThreshold = dataLocal.countThreshold; level = dataLocal.level; }
public void AddExitAction(Action pCond) { StateGame lastGame = (StateGame)arrState [arrState.Count - 1]; //if (pCond == null) // lastGame.mExitCondition = ReturnFalse; lastGame.mExitAction = pCond; }
public void AddEntryDuringExtCond(string pName, float pTimerSet, string pType, Action pEntry, Action pDuring, Dlgt_V_Bool pCond) { AddAMemberAndEntryAction(pName, pTimerSet, pType, pEntry); StateGame lastGame = (StateGame)arrState [arrState.Count - 1]; lastGame.mDuringAction = pDuring; lastGame.mExitCondition = pCond; }
// Constructor public Game(StateGame state) { if (state == null) { throw new ArgumentNullException("state"); } this.state = state; }
public void ToPlay() { stateGame = StateGame.Playing; textTouchToPlay.gameObject.SetActive(false); showLevelUI.SetActive(false); barUI.SetActive(true); }
// //////////////////////////////////////////////// Initial Setting Members... public void AddAMember(string pName, float pTimerSet, string pType = "Normal") { StateGame newObj; if (pType == "Packet") newObj = new StatePacket (pName, pTimerSet); else newObj = new StateGame (pName, pTimerSet); arrState.Add (newObj); }
void c_showDialogResponse(object sender, DialogEventArgs e) { characterManager.selectCurrent(dialogManager.CurrentDialog.IdCharacter); //select Char sceneManager.selectCurrent(dialogManager.CurrentDialog.IdScene); //select scene //execute the state game currentState = new StartGameState(); currentState.finishState += finishState; currentState.execute(this); }
public void LoseGame() { enableCamFollowPlayer = false; stateGame = StateGame.WinLose; barUI.SetActive(false); showLevelUI.SetActive(false); losePanel.SetActive(true); }
public void SetStateWithNameOf(string pState) { StateGame newState = (StateGame)GetObjectNameOf(pState); if (mCurState != null) { mCurState.Interrupted(newState); } mCurState = newState; }
// //////////////////////////////////////////////// Initial Setting Members... public void AddAMember(string pName, float pTimerSet, string pType = "Normal") { StateGame newObj; // if (pType == "Packet") // newObj = new StatePacket (pName, pTimerSet); // else newObj = new StateGame(pName, pTimerSet); arrState.Add(newObj); }
public void InitGameGrid() { stateGame = StateGame.Waiting; MoveDownGameGrid(); blocks = new Block[WIDTH, HEIGHT]; //CreateNoGameBlockOnGrid(); Debug.Log("HEIGHT =" + HEIGHT); // создаем поле из блоков (высота в 2 раза больше) //HEIGHT = HEIGHT / 2;//приводим к первоначальному виду currentPlayerBlock = CreatePlayerBlock(); nextPlayerBlock = CreateNextPlayerBlock(); }
IEnumerator ChiaBaiCo() { int i = 52; int p = 1; List <GameObject> l = new List <GameObject>(); float z = Random.Range(-15f, 15f); while (i > 0) { GameObject g = Instantiate(Resources.Load("Empty Card") as GameObject, Vector3.zero, Quaternion.identity); l.Add(g); g.transform.eulerAngles = new Vector3(0, 0, z); if (p == 1) { g.transform.DOMove(p1.transform.position, .2f); } else if (p == 2) { g.transform.DOMove(p2.transform.position, .2f); } else if (p == 3) { g.transform.DOMove(p3.transform.position, .2f); } else if (p == 4) { g.transform.DOMove(p4.transform.position, .2f); } i--; p++; if (p >= 5) { p = 1; } yield return(new WaitForSeconds(.1f)); z = Random.Range(-15f, 15f); } yield return(new WaitForSeconds(.2f)); foreach (var item in l) { Destroy(item); } TaoBai(); stateGame = StateGame.ChoiBai; }
void Awake() { Debug.Log("Control"); stateGame = StateGame.IDLE; if (instance == null) { instance = this; } DontDestroyOnLoad(gameObject); }
public void AddAMemberAndEntryAction(string pName, float pTimerSet, string pType, FunctionPointer pEntry) { StateGame newObj; if (pType == "Packet") newObj = new StatePacket (pName, pTimerSet); else newObj = new StateGame (pName, pTimerSet); arrState.Add (newObj); StateGame lastGame = (StateGame)arrState [arrState.Count - 1]; lastGame.mEntryAction = pEntry; }
public RenderingFactory(ContentManager Content) : base(Content) { planet = Content.Load<Model>("ModelTroops/Planet"); gs = Content.ServiceProvider.GetService(typeof(GameState)) as GameState; spriteBatch = Content.ServiceProvider.GetService(typeof(SpriteBatch)) as SpriteBatch; stateGame = Content.ServiceProvider.GetService(typeof(StateGame)) as StateGame; factories = stateGame.getFactories(); for (int i = 0; i < factories.Count; i++) { if (factories[i].ObjectType == 1) { TranslateX((float)factories[i].CurrentPos.X); TranslateZ((float)factories[i].CurrentPos.Z); break; } } /* * setting up the new texture when planet is clicked */ textureList.Add(Content.Load<Texture2D>("ModelTroops/marsTexture")); textureList.Add(Content.Load<Texture2D>("ModelTroops/earthTexture")); textureList.Add(Content.Load<Texture2D>("ModelTroops/venusTexture")); textureList.Add(Content.Load<Texture2D>("ModelTroops/planetTexture3")); textureList.Add(Content.Load<Texture2D>("ModelTroops/planetTexture4")); textureList.Add(Content.Load<Texture2D>("ModelTroops/planetTexture1")); textureList.Add(Content.Load<Texture2D>("ModelTroops/planetTexture2")); boundingSpherePlanet = new BoundingSphere(); foreach (ModelMesh mesh in planet.Meshes) { if (boundingSpherePlanet.Radius == 0) boundingSpherePlanet = mesh.BoundingSphere; else boundingSpherePlanet = BoundingSphere.CreateMerged(boundingSpherePlanet, mesh.BoundingSphere); } }
//OWN VARIABLE public GameState(Difficulty difficulty, ContentManager Content) : base(Content) { this.difficulty = difficulty; switch (difficulty) { case 0: turn = 8; break; case (Difficulty)1: turn = 6; break; case (Difficulty)2: turn = 4; break; } stateGame = Content.ServiceProvider.GetService(typeof(StateGame)) as StateGame; loadNeutralFactories(); }
void Update() { countdown -= Time.deltaTime; progress_bar.transform.position -= new Vector3(0, Time.deltaTime/countdown, 0); float deadLine = -1.1f; //Finish Game if (gameState != StateGame.WAIT) { if (progress_bar.transform.position.y <= deadLine) { GameObject go = CreateSound(audioLose); Destroy(go, audioLose.length); popupText = "Derrota"; Time.timeScale = 0; gameState = StateGame.WAIT; } else if (countCardFinished >= 6) { GameObject go = CreateSound(audioWin); Destroy(go, audioWin.length); popupText = "Vitoria"; Time.timeScale = 0; gameState = StateGame.WAIT; } } //Back to menu if (Input.GetKeyDown(KeyCode.Escape)) { //AutoFade.LoadLevel("Menu", 1f, 1f, Color.black); if (gameState == StateGame.FREE) { GameObject go = CreateSound(audioPause); Destroy(go, audioPause.length); popupText = "Pausado"; Time.timeScale = 0; gameState = StateGame.WAIT; } else { GameObject go = CreateSound(audioPause); Destroy(go, audioPause.length); Time.timeScale = 1; gameState = StateGame.FREE; } } if (progress_bar.transform.position.y <= -0.8) { progress_bar.guiTexture.color = Color.red; } else if (progress_bar.transform.position.y <= -0.5) { progress_bar.guiTexture.color = Color.yellow; } else { progress_bar.guiTexture.color = Color.green; } }
public LaserState(ContentManager Content) { stateGame = Content.ServiceProvider.GetService(typeof(StateGame)) as StateGame; }
public void ChangeState(StateGame state) { this.stategame = state; switch (this.stategame) { case StateGame.Loading: Ingame.gameObject.SetActive(false); MainMenu.gameObject.SetActive(false); EndGameScreen.gameObject.SetActive(false); Shop.gameObject.SetActive(false); HighScore.gameObject.SetActive(false); Loading.gameObject.SetActive(true); break; case StateGame.MainMenu: Ingame.gameObject.SetActive(true); MainMenu.gameObject.SetActive(true); EndGameScreen.gameObject.SetActive(false); Shop.gameObject.SetActive(false); HighScore.gameObject.SetActive(false); Loading.gameObject.SetActive(false); break; case StateGame.InGame: isAdsLoaded = false; Ingame.gameObject.SetActive(true); MainMenu.gameObject.SetActive(false); EndGameScreen.gameObject.SetActive(false); Shop.gameObject.SetActive(false); HighScore.gameObject.SetActive(false); Loading.gameObject.SetActive(false); deltaTime = Time.time - beginTime; break; case StateGame.EndScreen: Ingame.gameObject.SetActive(true); if(!isAdsLoaded && numLoad%10==0) //CallInterstitial(); MainMenu.gameObject.SetActive(false); EndGameScreen.gameObject.SetActive(true); Shop.gameObject.SetActive(false); HighScore.gameObject.SetActive(false); Loading.gameObject.SetActive(false); beginTime = Time.time; isAdsLoaded = true; numLoad++; break; case StateGame.Shopping: Ingame.gameObject.SetActive(true); MainMenu.gameObject.SetActive(false); EndGameScreen.gameObject.SetActive(false); Shop.gameObject.SetActive(true); HighScore.gameObject.SetActive(false); Loading.gameObject.SetActive(false); //beginTime = Time.time; break; case StateGame.HighScore: Ingame.gameObject.SetActive(true); MainMenu.gameObject.SetActive(false); EndGameScreen.gameObject.SetActive(false); Shop.gameObject.SetActive(false); HighScore.gameObject.SetActive(true); Loading.gameObject.SetActive(false); //beginTime = Time.time; break; case StateGame.Notify: //Ingame.gameObject.SetActive(true); MainMenu.gameObject.SetActive(false); EndGameScreen.gameObject.SetActive(false); Shop.gameObject.SetActive(false); HighScore.gameObject.SetActive(false); Loading.gameObject.SetActive(false); //beginTime = Time.time; break; } }
public FactoryState(ContentManager Content) : base(Content) { stateGame = Content.ServiceProvider.GetService(typeof(StateGame)) as StateGame; }
public void SetStateWithNameOf(string pState) { StateGame newState = (StateGame)GetObjectNameOf (pState); if (mCurState != null) mCurState.Interrupted (newState); mCurState = newState; }
// //////////////////////////////////////////////// Action !!! public void DoAction() { // Set Variable Objects.. if (! mCurState.mDidExecute_Entry) { int num = arrVar.Count; for (int i=0; i<num; i++) { AgVariable curVar = arrVar [i]; curVar.SetValueBy (mCurState.mName); } for (int i=0; i<num; i++) { AgVariable curVar = arrVar [num - i - 1]; if (curVar.IsItClearStage (mCurState.mName)) arrVar.RemoveAt (i); } } mCurState = (StateGame)mCurState.Action (); if (mCurState != null) { if (!mCurState.mDidExecute_Entry) // [2012:10:15:MOON] XXX mCurState = (StateGame)mCurState.Action (); } }
void Awake() { Time.timeScale = 1; positionX = Screen.width / 2; positionY = Screen.height / 2; countdown = START_COUNTDOWN; countCardFinished = 0; flippedCards = 0; gameState = StateGame.FREE; card1 = null; card2 = null; progress_bar.transform.position = new Vector3(progress_bar_base.transform.position.x, progress_bar_base.transform.position.y, progress_bar_base.transform.position.z + 0.1f); }