public void StartSequence() { gameObject.SetActive(true); _cg = GetComponent <CanvasGroup>(); _text = GetComponent <Text>(); _cg.alpha = 1f; _text.fontSize = TEXT_MAX_SIZE; _text.text = "3"; _seq = TweenHelper.ReplaceSequence(_seq, false); _seq.Append(transform.DOScale(0.25f, 1f)); _seq.Insert(0.65f, _cg.DOFade(0, 0.3f)); _seq.AppendCallback(() => { _text.text = "2"; _cg.alpha = 1f; transform.localScale = Vector3.one; }); _seq.AppendInterval(0.1f); _seq.Append(transform.DOScale(0.25f, 1f)); _seq.Insert(1.75f, _cg.DOFade(0, 0.3f)); _seq.AppendCallback(() => { _text.text = "1"; _cg.alpha = 1f; transform.localScale = Vector3.one; }); _seq.AppendInterval(0.1f); _seq.Append(transform.DOScale(0.25f, 1f)); _seq.Insert(2.85f, _cg.DOFade(0, 0.3f)); _seq.AppendCallback(() => { _text.text = "GO!!!"; _cg.alpha = 1f; transform.localScale = Vector3.one; }); _seq.Append(transform.DOShakePosition(0.75f, 30, 30, 90)); _seq.Insert(3.4f, _cg.DOFade(0, 0.35f)); _seq.AppendCallback(() => { gameObject.SetActive(false); }); }
void UpdateDive(float dt) { var enterProgress = DiveEnterProgress; _diveEyePower = Dive ? 0.9f : 0.9f * enterProgress; TweenHelper.Tween01(false, ref _diveStartTween, dt * 4f); var sc = CenteredSprite.localScale; var angles = CenteredSprite.eulerAngles; var startScaling = 0.4f * Ease.quadraticOut(enterProgress); sc.x *= 1f + startScaling; sc.y *= 1f - startScaling; if (Dive) { var diveScaleFactor = 1f - _diveStartTween; sc.y *= 1f + 0.5f * diveScaleFactor - startScaling; sc.x *= 1f - 0.25f * diveScaleFactor + startScaling; } angles.z = _diveStartTween * 360f; CenteredSprite.localScale = sc; CenteredSprite.eulerAngles = angles; }
private void UpdateBlending(float dt) { if (Flying && WingsBlending <= 0f) { Animator.Play("fly"); } if (TweenHelper.Tween01(Flying, ref WingsBlending, dt * 8f)) { Animator.SetLayerWeight(1, WingsBlending); } if (Shooting && ShootBlending <= 0f) { Animator.Play("shooting"); } if (TweenHelper.Tween01(Shooting, ref ShootBlending, dt * 8f)) { Animator.SetLayerWeight(2, ShootBlending); } if (Carrying && CarrierBlending <= 0f) { Animator.Play("carrier"); } if (TweenHelper.Tween01(Carrying, ref CarrierBlending, dt * 8f)) { Animator.SetLayerWeight(3, CarrierBlending); } }
void ExpireEvent() { if (_curEvent == null) { return; } EventManager.Fire(new Event_StoryPointDone() { EventId = _curEvent.Id, Point = this, ActionType = _actionType }); // Free = true; _curEvent = null; _actionType = StoryEvent.ResultOptions.ResultType.Nothing; _liveTimer = 0f; _seq = TweenHelper.ReplaceSequence(_seq); _seq.Append(transform.DOScale(0, 0.35f)); _seq.AppendCallback(() => { Image.enabled = false; SelectedObj.SetActive(false); Free = true; _isPlaneFlyIn = false; }); }
// ----------------------------- // public api // ----------------------------- #region publicAPI public void Touched() { //don't do anything if we are already animating if (mIsAnimating) { return; } //don't do anything if there is a itween object on it if (GetComponent <iTween>() != null) { return; } switch (currentAnimType) { case AnimType.rotateAround: TweenHelper.rotateAdd(this.gameObject, rotateAroundAmount, 1.0f, iTween.EaseType.easeOutBack, "none", this.gameObject); GameObject newParticles = Instantiate(rotateAroundEffect, this.transform.position, Quaternion.identity) as GameObject; newParticles.transform.SetParent(this.transform); break; case AnimType.punchScale: TweenHelper.punchScale(this.gameObject, punchScaleAmount, 1.0f, "none", this.gameObject); break; case AnimType.shakeRotation: mIsAnimating = true; break; } }
void OnDestroy() { _seq = TweenHelper.ResetSequence(_seq); if (GameState.Instance != null) { GameState.Instance.RemovePause(this); } }
void Start() { var initScale = transform.localScale; transform.localScale = Vector3.zero; _seq = TweenHelper.ReplaceSequence(_seq); _seq.Append(transform.DOScale(initScale, 0.5f)); }
void Start() { _initScale = transform.localScale; _seq = TweenHelper.ReplaceSequence(_seq); transform.localScale = Vector3.zero; _seq.Append(transform.DOScale(_initScale, 0.29f)); _seq.AppendCallback(() => { _isReady = true; }); }
public void SetEffect(Tween t, Action callback = null) { _seq = TweenHelper.Replace(_seq); _seq.Append(t); if (callback != null) { _seq.AppendCallback(() => callback()); } }
public void SetEffect(Sequence seq, Action callback = null) { TweenHelper.Reset(_seq); _seq = seq; if (callback != null) { _seq.AppendCallback(() => callback()); } }
void Start() { CloseButton.onClick.AddListener(Close); _seq = TweenHelper.ReplaceSequence(_seq); var curScale = transform.localScale; transform.localScale = Vector3.zero; _seq.Append(transform.DOScale(curScale, 0.2f)); _seq.Append(transform.DOPunchScale(new Vector3(0.05f, 0.05f, 0), 0.25f)); }
void Close() { EventManager.Fire <Event_UI_Window_Closed>(new Event_UI_Window_Closed() { IsAdvert = true }); _seq = TweenHelper.ReplaceSequence(_seq); _seq.Append(transform.DOScale(0, 0.15f)); _seq.AppendInterval(0.1f); _seq.AppendCallback(() => { Destroy(this.gameObject); }); }
public IEnumerator AnimateMoney(int amount, Vector3 from, Vector3 to) { Text text = Instantiate(amount >= 0 ? positivePrefab : negativePrefab, from, Quaternion.identity, transform); text.text = "$" + System.Math.Abs(amount); yield return(TweenHelper.LerpPosition(from, to, CARD_ANIMATION_TIME, (pos) => text.transform.position = pos)); yield return(new WaitForSeconds(0.5f)); Destroy(text.gameObject); }
public void CloseWindow() { if (!_actionEnabled) { return; } _seq = TweenHelper.ReplaceSequence(_seq); _seq.Append(Back.transform.DOScale(0, 0.35f)); _seq.AppendCallback(() => { _actionEnabled = true; gameObject.SetActive(false); }); // TODO: Anim }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.layer == LayerMask.NameToLayer("ShipProjectile")) { TweenHelper.FlashSprite(GetComponent <SpriteRenderer>(), 0.2f); //TweenHelper.FlashSprite( //Debug.Log("My position is: " + gameObject.transform.position.x.ToString() + "," + gameObject.transform.position.y.ToString()); //Debug.Log("Ouch"); TakeDamage(other.GetComponent <enemyBullet>().damageValue); Destroy(other.gameObject); } }
/// <summary> /// Plays the Level the finished sequence. /// </summary> IEnumerator levelFinishedSequence() { audioSourceFinished.PlayOneShot(audioFinishedSFX); //wait a bit yield return(new WaitForSeconds(0.5f)); //show the bg effect bgEffectObj.SetActive(true); int currentLevelIndex = GameManager.Instance.currentLevelIndex; //unlock the collectible in the gameManager GameManager.Instance.allLevelSettings[currentLevelIndex].unlockCollectible(); //instantiate the collectible and parent it to the collectible container GameObject newCollectible = Instantiate(GameManager.Instance.getCollectibleObj(currentLevelIndex), collectibleSpawnPosTrans.position, Quaternion.identity) as GameObject; newCollectible.transform.SetParent(collectibleContainerObj.transform); //scale the collectible TweenHelper.unhideAndScale(newCollectible, Vector3.zero, new Vector3(1, 1, 1), 0.8f, iTween.EaseType.easeOutBack, "none", this.gameObject); //move the collectible to the jump pos TweenHelper.moveWorld(newCollectible, collectibleJumpPosTrans.position, 0.4f, iTween.EaseType.easeOutQuad, "none", this.gameObject); //wait until we arrived at the jump pos yield return(new WaitForSeconds(0.4f)); //move the object to the ground TweenHelper.moveWorld(newCollectible, collectibleGroundPosTrans.position, 0.5f, iTween.EaseType.easeOutBounce, "none", this.gameObject); //let the collectible rest on the ground a bit yield return(new WaitForSeconds(2.0f)); //move the collectible to the camera TweenHelper.moveWorld(newCollectible, collectibleCamPosTrans.position, 1.5f, iTween.EaseType.easeInCubic, "none", this.gameObject); //wait a bit yield return(new WaitForSeconds(3.0f)); //move the collectible to the homebtn TweenHelper.unhideAndScale(newCollectible, newCollectible.transform.localScale, Vector3.zero, 1.5f, iTween.EaseType.easeInBack, "none", this.gameObject); TweenHelper.moveWorld(newCollectible, collectibleHomeBtnTrans.position, 1.5f, iTween.EaseType.easeInCubic, "none", this.gameObject); //wait a bit and then play the particle effect and hide the collectible yield return(new WaitForSeconds(1.5f)); homeBtnParticleEffect.gameObject.SetActive(true); newCollectible.SetActive(false); }
public IEnumerator PutCardOnTable(Card card) { int handIndex = hand.IndexOf(card); if (handIndex != -1 && card != null) { handSlots[handIndex].gameObject.SetActive(false); int boardSlot = playedCards.Count + (boardSlots[playedCards.Count].gameObject.activeSelf ? 1 : 0); boardSlots[boardSlot].gameObject.SetActive(true); boardSlots[boardSlot].sprite = cardBack; yield return(TweenHelper.LerpPosition(handSlots[handIndex].transform.position, boardSlots[boardSlot].transform.position, MONEY_ANIMATE_TIME, (pos) => boardSlots[boardSlot].transform.position = pos)); } }
public void turnOn(bool hasEffect = false) { bgSprite.color = onColor; currentPointState = pointState.isOn; unlockEffect.gameObject.SetActive(true); //scale up the point a bit and back TweenHelper.scaleLocal(this.gameObject, new Vector3(1.5f, 1.5f, 1.5f), 0.1f, iTween.EaseType.easeOutCubic, "scalePointBack", this.gameObject); if (hasEffect) { Instantiate(unlockEffect, this.transform.position, Quaternion.identity); } }
public void Show(int index) { if (index > Newspapers.Count - 1) { return; } GameState.Instance.AddPause(this); Title.text = Newspapers[index].Title; Description.text = Newspapers[index].Description; gameObject.SetActive(true); Back.localScale = Vector3.zero; _seq = TweenHelper.ReplaceSequence(_seq); _seq.Append(Back.DOScale(1, 0.35f)); }
protected override void Update(GameTime gameTime) { GuiHelper.UpdateSetup(); TweenHelper.UpdateSetup(gameTime); if (Triggers.ResetDroppedFrames.Pressed()) { _fps.DroppedFrames = 0; } _fps.Update(gameTime); _editor.Update(gameTime); GuiHelper.UpdateCleanup(); base.Update(gameTime); }
void Show() { if (_curMessage == null) { ProcessState(); return; } BBTTransform.gameObject.SetActive(true); TextField.text = _curMessage.Text; _state = StripeState.MovingDown; _seq = TweenHelper.ReplaceSequence(_seq); _seq.Append(BBTTransform.DOLocalMove(ShownPos, _moveTime)); _seq.AppendCallback(() => { _state = StripeState.Shown; }); _seq.AppendInterval(_curMessage.ShowTime); _seq.AppendCallback(() => { _state = StripeState.MovingUp; }); _seq.Append(BBTTransform.DOLocalMove(RetractedPos, _moveTime)); _seq.AppendCallback(() => { _state = StripeState.Retracted; _curMessage = null; BBTTransform.gameObject.SetActive(false); ProcessState(); }); }
/// <summary> /// Called when a collectible button was pressed in the level select menu /// </summary> public void showCollectible(int index, Vector3 startPos) { print("now showing collecitble " + index); //show the black background collectibleBackgroundObj.SetActive(true); //instantiate the collectible mCurrentCollectible = Instantiate(GameManager.Instance.getCollectibleObj(index), startPos, Quaternion.identity) as GameObject; TweenHelper.unhideAndScale(mCurrentCollectible, Vector3.zero, Vector3.one, 0.4f, iTween.EaseType.easeOutBack, "none", this.gameObject); TweenHelper.moveWorld(mCurrentCollectible, new Vector3(Camera.main.transform.position.x, 0.0f, Camera.main.transform.position.z + 50.0f), 0.4f, iTween.EaseType.easeOutBack, "none", this.gameObject); //activate the collectible so we can play with it CollectibleCtrl collectCtrl = mCurrentCollectible.GetComponentInChildren <CollectibleCtrl>(true); collectCtrl.gameObject.SetActive(true); }
public void Init(bool withContent, string name, int price, int attack, int hp, int maxHp, bool withCover) { _seq = TweenHelper.Reset(_seq); Button.gameObject.SetActive(false); Content.SetActive(withContent); SetText(Name, name); SetText(Price, price); SetText(Attack, attack); if (maxHp > 0) { SetText(Hp, string.Format("{0}/{1}", hp, maxHp)); } else { SetText(Hp, ""); } Cover.enabled = withCover; }
public void SetupEvent(StoryEvent storyEvent) { if (storyEvent.Type == EventType.Combat) { Image.sprite = WarIcon; } if (storyEvent.Type == EventType.Humanitarian) { Image.sprite = HumIcon; } Image.SetNativeSize(); Image.enabled = true; _curEvent = storyEvent; Free = false; _liveTimer = 0f; _actionType = StoryEvent.ResultOptions.ResultType.Nothing; transform.localScale = Vector3.zero; _seq = TweenHelper.ReplaceSequence(_seq); _seq.Append(transform.DOScale(1, 0.35f)); }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.layer == LayerMask.NameToLayer("Projectile")) { if (!evade) { shipTakeDamage(other.GetComponent <enemyBullet>().damageValue); if ((Random.Range(0, 9)) < 4) { cargoTakeDamage((other.GetComponent <enemyBullet> ().damageValue)); } TweenHelper.FlashSprite(GetComponent <SpriteRenderer>(), 0.2f); Destroy(other.gameObject); } else { } //else // Debug.Log("Evaded"); } }
public void ShowWindow(StoryMapPoint point, StoryEvent storyEvent) { if (point == null || storyEvent == null) { return; } gameObject.SetActive(true); _actionEnabled = false; Back.transform.localScale = Vector3.zero; _seq = TweenHelper.ReplaceSequence(_seq); _seq.Append(Back.transform.DOScale(1f, 0.35f)); _seq.AppendCallback(() => { _actionEnabled = true; }); WarVariantsHolder.SetActive(storyEvent.Type == EventType.Combat); HumVariantsHolder.SetActive(storyEvent.Type == EventType.Humanitarian); RedWarButton.gameObject.SetActive(storyEvent.RedTeam == true); BlueWarButton.gameObject.SetActive(storyEvent.BlueTeam == true); _curEvent = storyEvent; _curPoint = point; Title.text = _curEvent.Title; Description.text = _curEvent.Description; }
void ResetSequence() { _seq = TweenHelper.ResetSequence(_seq); }
public void KillSilently() { _seq = TweenHelper.ResetSequence(_seq, false); _state = WindowState.Hidden; ProcessHide(); }
public void Kill() { _seq = TweenHelper.ResetSequence(_seq, false); ChangeState(WindowState.Hidden); }
private void OnDestroy() { _seq = TweenHelper.ResetSequence(_seq); }