private void OnTriggerEnter(Collider col) { var rb = col.attachedRigidbody; if (null == rb || !rb.CompareTag("Player")) { return; } // dissapear animation then destory the object if (null != _animator) { _animator.SetBool(_dissapearAnimation, true); _collider.enabled = false; // dissapear the game object after animation finishes CoroutineUtils.DelaySeconds(() => { gameObject.SetActive(false); }, 1.5f).Start(); } if (null != _audio) { _audio.Play(); } EventManager.TriggerEvent("CoinCollected"); }
public void Start() { StartCoroutine(CoroutineUtils.DelaySeconds(() => { //NavigationService.Instance.ShowViewModel(typeof(MainTabbarViewModel)); }, 1)); }
private void Start() { IEnumerator coroutine = CoroutineUtils.DelaySeconds( () => { rend.ZKalphaTo(0, fadeTime).setEaseType(easeType).start(); }, initialDelay); StartCoroutine(coroutine); }
private void OnEnable() { this.canvasGroup.alpha = 0; StartCoroutine(CoroutineUtils.DelaySeconds(() => { DOTween.To(() => canvasGroup.alpha, x => canvasGroup.alpha = x, 1, 0.3f); }, this.delay)); }
private void OnTriggerEnter2D(Collider2D other) { StartCoroutine(CoroutineUtils.DelaySeconds(() => { finalGate.SetActive(true); // SceneManager.LoadScene("End"); Physics2D.gravity = new Vector2(0, -9.81f); }, 2f)); }
public void Lose() { StartCoroutine(CoroutineUtils.DelaySeconds(() => { IntTween tween = new IntTween(); tween.initialize(new FontSizeTarget(youlose), 80, 1f); tween.start(); }, 4f)); }
private void Update() { if (!sk.backgroundSound.audioSource.isPlaying) { // if (!triggered) // { // triggered = true; // // } foreach (Animator animator in treeAnimators) { animator.SetTrigger("Dying"); } foreach (Animator animator in grassAnimators) { animator.SetTrigger("Dying"); } FloatTween tween = new FloatTween(tweenTarget, 1.0f, 5.0f, 3.0f); tween.start(); sk.playBackgroundMusic(clip, 1.0f, false); // gameObject.SetActive(false); rock.mass = rockMass; sissyphusMovement.InputDisabled = true; StartCoroutine(CoroutineUtils.DelaySeconds(() => { rock.mass = 1f; sissyphusMovement.InputDisabled = false; sissyphusMovement.MaxMoveSpeed = maxMoveSpeed; sissyphusMovement.MaxButtonBoost = maxButtonBoost; FloatTween tween2 = new FloatTween(tweenTarget, 5.0f, 1.0f, 3.0f); tween2.start(); foreach (Animator animator in treeAnimators) { animator.SetTrigger("Alive"); } foreach (Animator animator in grassAnimators) { animator.SetTrigger("Alive"); } }, 11f)); // ITween<float> tween = PropertyTweens.floatPropertyTo(this, "atmosphereThickness", 5, 3.0f); // tween.start(); // float atmosphereThickness = 1f; } // atmosphereThickness = Mathf.Clamp(atmosphereThickness, 0f, 5f); // skyboxMaterial.SetFloat("_AtmosphereThickness", atmosphereThickness); }
public void Lose() { youlose.gameObject.SetActive(true); StartCoroutine(CoroutineUtils.DelaySeconds(() => { IntTween tween = new IntTween(); tween.initialize(new FontSizeTarget(youlose), 80, 1f); tween.start(); }, 4f)); }
public static void PlayClip(AudioClip clip, float volume = 1.0f, float stopAt = 0, int index = 0) { var soundSource = instance.soundsSources[index]; soundSource.clip = clip; soundSource.volume = volume; soundSource.Play(); if (stopAt > 0 && stopAt < clip.length) { CoroutineUtils.DelaySeconds(instance, soundSource.Stop, stopAt); } }
/// <summary> /// Actives temporal immunity to hits for the given /// <see cref="DynamicActor.ImmunityTime"/> /// </summary> public void TemporalImmunity() { _immunityActive = true; // disables immunity after immunity time if (_player != null) { CoroutineUtils.DelaySeconds(() => { _immunityActive = false; }, _player.ImmunityTime).Start(); } }
public bool Attack() { if (isAttacking || isAttackOnCooldown) { return(false); } isAttacking = true; isAttackOnCooldown = true; StartCoroutine(CoroutineUtils.DelaySeconds( () => { isAttackOnCooldown = false; }, attackCooldown)); return(true); }
void Update() { if (_mainController.linesPlayer.time == _mainController.linesPlayer.clip.length) { StartCoroutine(CoroutineUtils.DelaySeconds(() => { Vector3 position = new Vector3(0, .5f, 3f); thing = Instantiate(_mainController.stuff[Random.Range(0, _mainController.stuff.Length)], position, new Quaternion(0, 0, 0, 0)); thing.GetComponent <AudioSource>().clip = appearClip; thing.GetComponent <AudioSource>().Play(); thing.GetComponent <Rigidbody>().isKinematic = true; }, (1f))); } }
public void Hit() { CancelInvoke(); enabled = false; // play dissapear animation CoroutineUtils.DelaySeconds(() => { _animator.SetBool(_dissapearAnimation, true); }, 2.0f).Start(); // disable after a time CoroutineUtils.DelaySeconds(() => { gameObject.SetActive(false); }, 3.0f).Start(); }
/// <summary> /// Action is to disable agent and /// enable physics simulation /// </summary> public void Hit() { enabled = false; _agent.enabled = false; _rigidbody.isKinematic = false; // play dissapear animation CoroutineUtils.DelaySeconds(() => { _animator.SetBool(_dissapearAnimation, true); }, 2.0f).Start(); // disable after a time CoroutineUtils.DelaySeconds(() => { gameObject.SetActive(false); }, 3.0f).Start(); }
private void OnCollisionEnter(Collision col) { // hit something on falling mode if (!_state.Is(PlayerMovementState.States.Falling) && _isAttacking) { _isAttacking = false; // animate flatten faster to give a sense of force push _animator.SetFloat(_animFlattenSpeed, col.impulse.y * 0.75f); // radius scan pushback area HitPushback(col.contacts[0].point, col.impulse.y * _player.PushbackRadiusScale); // play particle system _pushBackPlayParticles.Play(); // recover from flatten speed modification CoroutineUtils.DelaySeconds(() => { _animator.SetFloat(_animFlattenSpeed, 1.0f); }, 1.0f).Start(); } }
private void Start() { StartCoroutine(CoroutineUtils.DelaySeconds(() => { Destroy(gameObject); }, delay)); }
public override void Awake() { base.Awake(); this.StartCoroutine(CoroutineUtils.DelaySeconds(() => this.ViewModel.Next(), 1f)); }
protected void OnEnable() { CoroutineUtils.DelaySeconds(this, () => gameObject.SetActive(false), timeToLive); }
private void Start() { StartCoroutine(CoroutineUtils.DelaySeconds(() => { rend.ZKalphaTo(0, fadeTime).start(); }, initialDelay)); }