private void tmrFormState_Tick(object sender, EventArgs e) { if (currentAnimState == AnimStateEnum.FadeOut) { if (this.Opacity - 0.1 < 0) { this.Opacity = 0; this.Hide(); currentAnimState = AnimStateEnum.Idle; } else this.Opacity -= 0.1; } else if (currentAnimState == AnimStateEnum.Wait) { if (doNotAutoHide) { if (GetForegroundWindow() != this.Handle) currentAnimState = AnimStateEnum.FadeOut; } else { if (waitTimeout < 0) { currentAnimState = AnimStateEnum.FadeOut; } else waitTimeout--; } } else if (currentAnimState == AnimStateEnum.FadeIn) { if (this.Opacity + 0.1 > 1) { this.Opacity = 1; if (doNotAutoHide) this.Activate(); else this.Show(); if (doNotAutoHide) currentAnimState = AnimStateEnum.Wait; else { currentAnimState = AnimStateEnum.Wait; } //tmrFormState.Stop(); //this.BeginInvoke(new Action(() => //{ // System.Threading.Thread.Sleep(100); // tmrFormState.Start(); //})); } else this.Opacity += 0.1; } }
private void SetState(AnimStateEnum NewAnimState) { if (targetAnimator != null) { if (AnimState != NewAnimState) { AnimState = NewAnimState; targetAnimator.SetInteger("CubeState", (int)AnimState); } } }
private void SetState(AnimStateEnum value) { AnimStateEnum previousState = _state; int newStateInt = (int)value; switch (newStateInt) { case (int)AnimStateEnum.Idle: if (previousState != AnimStateEnum.Idle) { if (isMine) { avatarMovement.enabled = true; avatarShooting.enabled = true; } avatarRigidbody.isKinematic = false; capsuleCollider.enabled = true; anim.SetTrigger("Idle"); } break; case (int)AnimStateEnum.Walking: if (previousState != AnimStateEnum.Walking) { anim.SetTrigger("Walking"); } break; case (int)AnimStateEnum.Die: if (previousState != AnimStateEnum.Die) { if (isMine) { avatarMovement.enabled = false; avatarShooting.enabled = false; gameplayWindow.RespawnCoroutineOn(); } avatarRigidbody.isKinematic = true; capsuleCollider.enabled = false; anim.SetTrigger("Die"); } break; } _state = (AnimStateEnum)value; }