Exemplo n.º 1
0
        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));
 }
Exemplo n.º 3
0
    private void Start()
    {
        IEnumerator coroutine = CoroutineUtils.DelaySeconds(
            () => { rend.ZKalphaTo(0, fadeTime).setEaseType(easeType).start(); },
            initialDelay);

        StartCoroutine(coroutine);
    }
Exemplo n.º 4
0
    private void OnEnable()
    {
        this.canvasGroup.alpha = 0;

        StartCoroutine(CoroutineUtils.DelaySeconds(() =>
        {
            DOTween.To(() => canvasGroup.alpha, x => canvasGroup.alpha = x, 1, 0.3f);
        }, this.delay));
    }
Exemplo n.º 5
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        StartCoroutine(CoroutineUtils.DelaySeconds(() =>
        {
            finalGate.SetActive(true);
//            SceneManager.LoadScene("End");
            Physics2D.gravity = new Vector2(0, -9.81f);
        }, 2f));
    }
Exemplo n.º 6
0
 public void Lose()
 {
     StartCoroutine(CoroutineUtils.DelaySeconds(() =>
     {
         IntTween tween = new IntTween();
         tween.initialize(new FontSizeTarget(youlose), 80, 1f);
         tween.start();
     }, 4f));
 }
Exemplo n.º 7
0
    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);
    }
Exemplo n.º 8
0
 public void Lose()
 {
     youlose.gameObject.SetActive(true);
     StartCoroutine(CoroutineUtils.DelaySeconds(() =>
     {
         IntTween tween = new IntTween();
         tween.initialize(new FontSizeTarget(youlose), 80, 1f);
         tween.start();
     }, 4f));
 }
Exemplo n.º 9
0
        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);
            }
        }
Exemplo n.º 10
0
        /// <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();
            }
        }
Exemplo n.º 11
0
    public bool Attack()
    {
        if (isAttacking || isAttackOnCooldown)
        {
            return(false);
        }

        isAttacking        = true;
        isAttackOnCooldown = true;
        StartCoroutine(CoroutineUtils.DelaySeconds(
                           () => { isAttackOnCooldown = false; }, attackCooldown));
        return(true);
    }
Exemplo n.º 12
0
 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)));
     }
 }
Exemplo n.º 13
0
 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();
 }
Exemplo n.º 14
0
 /// <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();
 }
Exemplo n.º 15
0
 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();
     }
 }
Exemplo n.º 16
0
 private void Start()
 {
     StartCoroutine(CoroutineUtils.DelaySeconds(() => { Destroy(gameObject); }, delay));
 }
Exemplo n.º 17
0
    public override void Awake()
    {
        base.Awake();

        this.StartCoroutine(CoroutineUtils.DelaySeconds(() => this.ViewModel.Next(), 1f));
    }
Exemplo n.º 18
0
 protected void OnEnable()
 {
     CoroutineUtils.DelaySeconds(this, () => gameObject.SetActive(false), timeToLive);
 }
Exemplo n.º 19
0
 private void Start()
 {
     StartCoroutine(CoroutineUtils.DelaySeconds(() => { rend.ZKalphaTo(0, fadeTime).start(); }, initialDelay));
 }