// Update is called once per frame void Update() { // if the object wasnt found if (timebar == null) { // find the object based on type timebar = FindObjectOfType <TimeBar>(); } // as long as timer is intended to be running if (GameManager.TheTimer) { // subtract the timeleft from deltatime*6, to still be fast regardless of timescale GameManager.timeLeft -= Time.deltaTime * 6; // set the bar accordingly to the time left timebar.SetSize(GameManager.timeLeft / 5); // if time runs out if (GameManager.timeLeft < 0) { // reset timescaleadjuster to normal and disable the timer GameManager.timeScaleAdjuster = 1f; GameManager.TheTimer = false; } } // if there is no timer needed to be running, but the bar isnt full else if (GameManager.timeLeft <= 5) { // recharge the timer slowly and set the bar accordingly GameManager.timeLeft += Time.deltaTime * 1 / 2; timebar.SetSize(GameManager.timeLeft / 5); } }
private void Awake() { // Setting up references. healthBar = GameObject.Find("HealthBar").GetComponent <HealthBar>(); timeBar = GameObject.Find("TimeBar").GetComponent <TimeBar>(); m_GroundCheck = transform.Find("GroundCheck"); m_CeilingCheck = transform.Find("CeilingCheck"); m_Anim = GetComponent <Animator>(); m_Rigidbody2D = GetComponent <Rigidbody2D>(); m_Collider = GetComponent <BoxCollider2D>(); m_crystals = 0; m_currentHealth = GameValues.getPlayerHealth(); m_currentTime = GameValues.getPlayerTime(); m_weapon = GameObject.Find("gun"); m_inventory = new Inventory(); // ui_Inventory.setInventory(m_inventory); playerAudio = GetComponent <AudioSource>(); healthBar.setMaxHealth(m_maxHealth); healthBar.setHealth(m_currentHealth); timeBar.setMaxTime(m_maxTime); if (GameValues.hasGun) { Instantiate(m_weapon, this.gameObject.transform.GetChild(3).position, this.gameObject.transform.GetChild(3).rotation).transform.parent = this.gameObject.transform; Destroy(m_weapon); } }
private void applyFrameTime(FrameStatistics frame) { TimeBar timeBar = timeBars[TimeBarIndex]; TextureUpload upload = new TextureUpload(HEIGHT * 4, textureBufferStack) { Bounds = new Rectangle(TimeBarX, 0, 1, HEIGHT) }; int currentHeight = HEIGHT; for (int i = 0; i <= (int)PerformanceCollectionType.Empty; i++) { currentHeight = addArea(frame, (PerformanceCollectionType)i, currentHeight, upload.Data, AMOUNT_MS_STEPS); } timeBar.Sprite.Texture.SetData(upload); timeBars[TimeBarIndex].MoveToX((WIDTH - TimeBarX)); timeBars[(TimeBarIndex + 1) % timeBars.Length].MoveToX(-TimeBarX); currentX = (currentX + 1) % (timeBars.Length * WIDTH); foreach (Drawable e in timeBars[(TimeBarIndex + 1) % timeBars.Length].Children) { if (e is Box && e.DrawPosition.X <= TimeBarX) { e.Expire(); } } }
void Start() { instance = this; timeLeft = totalTime; origScale = transform.localScale.y; //startTimer(); }
private void applyFrameTime(FrameStatistics frame) { TimeBar timeBar = timeBars[timeBarIndex]; TextureUpload upload = new TextureUpload(HEIGHT * 4, textureBufferStack) { Bounds = new RectangleI(timeBarX, 0, 1, HEIGHT) }; int currentHeight = HEIGHT; for (int i = 0; i < FrameStatistics.NUM_PERFORMANCE_COLLECTION_TYPES; i++) { currentHeight = addArea(frame, (PerformanceCollectionType)i, currentHeight, upload.Data, amount_ms_steps); } addArea(frame, null, currentHeight, upload.Data, amount_ms_steps); timeBar.Sprite.Texture.SetData(upload); timeBars[timeBarIndex].MoveToX(WIDTH - timeBarX); timeBars[(timeBarIndex + 1) % timeBars.Length].MoveToX(-timeBarX); currentX = (currentX + 1) % (timeBars.Length * WIDTH); foreach (Drawable e in timeBars[(timeBarIndex + 1) % timeBars.Length].Children) { if (e is Box && e.DrawPosition.X <= timeBarX) { e.Expire(); } } }
private void applyFrameTime(FrameStatistics frame) { TimeBar timeBar = timeBars[timeBarIndex]; TextureUpload upload = new TextureUpload(height * 4, textureBufferStack) { Bounds = new Rectangle(timeBarX, 0, 1, height) }; int currentHeight = height; for (int i = 0; i <= (int)PerformanceCollectionType.Empty; i++) { currentHeight = addArea(frame, (PerformanceCollectionType)i, currentHeight, upload.Data, amount_ms_steps); } timeBar.Sprite.Texture.SetData(upload); timeBars[timeBarIndex].MoveToX(width - timeBarX); timeBars[(timeBarIndex + 1) % timeBars.Length].MoveToX(-timeBarX); currentX = (currentX + 1) % (timeBars.Length * width); foreach (Drawable e in timeBars[(timeBarIndex + 1) % timeBars.Length].Children) { if (e is Box && e.DrawPosition.X <= timeBarX) { e.Expire(); } } }
public override void Awake() { base.Awake(); //取得管理者的邏輯物件 timeBar = nadiSystemEditor.timeBar; //取得GUI組件 guiTimeBar = GetComponent <GUITimeBar>(); }
public MainWindow() { InitializeComponent(); AssignHandlersToUIControlEvents(); musicPlayer.SongLoaded += MusicPlayerSongLoadedHandler; musicPlayer.PlayTestMusic(); TimeBar.InitializeTimers(); }
void Start() { // WordBox 생성 wbm = new WordBoxManager(); wbm.CreateBtns(SaveLevel.level, gameObject); // 타이머 생성 timeBar = new TimeBar(); timeBar.Make(); SaveTimeState.timeOut = false; // 시간 초과 여부 판단 if (wbm.Status() == false) { NewStart(); } }
void Start() { if (control == null) { control = this; } else { Destroy(this.gameObject); } progressBarImage.type = Image.Type.Filled; progressBarImage.fillMethod = Image.FillMethod.Horizontal; progressBarImage.fillAmount = 0.5f; }
private Timebar MapTimeBar(TimeBar timeBar) { return(new Timebar { CloseAsk = Convert.ToDecimal(timeBar.CloseAsk), CloseAskYield = Convert.ToDecimal(timeBar.CloseAskYield), CloseBid = Convert.ToDecimal(timeBar.CloseBid), CloseDiscountFactor = Convert.ToDecimal(timeBar.CloseDiscountFactor), CloseYield = Convert.ToDecimal(timeBar.CloseYield), CloseZeroYield = Convert.ToDecimal(timeBar.CloseZeroYield), EpochUtc = timeBar.EpochUtc.ToDateTime(), High = Convert.ToDecimal(timeBar.High), HighAsk = Convert.ToDecimal(timeBar.HighAsk), HighAskYield = Convert.ToDecimal(timeBar.HighAskYield), HighBid = Convert.ToDecimal(timeBar.HighBid), HighBidYield = Convert.ToDecimal(timeBar.HighBidYield), HighDiscountFactor = Convert.ToDecimal(timeBar.HighDiscountFactor), HighYield = Convert.ToDecimal(timeBar.HighYield), HighZeroYield = Convert.ToDecimal(timeBar.HighZeroYield), Last = Convert.ToDecimal(timeBar.Last), Low = Convert.ToDecimal(timeBar.Low), LowAsk = Convert.ToDecimal(timeBar.LowAsk), LowAskYield = Convert.ToDecimal(timeBar.LowAskYield), LowBid = Convert.ToDecimal(timeBar.LowBid), LowBidYield = Convert.ToDecimal(timeBar.LowBidYield), LowDiscountFactor = Convert.ToDecimal(timeBar.LowDiscountFactor), LowYield = Convert.ToDecimal(timeBar.LowYield), LowZeroYield = Convert.ToDecimal(timeBar.LowZeroYield), NoAsks = Convert.ToDecimal(timeBar.NoAsks), NoAskYields = Convert.ToDecimal(timeBar.NoAskYields), NoBids = Convert.ToDecimal(timeBar.NoBids), NoBidYields = Convert.ToDecimal(timeBar.NoBidYields), NoDiscountFactors = Convert.ToDecimal(timeBar.NoDiscountFactors), NoTrades = Convert.ToDecimal(timeBar.NoTrades), NoYields = Convert.ToDecimal(timeBar.NoYields), NoZeroYields = Convert.ToDecimal(timeBar.NoZeroYields), Open = Convert.ToDecimal(timeBar.Open), OpenAsk = Convert.ToDecimal(timeBar.OpenAsk), OpenAskYield = Convert.ToDecimal(timeBar.OpenAskYield), OpenBid = Convert.ToDecimal(timeBar.OpenBid), OpenBidYield = Convert.ToDecimal(timeBar.OpenBidYield), OpenDiscountFactor = Convert.ToDecimal(timeBar.OpenDiscountFactor), OpenYield = Convert.ToDecimal(timeBar.OpenYield), OpenZeroYield = Convert.ToDecimal(timeBar.OpenZeroYield), Volume = Convert.ToDecimal(timeBar.Volume), CurrencyCode = timeBar.CurrencyCode }); }
// Use this for initialization void Start() { m_eCurrentState = InitialState; m_cmpTimer = Opener.GetComponent <TimeBar>(); if (TextDoor != null) { TextDoor.SetActive(false); } if (m_eCurrentState == eDoorState.eOpened) { DoorPivot.transform.Rotate(DoorPivot.transform.up, OpenningAngle); } }
protected override void Update() { base.Update(); FrameStatistics frame; while (monitor.PendingFrames.TryDequeue(out frame)) { if (processFrames) { foreach (int gcLevel in frame.GarbageCollections) { addEvent(gcLevel); } TimeBar timeBar = timeBars[TimeBarIndex]; TextureUpload upload = new TextureUpload(HEIGHT * 4, textureBufferStack) { Bounds = new Rectangle(TimeBarX, 0, 1, HEIGHT) }; int currentHeight = HEIGHT; for (int i = 0; i <= (int)PerformanceCollectionType.Empty; i++) { currentHeight = addArea(frame, (PerformanceCollectionType)i, currentHeight, upload.Data); } timeBar.Sprite.Texture.SetData(upload); timeBars[TimeBarIndex].MoveToX((WIDTH - TimeBarX)); timeBars[(TimeBarIndex + 1) % timeBars.Length].MoveToX(-TimeBarX); currentX = (currentX + 1) % (timeBars.Length * WIDTH); foreach (Drawable e in timeBars[(TimeBarIndex + 1) % timeBars.Length].Children) { if (e is Box && e.Position.X <= TimeBarX) { e.Expire(); } } } monitor.FramesHeap.FreeObject(frame); } }
/**** 유니티 함수 ****/ private void Awake() { inGameCanvas = GameObject.Find("InGameObject"); // 캔버스 설정 animator = GetComponent <Animator>(); // 애니메이터 설정 findObject = GetComponent <FindObject>(); // 탐지 오브젝트 설정 timeBar = GetComponent <TimeBar>(); // 타임바 설정 playerCamera = GameObject.Find("PlayerCamera").GetComponent <PlayerCamera>(); // 카메라 설정 playerState = GetComponent <PlayerState>(); // 플레이어 상태 설정 boxPlayerMove = GetComponent <PlayerMove>(); //플레이어 이동 스크립트 OriginalCameraPosition = Vector3.zero; // 애니메이션 포톤 뷰 설정 gameObject.GetComponent <PhotonAnimatorView>().SetParameterSynchronized("InteractionType", PhotonAnimatorView.ParameterType.Int, PhotonAnimatorView.SynchronizeType.Discrete); }
private void Awake() { #region References buttonScoreText = GameObject.Find("ButtonScore").GetComponent <Text>(); startPositionOfButtonText = buttonScoreText.transform.position; gameManager = FindObjectOfType <GameManager>(); sbangButton = FindObjectOfType <RemoveCard>(); currentScoreText = FindObjectOfType <CurrentScore>(); multiplierText = FindObjectOfType <Multiplier>(); timeBarText = FindObjectOfType <TimeBar>(); totalScoreText = FindObjectOfType <TotalScore>(); #endregion }
private void Awake() { gameManager = FindObjectOfType <GameManager>(); cardsParent = GameObject.Find("Cards"); multiplier = FindObjectOfType <Multiplier>(); timeBar = FindObjectOfType <TimeBar>(); if (cardsParent == null) { Debug.LogError("\"Cards\" not found\n"); } myText = this.GetComponentInChildren <Text>(); GameObject indicator = GameObject.Find("IndicatorImages"); for (int i = 0; i < indicator.transform.childCount; i++) { indicatorImages[i] = indicator.transform.GetChild(i).GetComponent <Image>(); } InitialiseList(); }
private void DrawValueGrid() { float pixels = RenderArea.height; // number of available pixels to render value grid double deltaValue = MaxValue - MinValue; if (_LabelStyle != null) { _PixelRequiredForLabel = _LabelStyle.CalcSize(_SampleText).y; // number of pixel required to draw a value label } else { _PixelRequiredForLabel = 10; } int num = Mathf.FloorToInt(pixels / (_PixelRequiredForLabel * 3));// number of labels can we draw _BigStep = deltaValue / num; bool extraDecimal = TimeBar.NormalizeStep(ref _BigStep);// normalize step to first upper round value if (_BigStep >= 0.1) { _Format = extraDecimal ? "{0:F2}" : "{0:F1}"; _Factor = 10; } else if (_BigStep >= 0.01) { _Format = extraDecimal ? "{0:F3}" : "{0:F2}"; _Factor = 100; } else if (_BigStep >= 0.001) { _Format = extraDecimal ? "{0:F4}" : "{0:F3}"; _Factor = 1000; } else { _Format = extraDecimal ? "{0:F5}" : "{0:F4}"; _Factor = 10000; } bool fiveSplit = (long)(_BigStep * _Factor) % 10 == 5; _SmallStep = _BigStep * (fiveSplit ? 0.2 : 0.5); _Factor = 1000000; // scale doubles and convert to longs because of better divide precision _LongStep = (long)(_BigStep * _Factor); _LongMiniStep = (long)(_SmallStep * _Factor); _LongMinValue = (long)(MinValue * _Factor); _LongMaxValue = (long)(MaxValue * _Factor); _LongFirstStep = (_LongMinValue / _LongMiniStep + 1) * _LongMiniStep; _DPy = pixels / deltaValue; // number of pixel required for each unit of time long fs = _LongFirstStep; // start by first time while (fs < _LongMaxValue) { float y = (float)((double)(fs - _LongMinValue) / _Factor * _DPy); if (fs % _LongStep == 0) { DrawHorizontalLine(y, true); string text = GetFormattedTime(fs); DrawText(y, text); } else { DrawHorizontalLine(y, false); } fs += _LongMiniStep; } }
public void HandleTimeBar() { TimeBar.SetValue(Canvas.LeftProperty, (Model.relativeTimePosition * Model.XZoom) + Model.touchOffset); }
public void Awake() { Instance = this; }
private void Start() { pickUpGenerator = FindObjectOfType <PickUpGenerator>(); timeBar = FindObjectOfType <TimeBar>(); StartCoroutine(SelfDestroy()); }
void Start() { _endBox = GameObject.Find("EndBox"); _endBox.SetActive(false); _blockCount = 0; _blockMemoryInt = -1; _level.Level = _level.GetLevelSelected(); _level.Section = _level.GetSectionSelected(); _textures = _level.GetLevelBlocks(); _size = _level.GetLevelDimensions(); _swap = SwapFactory.CreateSwap(_level.GetLevelDimensions(), SpriteArray, CreateGrid()); var titleFieldText = GameObject.Find("Title").GetComponent<Text>(); titleFieldText.text = _level.GetTitle(); _movesLeftText = GameObject.Find("Moves").GetComponent<Text>(); _movesLeftText.text = _level.GetMoves().ToString(); _movesCountInt = _level.GetMoves(); _movesLeftFontSize = _movesLeftText.fontSize; _fontSizeTemp = _movesLeftFontSize; _levelEndCompletitionText = _endBox.transform.FindChild("Finished").GetComponent<Text>(); _medal = _endBox.transform.FindChild("MedalImage").GetComponent<Image>(); _medalText = _endBox.transform.FindChild("MedalName").GetComponent<Text>(); _timeBar = GameObject.Find("Progress").GetComponent<TimeBar>(); _timeBar.TotalTime = _level.GetTime(); }
// Use this for initialization void Start() { m_cmpTimer = GetComponent <TimeBar>(); MessageText.SetActive(false); }
private void Awake() { timeBar = GetComponentInChildren <TimeBar>(); fadeImage = GetComponentInChildren <FadeImage>(); }
private void UpdateSliderTimerElapsedHandler(object sender, EventArgs e) { TimeBar.SetSliderPosition(musicPlayer.GetSongPosition()); }
private void MusicPlayerSongLoadedHandler(object sender, EventArgs e) { TimeBar.SetSliderMaxLenght(musicPlayer.GetCurretnSongLenghtSeconds()); }
public void setTimebar(TimeBar t) { this.timebar = t; }
public override void Load() { base.Load(); Size = new Vector2(WIDTH, HEIGHT); Alpha = alpha_when_inactive; for (int i = 0; i < timeBars.Length; ++i) { timeBars[i] = new TimeBar(); } Children = new Drawable[] { new Container { Masking = true, RelativeSizeAxes = Axes.Both, Children = timeBars }, fpsDisplay = new FpsDisplay(monitor.Clock) { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, }, overlayContainer = new Container { RelativeSizeAxes = Axes.Both, Children = new [] { new SpriteText { Text = Name, Origin = Anchor.BottomCentre, Anchor = Anchor.CentreLeft, Rotation = -90 }, legendContainer = new FlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Padding = new Vector2(5, 1), Children = new[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, Alpha = 0.2f } } }, new SpriteText { Text = $@"{visible_range}ms" }, new SpriteText { Text = @"0ms", Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft } } } }; foreach (PerformanceCollectionType t in Enum.GetValues(typeof(PerformanceCollectionType))) { if (t >= PerformanceCollectionType.Empty) { continue; } legendContainer.Add(legendMapping[(int)t] = new SpriteText { Colour = getColour(t), Text = t.ToString(), Alpha = 0 }); } overlayContainer.FadeOut(2000, EasingTypes.InExpo); // Initialize background for (int i = 0; i < WIDTH * timeBars.Length; ++i) { currentX = i; TextureUpload upload = new TextureUpload(HEIGHT * 4, textureBufferStack) { Bounds = new Rectangle(TimeBarX, 0, 1, HEIGHT) }; addArea(null, PerformanceCollectionType.Empty, HEIGHT, upload.Data); timeBars[TimeBarIndex].Sprite.Texture.SetData(upload); } }
public TimeLineGrid(TimeBar timeBar) { _TimeBar = timeBar; }
private void TestUpdateSlider(object sender, EventArgs e) { TimeBar.SetSliderPosition(musicPlayer.GetSongPosition()); }
void Start() { timeBar = GameObject.Find("Canvas").GetComponent <TimeBar>(); }
private void Init(IColorPreset colorPreset) { container.Anchor = AnchorType.TopRight; container.Pivot = PivotType.TopRight; container.X = -16f; container.Y = -16f; container.Width = 400f; container.Height = 140f; mask = container.CreateChild <UguiSprite>("mask", 0); { mask.Anchor = AnchorType.Fill; mask.RawSize = Vector2.zero; mask.Position = Vector2.zero; mask.SpriteName = "box"; mask.Color = Color.black; imageDisplay = mask.CreateChild <MapImageDisplay>("imageDisplay", 0); { imageDisplay.Anchor = AnchorType.Fill; imageDisplay.RawSize = Vector2.zero; } gradient = mask.CreateChild <UguiSprite>("gradient", 1); { gradient.Anchor = AnchorType.Fill; gradient.Offset = new Offset(0f, -22f, 0f, 0f); gradient.SpriteName = "gradation-bottom"; gradient.Color = new Color(0f, 0f, 0f, 0.9f); } title = mask.CreateChild <Label>("title", 2); { title.Anchor = AnchorType.BottomStretch; title.SetOffsetHorizontal(16f); title.Y = 92f; title.Height = 30f; title.IsBold = true; title.WrapText = true; title.FontSize = 18; } artist = mask.CreateChild <Label>("artist", 3); { artist.Anchor = AnchorType.BottomStretch; artist.SetOffsetHorizontal(16f); artist.Y = 70f; artist.Height = 30f; artist.WrapText = true; artist.FontSize = 16; } randomButton = mask.CreateChild <ControlButton>("random", 4); { randomButton.Anchor = AnchorType.BottomLeft; randomButton.X = 36f; randomButton.Y = 36f; randomButton.Size = new Vector2(48f, 48f); randomButton.IconName = "icon-random"; randomButton.IconSize = 24f; randomButton.OnTriggered += model.RandomizeMusic; } prevButton = mask.CreateChild <ControlButton>("prev", 5); { prevButton.Anchor = AnchorType.Bottom; prevButton.X = -56f; prevButton.Y = 36f; prevButton.Size = new Vector2(48f, 48f); prevButton.IconName = "icon-backward"; prevButton.IconSize = 24f; prevButton.OnTriggered += model.PrevMusic; } playButton = mask.CreateChild <ControlButton>("play", 6); { playButton.Anchor = AnchorType.Bottom; playButton.Y = 36f; playButton.Size = new Vector2(48f, 48f); playButton.IconName = "icon-play"; playButton.IconSize = 32f; playButton.OnTriggered += model.TogglePlaying; } nextButton = mask.CreateChild <ControlButton>("next", 7); { nextButton.Anchor = AnchorType.Bottom; nextButton.X = 56f; nextButton.Y = 36f; nextButton.Size = new Vector2(48f, 48f); nextButton.IconName = "icon-forward"; nextButton.IconSize = 24f; nextButton.OnTriggered += model.NextMusic; } timeBar = mask.CreateChild <TimeBar>("timebar", 8); { timeBar.Anchor = AnchorType.BottomStretch; timeBar.Pivot = PivotType.Bottom; timeBar.SetOffsetHorizontal(0f); timeBar.Y = 0f; timeBar.Height = 8f; } } OnEnableInited(); }