public GameEffect() : base("effect") { mActiveTimer = new CustomTimer(); mLifeTimer = new CustomTimer(); mPlayState = PLAY_STATE.PS_STOP; }
public txUGUIVideo() { mAutoShowOrHide = true; mNextState = PLAY_STATE.PS_NONE; mNextRate = 1.0f; mFileName = null; }
public void play() { mPlayState = PLAY_STATE.PLAY; if (mParticleSystems == null) { return; } int particleCount = mParticleSystems.Length; for (int i = 0; i < particleCount; ++i) { mParticleSystems[i].Play(); } // 如果时间已经被缩放了,而且有状态机已经设置了忽略时间缩放,则需要重新再设置一次,否则仍然会受到时间缩放影响 // 因为Animator在时间为0时设置updateMode为UnscaledTime是不会立即生效的 if (!isFloatEqual(Time.timeScale, 1.0f) && mEffectAnimators != null && mEffectAnimators.Length > 0) { int animatorCount = mEffectAnimators.Length; for (int i = 0; i < animatorCount; ++i) { Animator item = mEffectAnimators[i]; if (item != null && item.updateMode == AnimatorUpdateMode.UnscaledTime) { item.updateMode = AnimatorUpdateMode.Normal; item.updateMode = AnimatorUpdateMode.UnscaledTime; } } } }
public txNGUIVideo() { mFileName = EMPTY_STRING; mNextRate = 1.0f; mNextState = PLAY_STATE.PS_NONE; mAutoShowOrHide = true; }
public ComponentKeyFrameBase() { mLoop = true; mFullOnce = true; mOnceLength = 1.0f; mPlayState = PLAY_STATE.STOP; }
public void setPlayState(PLAY_STATE state, bool autoShowOrHide = true) { if (isEmpty(mFileName)) { return; } if (mReady) { if (state == PLAY_STATE.PLAY) { play(autoShowOrHide); } else if (state == PLAY_STATE.PAUSE) { pause(); } else if (state == PLAY_STATE.STOP) { stop(autoShowOrHide); } } else { mNextState = state; mAutoShowOrHide = autoShowOrHide; } }
private void _next_turn() { ROTATOR.SetActive(true); last_strength = 0; PLAYER.transform.position = BALL.transform.position; play_state = PLAY_STATE.waiting_for_player; }
private void _handle_left_click() { if (Input.GetMouseButtonDown(0)) { left_mouse_clicked = true; left_mouse_x = Input.mousePosition.x; left_mouse_y = Input.mousePosition.y; } else if (Input.GetMouseButtonUp(0) && left_mouse_clicked) { play_state = PLAY_STATE.hitting_ball; timer = HIT_TIMER; left_mouse_clicked = false; left_mouse_x = 0; left_mouse_y = 0; } else if (left_mouse_clicked) { float strength = Math.Min(Math.Abs(Input.mousePosition.y - left_mouse_y) / 15, 30); PLANE.transform.localScale = new Vector3(strength * POINTER_LENGTH, 1, POINTER_LENGTH); PLANE.transform.localPosition = new Vector3(PLANE.transform.localScale.x * 5, BALL.transform.localScale.y / -2.1f, 0); GOLF_CLUB.transform.Rotate(0, strength - last_strength, 0); last_strength = strength; } }
public void play() { mPlayState = PLAY_STATE.PS_PLAY; if (mParticleSystems == null) { return; } foreach (var item in mParticleSystems) { item.Play(); } // 如果时间已经被缩放了,而且有状态机已经设置了忽略时间缩放,则需要重新再设置一次,否则仍然会受到时间缩放影响 // 因为Animator在时间为0时设置updateMode为UnscaledTime是不会立即生效的 if (!isFloatEqual(Time.timeScale, 1.0f) && mEffectAnimators != null && mEffectAnimators.Length > 0) { foreach (var item in mEffectAnimators) { if (item != null && item.updateMode == AnimatorUpdateMode.UnscaledTime) { item.updateMode = AnimatorUpdateMode.Normal; item.updateMode = AnimatorUpdateMode.UnscaledTime; } } } }
public override void resetProperty() { base.resetProperty(); mPlayState = PLAY_STATE.STOP; mRotateAcceleration = Vector3.zero; mRotateSpeed = Vector3.zero; mCurRotation = Vector3.zero; }
void pause() { this.current_play_state = PLAY_STATE.PAUSE; for (int i = 0; i < this.live_objects.Count; ++i) { this.live_objects[i].GetComponent <CMovableObject>().update_speed_ratio(0.0f); } }
public override void resetProperty() { base.resetProperty(); mLerpingCallBack = null; mLerpDoneCallBack = null; mPlayState = PLAY_STATE.NONE; mLerpSpeed = 0.0f; }
public void pause() { mPlayState = PLAY_STATE.PS_PAUSE; foreach (var item in mParticleSystems) { item.Pause(); } }
public virtual void stop(bool force = false) { // 如果已经是停止的状态,并且不是要强制停止,则不再执行 if (mPlayState == PLAY_STATE.STOP && !force) { return; } mPlayState = PLAY_STATE.STOP; }
public myUGUIVideo() { mVideoEventCallback = onVideoEvent; mAutoShowOrHide = true; mNextState = PLAY_STATE.NONE; mNextRate = 1.0f; mFileName = null; mEnable = true; }
public void stop() { mPlayState = PLAY_STATE.PS_STOP; foreach (var item in mParticleSystems) { item.Stop(false, ParticleSystemStopBehavior.StopEmittingAndClear); } setIgnoreTimeScale(mNextIgnoreTimeScale); }
public ComponentKeyFrameBase() { mTremblingName = null; mLoop = true; mFullOnce = true; mAmplitude = 1.0f; mOnceLength = 1.0f; // 关键帧长度默认为1秒 mPlayState = PLAY_STATE.PS_STOP; clearCallback(); }
public void pause() { mPlayState = PLAY_STATE.PAUSE; int count = mParticleSystems.Length; for (int i = 0; i < count; ++i) { mParticleSystems[i].Pause(); } }
public void stop(bool resetStartIndex = true, bool callback = true, bool isBreak = true) { mPlayState = PLAY_STATE.STOP; if (resetStartIndex) { setCurFrameIndex(mStartIndex); } // 中断序列帧播放时调用回调函数,只在非循环播放时才调用 mPlayEndCallback?.Invoke(this, callback, isBreak); }
protected LOOP_MODE mLoopMode; // 循环方式 public AnimControl() { mInterval = 0.033f; mEndIndex = -1; mPlayDirection = true; mAutoResetIndex = true; mUseTextureSelfSize = true; mLoopMode = LOOP_MODE.ONCE; mPlayState = PLAY_STATE.STOP; }
void resume() { for (int i = 0; i < this.live_objects.Count; ++i) { this.live_objects[i].GetComponent <CMovableObject>().update_speed_ratio(this.skill_manager.speed_ratio); } this.current_play_state = PLAY_STATE.PLAYING; this.prev_generated_time += CEffectManager.FLY_DURATION; }
public virtual void play() { if (isFloatZero(mLerpSpeed)) { stop(); return; } mPlayState = PLAY_STATE.PLAY; update(0.0f); }
public void stop() { mPlayState = PLAY_STATE.STOP; int count = mParticleSystems.Length; for (int i = 0; i < count; ++i) { mParticleSystems[i].Stop(false, ParticleSystemStopBehavior.StopEmittingAndClear); } setIgnoreTimeScale(mNextIgnoreTimeScale); }
public ComponentLinear(Type type, string name) : base(type, name) { mPlayState = PLAY_STATE.PS_STOP; mStart = 0.0f; mTarget = 1.0f; mCurValue = 1.0f; mTime = 0.0f; mCurTime = 0.0f; }
public virtual void play(string name, bool loop, float onceLength, float offset, bool fullOnce, float amplitude) { if (!isActive()) { return; } setTrembling(name); mKeyFrame = mKeyFrameManager.getKeyFrame(mTremblingName); if (onceLength < 0.0f) { logError("onceLength can not be negative!"); return; } if (mKeyFrame == null || isFloatZero(onceLength)) { mStopValue = 0.0f; // 停止并禁用组件 afterApplyTrembling(true); return; } else { mStopValue = mKeyFrame.Evaluate(mKeyFrame.length); } if (offset > onceLength) { logError("offset must be less than onceLength!"); } mOnceLength = onceLength; mPlayState = PLAY_STATE.PS_PLAY; mLoop = loop; mOffset = offset; mCurrentTime = mOffset; mAmplitude = amplitude; mPlayedTime = 0.0f; if (mLoop) { mPlayLength = -1.0f; } else { if (fullOnce) { mPlayLength = mOnceLength; } else { mPlayLength = mOnceLength - offset; } } update(0.0f); }
// Update is called once per frame void Update() { switch (play_state) { case PLAY_STATE.waiting_for_player: ball_rb.velocity = Vector3.zero; _handle_left_click(); _handle_right_click(); _handle_arrow_keys(); _handle_ws(); _handle_ad(); break; case PLAY_STATE.hitting_ball: if (timer > 0) { GOLF_CLUB.transform.Rotate(0, -1 * last_strength * Time.deltaTime / HIT_TIMER, 0); timer = timer - Time.deltaTime; } else { float thrust = last_strength * 30; ball_rb.AddForce(ROTATOR.transform.right * thrust); play_state = PLAY_STATE.ball_rolling; moving_club = true; } break; case PLAY_STATE.ball_rolling: if (timer > -1 * HIT_TIMER) { GOLF_CLUB.transform.Rotate(0, -1 * last_strength * Time.deltaTime / HIT_TIMER, 0); timer = timer - Time.deltaTime; } else if (timer > -4 * HIT_TIMER) { timer = timer - Time.deltaTime; } else if (moving_club) { moving_club = false; GOLF_CLUB.transform.Rotate(0, last_strength, 0); ROTATOR.SetActive(false); } else if (ball_rb.velocity.magnitude < BALL_STOPPING_SPEED) { ball_rb.velocity = Vector3.zero; _next_turn(); } break; } }
public Movie() { id = Manager.GetNewIdentifier(); name = null; path = null; textureName = null; texture = null; videoSize = Size.Empty; textureSize = Size.Empty; ps = PLAY_STATE.INIT; altImage = null; altImageShown = false; }
public override void resetProperty() { base.resetProperty(); mParticleSystems = null; mIsDead = false; mMaxActiveTime = -1.0f; mLifeTimer.stop(); mActiveTimer.stop(); mExistedObject = false; mEffectDestroyCallback = null; mDestroyUserData = null; mPlayState = PLAY_STATE.PS_STOP; }
/// <summary> /// 开始游戏 /// </summary> public void RunGame() { if (playState == PLAY_STATE.PAUSE) { playState = PLAY_STATE.PLAYING; } else { audioSource.clip = songInfo.songClip; CheckHandCallback(); } }
private void GameOver(bool failed = false) { playState = PLAY_STATE.GAME_OVER; if (failed) { gameOverUI.SetActive(true); Sounder.instance.Play("游戏失败音效"); } else { clear.SetActive(true); } }
public virtual bool Pause() { ps = PLAY_STATE.PAUSED; return true; }
public virtual bool Play() { ps = PLAY_STATE.RUNNING; return true; }
public virtual bool Stop() { ps = PLAY_STATE.STOPPED; return true; }
public virtual void Unload() { ps = PLAY_STATE.UNLOADED; return; }