void ToggleButtonPanel() { //Debug.Log ("Toggle panel"+isBuildPanel); if (!isBuildPanel) { foreach (Transform thePlane in placementPlanesGroup) { thePlane.gameObject.renderer.enabled = true; } // Debug.Log ("open"); BuildPanelTween.Play(false); ToggleButtonTween.Play(false); } else { foreach (Transform thePlane in placementPlanesGroup) { thePlane.gameObject.renderer.enabled = false; } //Debug.Log ("close"); BuildPanelTween.Play(true); ToggleButtonTween.Play(true); } isBuildPanel = !isBuildPanel; }
public void changeGameState(GameState change) { if (change == activeGameState) { if (applyToTweenAlpha && alpha != null) { alpha.Play(true); } if (applyToTweenColor && color != null) { color.Play(true); } if (applyToTweenPosition && position != null) { position.Play(true); } if (applyToTweenRotate && rotate != null) { rotate.Play(true); } if (applyToTweenScale && scale != null) { scale.Play(true); } } else { if (applyToTweenAlpha && alpha != null) { alpha.Play(false); } if (applyToTweenColor && color != null) { color.Play(false); } if (applyToTweenPosition && position != null) { position.Play(false); } if (applyToTweenRotate && rotate != null) { rotate.Play(false); } if (applyToTweenScale && scale != null) { scale.Play(false); } } }
/////////////////////////////////////////////////////////////// // delegate // /////////////////////////////////////////////////////////////// public void BeginToFlop(GameObject touchedGameObject) { triggerGameObject = touchedGameObject; if (touchedGameObject == skyGameObject) { skyTween.Play(true); if (!detailTriggered) { detailTriggered = true; } } else if (touchedGameObject == detailGameObject) { detailTween.Play(false); } }
public void Init(GameObject posTarget, Model_Building model_building) { _posTarget = posTarget; _model_Building = model_building; float randX = UnityEngine.Random.Range(-0.8f, 0.8f); float randY = UnityEngine.Random.Range(0.5f, 1f); Vector3 contr1 = new Vector3(randX, randY, 0f); _rotation.to = new Vector3(0f, UnityEngine.Random.Range(90f, 360f), 0f); _rotation.Play(); // Vector3 pos = transform.InverseTransformPoint(_posTarget.transform.position); // Trace.trace(" pos x = " + pos.x + " y = " + pos.y + "_posTarget x = " + _posTarget.transform.position.x + " y = " + _posTarget.transform.position.y, Trace.CHANNEL.UI); MyBezier bezier = new MyBezier(this.transform.position, contr1, new Vector3(1f, -1f, 0f), _posTarget.transform.position); int pointSize = 180 + UnityEngine.Random.Range(0, 50); resultList = new Vector3[pointSize]; for (int index = 1; index <= pointSize; index++) { resultList[index - 1] = bezier.GetPointAtTime((float)index / (float)pointSize); } length = resultList.Length; // 随机 float randDelay = UnityEngine.Random.Range(0.1f, 1.3f); StartCoroutine(Move(randDelay)); }
private void SetSignInfo() { m_tChick.Clear(); if (moduleUnion.CardSignInfo == null) { return; } string signKey = "unionSign" + modulePlayer.id_.ToString() + modulePlayer.roleInfo?.leagueID.ToString(); m_cardBgGroup.SafeSetActive(false); var first = moduleWelfare.FrirstOpen(signKey); if (first) { m_cardBgGroup.SafeSetActive(true); for (int i = 0; i < m_itemBg.Count; i++) { if (m_itemBg[i] == null) { continue; } TweenRotation rotation = m_itemBg[i].GetComponent <TweenRotation>(); TweenAlpha alpha = m_itemBg[i].GetComponent <TweenAlpha>(); TweenPosition position = m_itemBg[i].GetComponent <TweenPosition>(); rotation?.Play(); alpha?.Play(); position?.Play(); } } SetTimesTxt(); }
public void setDisplayFace(bool front) { TweenRotation tween = GetComponent <TweenRotation> ( ); tween.Play(front); Invoke("switchFace", tween.duration / 2); }
public void Init(Bullet bullet){ State = bullet; TweenPost = ActionTarget.AddComponent<TweenPosition> (); TweenPost.duration = bullet.DurationTime; TweenPost.from = bullet.StartPoint; TweenPost.to = bullet.TargetPoint; EventDelegate.Add( TweenPost.onFinished, DeleteSelf); if(bullet.StartSize != Vector3.one){ TweenScal = ActionTarget.AddComponent<TweenScale> (); TweenScal.duration = bullet.DurationTime; TweenScal.from = bullet.StartSize; TweenScal.to = bullet.TargetSize; TweenScal.Play (true); } TweenRota = ActionTarget.AddComponent<TweenRotation>(); TweenRota.to = new Vector3(0.0f, 0.0f, 360.0f); TweenRota.duration = bullet.DurationTime; TweenRota.style = UITweener.Style.Once; EventDelegate.Add(TweenRota.onFinished, _RotationCount); TweenPost.Play (true); TweenRota.Play (true); //Invoke ("DeleteSelf", bullet.DurationTime + 1.0f); }
/// <summary> /// 부모 패널에서 실질적인 선택이 이뤄지면 들어오는 함수 /// </summary> public void OpeningEvent(uint lowDataId, ushort amount) { ActiveCollider(false); CostGroup.SetActive(false); CardOpenEffGo.SetActive(true); TweenRotation rot = GetComponentInParent <TweenRotation>();//시작은 로테이션 rot = TweenRotation.Begin(transform.parent.gameObject, rot.duration, Quaternion.Euler(-rot.from)); rot.onFinished.Clear(); TempCoroutine.instance.FrameDelay(rot.delay + (rot.duration * 0.5f), () => { Img.spriteName = "reward_pendant_back"; ItemSlotObj.SetLowDataItemSlot(lowDataId, amount); RewardGroup.SetActive(true); CostGroup.SetActive(false); }); //EventDelegate.Set(rot.onFinished, delegate () { // ItemSlotObj.SetLowDataItemSlot(lowDataId, amount); // RewardGroup.SetActive(true); // CostGroup.SetActive(false); //}); rot.ResetToBeginning(); rot.Play(true); }
public static TweenRotation RotateTo(GameObject go, UITweener.Method method, UITweener.Style style, float duration, float delay, Vector3 rotateFrom, Vector3 rotateTo) { if (go == null) { return(null); } //go.RemoveComponent<TweenPosition>(); TweenRotation comp = UITweenerUtil.Begin <TweenRotation>(go, method, style, duration, delay); //comp.ResetToBeginning(); comp.from = rotateFrom; comp.to = rotateTo; comp.duration = duration; comp.delay = delay; if (duration <= 0f) { comp.Sample(1f, true); comp.enabled = false; } comp = ResetTween(comp); comp.Play(true); return(comp); }
/////////////////////////////////////////////////////////////// // delegate // /////////////////////////////////////////////////////////////// public void BeginToFlop(GameObject touchedGameObject) { triggerGameObject = touchedGameObject; if (touchedGameObject == skyGameObject) { skyTween.Play(true); if (!detailTriggered) { // Show the menu levelPlayModel.FlopToCardBack(); detailTriggered = true; } } else if (touchedGameObject == detailGameObject) { detailTween.Play(false); } }
static public TweenRotation SetRatation(GameObject go, Vector3 rotation, float duration = 1f) { TweenRotation tws = Tweener.InitGO <TweenRotation>(go); tws.BeginRotation = tws.CurrentRotation; tws.EndRotation = rotation; tws.duration = duration; tws.Play(true); return(tws); }
void ResetTimer(float amount = -1.0f) { //Set the timer amount if one is applied. if (amount != -1.0f) { TweenTimer.duration = amount; } TweenTimer.Reset(); TweenTimer.Play(true); }
private void SetType(int type) { SetAllDisable(); switch (type) { case 1: SoundManager.PlaySound("Enhanced_enemyimpact1.ogg"); m_jinzhanatk.SetActive(true); break; case 2: SoundManager.PlaySound("Enhanced_enemyimpact2.ogg"); m_yuanchengatk.SetActive(true); break; case 3: SoundManager.PlaySound("LaserMine_Explode.ogg"); m_gongchengatk.SetActive(true); break; case 4: SoundManager.PlaySound("Enhanced_enemyimpact3.ogg"); m_anshaatk.SetActive(true); break; case 5: SoundManager.PlaySound("Enhanced_enemyimpact1.ogg"); m_stjinzhanatk.SetActive(true); break; case 6: SoundManager.PlaySound("Enhanced_enemyimpact2.ogg"); m_styuanchengatk.SetActive(true); break; case 7: SoundManager.PlaySound("Launch_1.ogg"); m_toweratk.SetActive(true); break; case 8: //hit m_hit.SetActive(true); m_hitScale.Reset(); m_hitAlpha.Reset(); m_hitRot.Reset(); m_hitScale.Play(true); m_hitAlpha.Play(true); m_hitRot.Play(true); break; default: break; } }
public void rotateTo(Vector3 rotation) { mFixRotation = rotation; TweenRotation tween = new TweenRotation( ); tween.from = transform.localRotation.eulerAngles; tween.to = rotation; tween.duration = .5f; tween.ResetToBeginning( ); tween.Play(true); }
public void ToogleBuildPanel() { if (!upgradePanelOpen && !settingsPanelOpen) { if (buildPanelOpen) { placementPlanesRoot.SetActive(false); buildPanelTweener.Play(false); buildPanelArrowTweener.Play(false); buildPanelOpen = false; } else { placementPlanesRoot.SetActive(true); buildPanelTweener.Play(true); buildPanelArrowTweener.Play(true); buildPanelOpen = true; } } }
// 翻牌 public void Award(string icon, string txt) { UIAtlasHelper.SetSpriteImage(mAwardIcon, icon); mAwardText.text = txt; mAwardTweener.Play(); mMaskTweener.Play(); mAni.gameObject.SetActive(true); mAni.onFinished += OnAniFinished; SoundManager.Instance.Play(107); mAwarded = true; }
// Use this for initialization void Start() { prevMultiplier = 0; //CollectCount.alpha = 0.0f; // see if the phase icon has a tween rotation TweenRotation temp = CurrentPhaseIcon.gameObject.GetComponent <TweenRotation>(); if (temp != null) { CurrentPhaseIconRotation = temp; CurrentPhaseIconRotation.Play(true); } }
public static void SafeGetTweenRotation(this Component component, Vector3 from, Vector3 to, float duration, UITweener.Method method = UITweener.Method.Linear, UITweener.Style style = UITweener.Style.Once, GameObject eventReceiver = null, string callWhenFinished = "") { TweenRotation tweenRotation = component.SafeGetComponent <TweenRotation>(); tweenRotation.from = from; tweenRotation.to = to; tweenRotation.duration = duration; tweenRotation.method = method; tweenRotation.style = style; tweenRotation.eventReceiver = eventReceiver; tweenRotation.ResetToBeginning(); if (tweenRotation.eventReceiver != null) { tweenRotation.callWhenFinished = callWhenFinished; } tweenRotation.Play(true); }
void OtherRotate(Transform tOther, int dir, int midIndex) { if (tOther != null) { Vector3 targEuler = Vector3.zero; TweenScale.Begin(tOther.gameObject, tweenTime, otherScale).method = UITweener.Method.EaseOut; // Vector3 fromEuler = Vector3.zero; if (myGrid != null) { if (midIndex - myGrid.GetIndex(tOther) >= 1) { targEuler = Vector3.down * farEuler; } } if (dir < 0) { TweenRotation tR = tOther.GetComponent <TweenRotation>(); if (tR != null) { tR.from = targEuler; targEuler = Vector3.down * farEuler; tR.to = targEuler; } else { tR = tOther.gameObject.AddComponent <TweenRotation>(); tR.from = targEuler; targEuler = Vector3.down * farEuler; tR.to = targEuler; } tR.duration = tweenTime; tR.method = UITweener.Method.EaseOut; tR.ResetToBeginning(); tR.Play(); } else { targEuler = Vector3.up * farEuler; Quaternion targetQ = Quaternion.Euler(targEuler); TweenRotation.Begin(tOther.gameObject, tweenTime, targetQ).method = UITweener.Method.EaseOut; } } }
void showFocus(GameObject mj) { Transform tm = focus.transform; TweenPosition tp = tm.GetComponent <TweenPosition>(); tp.enabled = false; tm.SetParent(mj.transform); //tm.localScale = new Vector3 (0.6f, 0.6f, 0.6f); //tm.localPosition = new Vector3 (0, 0.25f, 0.25f); tm.localRotation = Quaternion.Euler(0, 0, 0); focus.SetActive(true); tp.enabled = false; tp.from = tm.localPosition; tp.to = new Vector3(0, 0.25f, 0.25f); tp.style = UITweener.Style.Once; tp.duration = 0.3f; tp.AddOnFinished(new EventDelegate(() => { tp.onFinished.Clear(); tm.localPosition = new Vector3(0, 0.25f, 0.25f); tp.style = UITweener.Style.PingPong; tp.from = tm.localPosition; tp.to = tm.localPosition + new Vector3(0, 0, 0.2f); tp.duration = 1.0f; tp.Play(); TweenRotation tr = tm.GetComponent <TweenRotation>(); tr.from = tm.localEulerAngles; tr.to = tm.localEulerAngles + new Vector3(0, 0, 360); tr.Play(); })); tp.Play(); }
public static void SafeGetTweenRotation(this GameObject obj, Vector3 from, Vector3 to, float duration, float delay, UITweener.Method method = UITweener.Method.Linear, UITweener.Style style = UITweener.Style.Once, GameObject eventReceiver = null, string callWhenFinished = "") { if ((bool)obj.GetComponent <TweenRotation>()) { TweenRotation component = obj.GetComponent <TweenRotation>(); component.ResetToBeginning(); component.from = from; component.to = to; component.duration = duration; component.delay = delay; component.method = method; component.style = style; component.eventReceiver = eventReceiver; if (component.eventReceiver != null) { component.callWhenFinished = callWhenFinished; } component.PlayForward(); } else { TweenRotation component = obj.AddComponent <TweenRotation>(); component.from = from; component.to = to; component.duration = duration; component.delay = delay; component.method = method; component.style = style; component.eventReceiver = eventReceiver; if (component.eventReceiver != null) { component.callWhenFinished = callWhenFinished; } component.Play(forward: true); } }
public override void OnUpdate(float deltaTime) { if (isUiPasue) { return; } if (!_isStartRefresh) { return; } if (_heroEntity == null) { return; } if (_heroEntity.IsHeroDie) { //侠客死亡 _isStartRefresh = false; heroDieSpr.gameObject.SetActive(true); transform.localRotation = Quaternion.identity; mTweenRota.enabled = false; bloodSlider.value = 0; angSlider.value = 0; return; } OnRefreshBlood(); if (_heroEntity.CurrentAnger >= _heroEntity.MaxAnger && !isHasTween) { isHasTween = true; mTweenRota.enabled = true; mTweenRota.from = new Vector3(0, 0, -5); mTweenRota.to = new Vector3(0, 0, 5); mTweenRota.style = UITweener.Style.PingPong; mTweenRota.Play(); } }
void OnTimerDone() { // Debug.Log("ON TIMER!"); //If this is set to true when timer is done. if (gamereviewtrigger) { //Lets play the game review music here... sure... AudioPlayer.GetPlayer().PlayAudioClip(GameReviewMusic); } if (curState == state.Present && !PPSButton.gameObject.activeSelf) { PPSButton.gameObject.SetActive(true); ScoreButtonIntro.Reset(); ScoreButtonIntro.Play(true); Animal.gameObject.SetActive(true); if (IncommingPPS) { AudioPlayer.GetPlayer().PlaySound(IncommingPPS); } presented = true; //Set the game review and timer gamereviewtrigger = true; float t = AudioPlayer.GetPlayer().RemainingTime; ResetTimer(t); //Debug.LogError("Track change timer set :" + t.ToString()); } //Close the curtains here. if (curState == state.GameOver) { curState = state.CloseCurtain; //Hide the hud. ActivityManager.Instance.ToggleHud(false); //Pull curtain ActivityManager.Instance.PullCurtain(); //Pause the game ToyBox.GetPandora().TimePaused = true; ResetTimer(localDuration * 2.0f); } //This is when we finish displaying the game over sign. if (curState == state.CloseCurtain) { GameOverWindow.SetWindowAlpha(0.0f); GameOverWindow.ToggleWindowOff(); PhasesCountWindow.ToggleWindowOn(); //BG.ToggleWindowOn(); curState = state.Count; //Set the tween animation for badges. BadgesGridTween.Reset(); ResetTimer(localDuration); } if (curState == state.Scores) { switch (ScoresState) { //Present coins. case 0: { MoneyLabel.alpha = 1.0f; MoneyTween.Reset(); MoneyTween.Play(true); AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.CashRegister); break; } //Present score case 1: { ScoreLabel.alpha = 1.0f; PointsTween.Reset(); PointsTween.Play(true); AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotSelect); break; } //Present Bonus case 2: { BonusLabel.alpha = 1.0f; BonusTween.Reset(); BonusTween.Play(true); AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotSelect); break; } default: { break; } } ScoresState++; if (ScoresState > 3) { curState = state.Present; ResetTimer(localDuration); return; } //Resetting the timer after being displayed. ResetTimer(); return; } if (curState == state.Count) { int index = 0; foreach (FUIPhaseResultObject badge in _resultList) { //If we hit a badge with null data then we are finished and change state. //Testing, should be a test if there is valid phase data. if (badge.PhaseData == null) { curState = state.Scores; //Play animation and sound effects. BadgesGridTween.Play(true); AudioPlayer.GetPlayer().PlayMenuSFX(AudioPlayer.MenuSFX.SlotPushed); //Turn on windows here. PhasesCountWindow.ToggleWindowOn(); BG.ToggleWindowOn(); ResetTimer(); return; } if (!badge.gameObject.activeSelf) { //Repositioning on the start too aparently... panel.ResetPosition(); //Else we will activate the current object, reset the timer, and return from the function. badge.gameObject.SetActive(true); //Repositioning EndGameTable.Reposition(); panel.ResetPosition(); //Resetting the timer after being displayed. ResetTimer(); if (IncommingPhase) { AudioPlayer.GetPlayer().PlaySound(IncommingPhase); } return; } index++; } } }
/// <summary> /// 复位 /// </summary> public void PlayReverse() { mReverseTween.Play(false); }
void ClickOn() { IsClick = true; TP.Play(true); TP1.Play(true); }
// Update is called once per frame void Update() { //Grab data from GOT int newmultiplier = GameObjectTracker.GetGOT().GetMultiplier(); int newGems = GameObjectTracker.instance.GetGemsCollected(); float alpha = GameObjectTracker.GetGOT().GetComboAlpha(); //Set the bank amount. float gemcount = (float)newGems; gemcount = gemcount / 100.0f; string gemFormat = string.Format("{0:C}", gemcount); Bank.text = gemFormat; //Set the phase icon. //CurrentPhaseIcon.spriteName = GameObjectTracker.GetGOT().Game if (alpha < CloseBuffer && visible) { // Debug.LogError("alpha: " + alpha); MyAnimation.Play(false); visible = false; } if (newmultiplier == 0) { //Set previous multiplier. prevMultiplier = 0; //If we are visible play our animation //Dont process any more. return; } //Turn out counter if we go past 0 and is not visible. if (alpha > CloseBuffer && !visible) { //MyAnimation.Reset(); MyAnimation.Play(true); visible = true; } //If we are changed then trigger counter pop. if (newmultiplier > prevMultiplier) { Counter.text = newmultiplier.ToString(); //Set the shadow PrevCounter.text = Counter.text; CounterPop.Reset(); CounterPop.Play(true); } //Update gem colleciton if (newGems != prevGems) { //Format collect amount text to money. float collect = (float)newmultiplier; collect = collect / 100.0f; string collectCount = string.Format("+{0:C}", collect); //Set the text CollectCount.text = collectCount; //CollectCount.alpha = 1.0f; CollectAnimation.Reset(); CollectAnimation.Play(true); //AlphaAni.Reset(); AlphaAni.Play(true); BankAnimation.Reset(); BankAnimation.Play(true); prevGems = newGems; } //Fill up the outline! Outline.fillAmount = alpha; Outline.color = Color.Lerp(Color.red, Color.white, alpha); Quaternion qrot = Quaternion.identity; float ClockAngle = Mathf.Lerp(359, 0, alpha); qrot = Quaternion.AngleAxis(ClockAngle, Vector3.forward); //ClockBigHand. ClockBigHand.transform.localRotation = qrot; //Update the muliplier. int currentMultiplierModifier = GameObjectTracker.instance.Game.GetCurrentMultiplierModifier(); Multiplier.text = "x" + currentMultiplierModifier; // we dont want to show a x0 for gameover if (currentMultiplierModifier == 0) { //MyAnimation.Reset(); //MyAnimation.Play(false); } //Set prev multiplier prevMultiplier = newmultiplier; }
/// <summary> /// 翻牌 /// </summary> public void PlayPositive() { mPositiveTween.Play(true); }