private void Update() { if (Input.GetAxis($"Horizontal_{PlayerNumber}") != 0) { this.animator.enabled = true; bool lookRight = Input.GetAxis($"Horizontal_{PlayerNumber}") > 0; this.spriteRenderer.flipX = (lookRight) ? false : true; DisplayCurrentItem(); } else { this.animator.enabled = false; } if (!Attributes.IsAlive && _deathAnimationDeathAnimationState == DeathAnimationState.Alive) { _deathAnimationDeathAnimationState = DeathAnimationState.Dying; for (int i = 0; i < 3; i++) { var particles = Instantiate(deathParticleSystem, transform.position, deathParticleSystem.transform.rotation, transform.parent); Destroy(particles.gameObject, particles.main.duration + particles.main.startLifetime.constant); } gameObject.SetActive(false); } }
public override void Update(double gameTime) { var animation = GetComponent<Animation>(); if (animation == null) { Done(); return; } if (_currentState == DeathAnimationState.Initialize) { animation.PlayAnimation(State.Walking, Direction.Down); _currentState = DeathAnimationState.Check; } else { if (animation.CurrentState == State.Standing) { Done(); } } }
public override void Update(double gameTime) { var animation = GetComponent <Animation>(); if (animation == null) { Done(); return; } if (_currentState == DeathAnimationState.Initialize) { animation.PlayAnimation(State.Walking, Direction.Down); _currentState = DeathAnimationState.Check; } else { if (animation.CurrentState == State.Standing) { Done(); } } }
public DeathAnimationExplosion() { _currentState = DeathAnimationState.Initialize; }
public DeathAnimationExplosion() { _currentState = DeathAnimationState.Initialize; }