// Use this for initialization void Start() { controller = GetComponent <CharacterController>(); playStates = new PlayStates(); p = gameObject.GetComponent <ParticleSystem> (); //GameObject.FindGameObjectWithTag ("retryButton").SetActive (false); initialPlayerTransform = gameObject.transform; gameObject.GetComponent <MeshRenderer> ().enabled = false; disableRetryCanvas(); //Setiing up high sCore; highScore.text = ((int)PlayerPrefs.GetFloat("HighScore", 0)).ToString(); //Ad Integration /*if (Application.platform == RuntimePlatform.Android) { * AdColony.Ads.Configure ("app92fd13f814ce4b128e", null, zoneID); * }*/ /*AdColony.Ads.OnRequestInterstitial += (InterstitialAd ad) => { * _ad = ad; * Debug.Log("GOt an AD"); * }; * AdColony.Ads.OnExpiring += (InterstitialAd ad) => { * AdColony.Ads.RequestInterstitialAd(ad.ZoneId, null); * * * }; * AdColony.Ads.RequestInterstitialAd (zoneID [0], null); * Debug.Log ("AD REQUESTED");*/ }
public Status(double percentPos, double duration, double totalLength, PlayStates playState) { this.PercentPos = percentPos; this.Duration = duration; this.TotalLength = totalLength; this.PlayState = playState; }
/// <summary> /// 初始化音乐数据类 /// </summary> /// <param name="state">播放状态</param> /// <param name="volume">音量</param> /// <param name="schedule">播放进度</param> /// <param name="isStop">是否是执行STOP方法触发的,否则为播放结束后自动触发</param> public MusicEventArgs(PlayStates state, int volume, double schedule, bool isStop) { playState = state; this.volume = volume; this.schedule = schedule; isStopMethodToStop = isStop; }
public override void Initialize() { m_BehaviorParameters = gameObject.GetComponent <BehaviorParameters>(); team = Team.Blue; m_Transform = new Vector3(transform.position.x + 0f, transform.position.y + 0f, transform.position.z + 0f); m_Rigidbody = GetComponent <Rigidbody>(); m_Ball = Ball.GetComponent <Rigidbody>(); m_Rigidbody = GetComponent <Rigidbody>(); m_Ball = Ball.GetComponent <Rigidbody>(); var ps = new PlayStates { CarAgent = m_Rigidbody, startingPosition = transform.position, CarAgentScript = this, }; area.playStates.Add(ps); m_PlayerIndex = area.playStates.IndexOf(ps); ps.playerIndx = m_PlayerIndex; areaBounds = Stadium.GetComponent <Collider>().bounds; }
public void ChangePlayState(PlayStates state) { playState = state; if (playStateChanged != null) { playStateChanged(); } }
public GenericPlayerControl() { Logger.Debug("Initializing"); PlayState = PlayStates.NoVideo; InitializeComponent(); }
/// <summary> /// 触发事件 /// </summary> protected virtual void OnStateChangedEvent(MusicEventArgs e) { if (StateChanged != null) { OldState = PlayState; //StateChanged(this, e);//执行事件 controlObject.Invoke(StateChanged, this, e); } }
/// <summary> /// Checks if the state has changed and notifies the smartthings endpoint. /// </summary> /// <param name="state"></param> /// <param name="forced">Overrides the check vs previous state</param> public void OnStateRetrieved(PlayStates state, string mediaType, bool forced = false) { if (Program.DebugLevel >= 2) { Console.WriteLine(UserName + "@'" + PlayerName + "' " + Type + "=> StateRetrieved(" + state.ToString() + ", " + mediaType + ")"); } //Something weird has happened.. => abort if (state == PlayStates.UNKNOWN) { return; } //No new state or type => abort unless it's a forced update else if (state == CurrentState && mediaType == Type && !forced) { return; } //We got a new state/media else { CurrentState = state; Type = mediaType; } if (Program.DebugLevel >= 1) { Console.WriteLine(UserName + "@'" + PlayerName + "' (" + IPAdd + ") Changed state to: " + state.ToString() + ", mediaType is " + mediaType); } //Select the correct endpoint Delay = Config.GetDelayFor(CurrentState, Type); if (Delay > 0) { if (Program.DebugLevel >= 1) { Console.WriteLine(" >Delay: " + Delay); } } else { string endpoint = CreateEndpointUrl(); Program.SendGetRequest(endpoint); if (CurrentState == PlayStates.STOP) { RequestListRemoval = true; } } if (stateDelayThread == null) { stateDelayThread = new Thread(() => ProcessStateDelay()); stateDelayThread.Start(); } }
private void SetPlayState(PlayStates newState) { if (CurrentStatus.PlayState == newState) { return; } CurrentStatus.PlayState = newState; OnPlayStateChanged(new PlayStateChangedEventArgs(newState)); }
// Use this for initialization void Start() { _timer = 300.0f; gameState = States.PLAYING; playState = PlayStates.NORMAL; centreCircle = ball.transform.position; musicPlayer = GetComponent <AudioSource>(); whistleSource = gameObject.AddComponent <AudioSource>(); whistleSource.clip = whistleClip; }
public void BattleTrigger() { if (currentPlayState != PlayStates.BATTLING) { currentPlayState = PlayStates.BATTLING; } else { currentPlayState = PlayStates.MAIN; } }
private void SetPlayState(PlayStates newState, bool callPlayStateChanged) { if (Info.Current.PlayState == newState) { return; } Info.Current.PlayState = newState; if (callPlayStateChanged) { OnPlayStateChanged(new EventArgs()); } }
public PlayPanel(int X, int Y) { DoubleBuffered = true; _XCount = X; _YCount = Y; _MySquareCount = X * Y; _BlockPadding = 5; _PlayBlockWidth = 100; _FPS = 60; _SetDestinations = false; _NewGame = true; _Direction = Directions.NONE; _PlayState = PlayStates.NONE; _State = States.STOPPED; _Stopwatch = new Stopwatch(); _MoveQueue = new Queue <Directions>(); _PlayBlockArray = new PlayBlock[X, Y]; AddPlayBlocks(); int ttlWidth = (((_BlockPadding * 2) + _PlayBlockWidth) * X) + _BlockPadding; int ttlHeight = (((_BlockPadding * 2) + _PlayBlockWidth) * Y) + _BlockPadding; Width = ttlWidth; Height = ttlHeight; //ttlWidth; Size = new Size(Width, Height); MinimumSize = Size; BackColor = Color.FromArgb(102, 102, 102); _MainThread = new Thread(GameLoop); _Random = new Random(); _DB = new LocalDB(); _ScoreDT = new ScoreDT(); InitializeComponents(); }
void PP_PlayState_Changed(PlayPanel sender, PlayStates playstate) { if (playstate == PlayStates.GAMEOVER) { tsPause.Enabled = false; } else if (playstate == PlayStates.PLAYING) { tsPause.Text = "Pause"; tsPause.Enabled = true; } else if (playstate == PlayStates.PAUSED) { tsPause.Text = "Continue"; tsPause.Enabled = true; } else if (playstate == PlayStates.WIN) { tsPause.Text = "Pause"; tsPause.Enabled = false; } }
void Update() { if (gameState == States.PLAYING) { if (_timer < 5.0f && _timer > 0.0f) { _timer -= Time.deltaTime * 0.5f; } else { _timer -= Time.deltaTime; } if (_timer < 120.0f && _timer > 60.0f) { playState = PlayStates.RUSH; musicPlayer.pitch = 1.1f; } } if (playState == PlayStates.RUSH && _timer <= 60.0f) { playState = PlayStates.NORMAL; musicPlayer.pitch = 1.0f; } if (_timer < 0.0f && gameState == States.PLAYING) { if (_team1Score == _team2Score) { playState = PlayStates.OVERTIME; } else { UpdateState(States.GAMEOVER, null); } } }
// <-- PlayState Functions --> // private void CreatePlayStateUI() { _loadedPlayState = State.playState; switch (State.playState) { case PlayStates.NONE: _loadedPlayStateUI = null; return; case PlayStates.InGame: _loadedPlayStateUI = InGame; break; case PlayStates.Paused: _loadedPlayStateUI = Paused; break; } Debug.Log(_loadedPlayStateUI.name); // Create UI _loadedPlayStateUI = Instantiate(_loadedPlayStateUI, BaseCanvas, false); }
private void axWMP_PlayStateChange(object sender, AxWMPLib._WMPOCXEvents_PlayStateChangeEvent e) { if (axWMP.playState == WMPLib.WMPPlayState.wmppsBuffering && (axWMP.currentMedia.duration != 0)) { //picDurationSeek.Location = new Point(picDurationBar.Location.X, picDurationSeek.Location.Y); currentPositionTimer.Stop(); double duration = axWMP.currentMedia.duration; pixelsPerSecond = duration / picDurationBar.Width; currentPositionTimer.Interval = 100; currentPositionTimer.Tick += new EventHandler(currentPositionTimer_Tick); currentPositionTimer.Start(); } else if (axWMP.playState == WMPLib.WMPPlayState.wmppsMediaEnded) { MediaState = PlayStates.Stopped; lblNowPlaying.Text = ""; lblNowPlayingOther.Text = ""; lblCurrentTime.Text = ""; picPlayButton.Image = Properties.Resources.PlayButton; picDurationSeek.Location = new Point(picDurationBar.Location.X, picDurationSeek.Location.Y-8); currentPositionTimer.Stop(); changeMediaAfterLastOneFinishes(); //...and the beat goes on! } else if (axWMP.playState == WMPLib.WMPPlayState.wmppsReady && axWMP.currentMedia != null) { axWMP.Ctlcontrols.play(); } else if (axWMP.playState == WMPLib.WMPPlayState.wmppsPaused && axWMP.currentMedia != null) { currentPositionTimer.Stop(); } else if (axWMP.playState == WMPLib.WMPPlayState.wmppsPlaying && axWMP.currentMedia != null) { currentPositionTimer.Start(); } else if (axWMP.playState == WMPLib.WMPPlayState.wmppsTransitioning && axWMP.currentMedia != null) { picDurationSeek.Location = new Point(picDurationBar.Location.X, picDurationBar.Location.Y-4); } }
void Start() { ps = PlayStates.MapState; }
private void LoadMedia(Track newTrack) { //Load the track: axWMP.currentMedia = axWMP.newMedia(newTrack.Link); MediaState = PlayStates.Playing; //Sort out any GUI settings required: picPlayButton.Image = Properties.Resources.PauseButton; lblNowPlaying.Text = NowPlaying.Title; lblNowPlayingOther.Text = NowPlaying.Artist + " - " + NowPlaying.Album; axWMP.Ctlcontrols.play(); }
private void PlayMedia() { if (axWMP.currentMedia != null) { axWMP.Ctlcontrols.play(); MediaState = PlayStates.Playing; picPlayButton.Image = Properties.Resources.PauseButton; } }
private void SetPlayState(PlayStates newPlayState) { switch (newPlayState) { case PlayStates.Unidentified: seekBar.Enabled = false; rewindButton.Enabled = false; playButton.Enabled = false; playToolButton.Enabled = false; break; case PlayStates.Playing: playButton.Image = Properties.Resources.default_pause; playToolButton.Icon = Properties.Resources.tool_pause; playToolStripMenuItem.Text = "&Pause"; playMenuItem.Text = "&Pause"; playToolButton.Tooltip = "Pause"; break; case PlayStates.Paused: playButton.Image = Properties.Resources.default_play; playToolButton.Icon = Properties.Resources.tool_play; playToolStripMenuItem.Text = "&Play"; playMenuItem.Text = "&Play"; playToolButton.Tooltip = "Play"; break; case PlayStates.Stopped: seekBar.Value = 0; playButton.Image = Properties.Resources.default_play; playToolButton.Icon = Properties.Resources.tool_play; playToolStripMenuItem.Text = "&Play"; playMenuItem.Text = "&Play"; playToolButton.Tooltip = "Play"; durationLabel.Text = "STOPPED"; break; case PlayStates.Ended: MediaEnded(); break; } }
public void SetPlayback(PlayStates p) { isPlaying = p; HUD.main.toolGroup.gameObject.SetActive(p != PlayStates.Playing); }
private void handlePlayStateChanged(object sender, PlayStateChangedEventArgs e) { Logger.Info("PlayState: " + e.PlayState); this.PlayState = e.PlayState; if (e.PlayState == PlayStates.Playing || e.PlayState == PlayStates.Ready || e.PlayState == PlayStates.Stopped) { if (wmPlayer != null) wmPlayer.Show(); if (qtPlayer != null) qtPlayer.Show(); loadingLabel.Visible = false; } if (e.PlayState == PlayStates.Transitioning && !isClosing) { loadingLabel.Visible = true; if (wmPlayer != null) wmPlayer.Hide(); if (qtPlayer != null) qtPlayer.Hide(); } if (PlayStateChanged != null) PlayStateChanged(sender, e); }
public void ChangePlayState(PlayStates _state) { State.playState = _state; UI.UpdateUI(); }
private void SetPlayState(PlayStates newState) { if (CurrentStatus.PlayState == newState) return; CurrentStatus.PlayState = newState; OnPlayStateChanged(new PlayStateChangedEventArgs(newState)); }
public PlayStateChangedEventArgs(PlayStates playState) { PlayState = playState; }
void Awake() { _isPlaying = PlayStates.Pause; isPlaying = PlayStates.Stop; }
/// <summary> /// Checks if the state has changed and notifies the smartthings endpoint. /// </summary> /// <param name="state"></param> /// <param name="forced">Overrides the check vs previous state</param> public void OnStateRetrieved(PlayStates state, string mediaType, bool forced=false) { if (Program.DebugLevel >= 2) Console.WriteLine(UserName + "@'" + PlayerName + "' " + Type + "=> StateRetrieved(" + state.ToString() + ", " + mediaType + ")"); //Something weird has happened.. => abort if (state == PlayStates.UNKNOWN) return; //No new state or type => abort unless it's a forced update else if (state == CurrentState && mediaType == Type && !forced) return; //We got a new state/media else { CurrentState = state; Type = mediaType; } if (Program.DebugLevel >= 1) Console.WriteLine(UserName + "@'" + PlayerName + "' Changed state to: " + state.ToString() + ", mediaType is " + mediaType); //Select the correct endpoint Delay = Config.GetDelayFor(CurrentState, Type); if (Delay > 0) { if (Program.DebugLevel >= 1) Console.WriteLine(" >Delay: " + Delay); } else { string endpoint = CreateEndpointUrl(); Program.SendGetRequest(endpoint); if (CurrentState == PlayStates.STOP) RequestListRemoval = true; } if (stateDelayThread == null) { stateDelayThread = new Thread(() => ProcessStateDelay()); stateDelayThread.Start(); } }
/// <summary> /// ctor. /// </summary> /// <param name="newState"></param> internal MediaEventArgs(PlayStates newState) { _newState = newState; }
public Status() { PlayState = PlayStates.Unidentified; }
void Awake() { currentPlayState = PlayStates.MAIN; }
public void SetPlayState(PlayStates PlayState) { if (InvokeRequired) { Invoke(new _SetPlayState_Del(SetPlayState), PlayState); } else { bool changed = false; if (PlayState == PlayStates.PAUSED) { if (_PlayState == PlayStates.PLAYING) { _PlayState = PlayStates.PAUSED; _PausePanel.Text = "PAUSED"; _PausePanel.Visible = true; changed = true; } } else if (PlayState == PlayStates.PLAYING) { if (_PlayState == PlayStates.PAUSED || _PlayState == PlayStates.WIN) { _PlayState = PlayStates.PLAYING; _PausePanel.Visible = false; changed = true; } else { _PlayState = PlayStates.PLAYING; _CreateNewSquare = false; _NewGame = false; NewGame(); //CreateTest(); _PausePanel.Visible = false; changed = true; } } else if (PlayState == PlayStates.GAMEOVER) { if (_PlayState == PlayStates.PLAYING) { _PlayState = PlayStates.GAMEOVER; _PausePanel.Text = "GAME OVER"; _PausePanel.Visible = true; changed = true; } } else if (PlayState == PlayStates.WIN) { if (_PlayState == PlayStates.PLAYING) { _PlayState = PlayStates.WIN; _PausePanel.Text = "WIN"; _PausePanel.Visible = true; changed = true; } } else { changed = false; } OnPlayStateChanged(changed); } }