public override IEnumerator PlayAnimation(GameObject boss, BossRoom room)
    {
        PlayerCamera camera = PlayerCamera.Instance;

        camera.enabled = false;

        DungeonCreator.Instance.AdjustMask(new Vector2(room.Border.xMin, room.Border.yMin), room.Border.size);

        yield return(EnumeratorUtil.GoToInSecondsSlerp(camera.transform, room.Middle, 2.0f));

        BossUIManager.Instance.Show(boss.GetComponent <Entity>(), 2.0f);
        yield return(new WaitForSeconds(2.0f));

        if (Player.LocalPlayer.isServer)
        {
            List <Player> activePlayers = PlayersDict.Instance.Players;
            for (int i = 0; i < activePlayers.Count; i++)
            {
                activePlayers[i].SmoothSync.teleportAnyObjectFromServer(room.PlayersStartPos, Quaternion.identity, new Vector3(1, 1, 1));
            }
        }

        yield return(EnumeratorUtil.GoToInSecondsSlerp(camera.transform, Player.LocalPlayer.transform.position, 2.0f));

        camera.enabled = true;
    }
        public Task LogAsync(ExceptionLoggerContext context, CancellationToken cancellationToken)
        {
            JObject json = converter.ToJObject(new
            {
                context.Exception,
                Trace   = EnumeratorUtil.Generate(new StringReader(context.Exception.StackTrace).ReadLine).ToArray(),
                Request = new
                {
                    Headers    = context.Request.Headers.ToDictionary(pair => pair.Key, p => p.Value),
                    RequestUri = context.Request.RequestUri.ToString(),
                    context.Request.Method.Method,
                    Body    = ReadPayload(context),
                    Version = context.Request.Version.ToString()
                }
            });
            string message = context.Exception.Message;

            return(Task.Factory.StartNew(() =>
            {
                try
                {
                    logger.LogFailure(Severity.Error, message, json);
                }
                catch (Exception ex)
                {
                    dump.Dump("Failed to log error to diagnostic log: " + Environment.NewLine + Environment.NewLine + ex);
                }
            }, cancellationToken));
        }
Beispiel #3
0
        private IEnumerator GetEnumerator(params Movement[] movements)
        {
            finished = false;
            yield return(EnumeratorUtil.MoveToMultiple(TIME_TO_ENTER, movements));

            if (!entering)
            {
                Object.Destroy(leavingActor.gameObject);
            }
            finished = true;
        }
Beispiel #4
0
    /// <summary>
    /// Callback for when the boss died.
    /// </summary>
    private void OnBossDied()
    {
        UnsubscribeFromEvents();

        new ExtendedCoroutine
            (this,
            EnumeratorUtil.FadeGroupCurve(group, healthCurve, healthFadeInTime, true),
            OnHealthHidden,
            true
            );
    }
Beispiel #5
0
        private IEnumerator GetEnumerator()
        {
            Quaternion from = Quaternion.identity;
            Quaternion to   = Quaternion.Euler(0, 90, 0);

            yield return(EnumeratorUtil.RotateTo(actor.transform, from, to, TIME_TO_EMOTE / 2));

            actor.ChangeEmotion(emote);
            yield return(EnumeratorUtil.RotateTo(actor.transform, to, from, TIME_TO_EMOTE / 2));

            finished = true;
        }
Beispiel #6
0
    /// <summary>
    /// Show the element.
    /// </summary>
    public void Show()
    {
        if (extendedCoroutine != null && extendedCoroutine.IsFinshed == false)
        {
            return;
        }

        extendedCoroutine = new ExtendedCoroutine
                            (
            this,
            EnumeratorUtil.GoToInSecondsLocalCurve(transform, endPos, hideShowCurve, showInSeconds),
            OnShownFinished,
            true
                            );
    }
Beispiel #7
0
    /// <summary>
    /// Displays the name first and then displays the health.
    /// </summary>
    /// <param name="nameDisplayLength">How long the name should display for.</param>
    /// <returns></returns>
    private IEnumerator DoHealthAnimation(float nameDisplayLength)
    {
        nameObject.SetActive(true);

        RectTransform rectTransform = nameObject.transform as RectTransform;

        rectTransform.localPosition = new Vector2(0.0f, 0.0f);
        Vector3 pos = new Vector3(0.0f, -rectTransform.rect.height * 1.5f);

        yield return(EnumeratorUtil.GoToInSecondsLocalCurve(rectTransform, pos, nameCurve, nameDisplayLength));

        nameObject.SetActive(false);

        group.alpha = 0.0f;
        healthObject.SetActive(true);
        yield return(EnumeratorUtil.FadeGroupCurve(group, healthCurve, healthFadeInTime));
    }
Beispiel #8
0
 public static ExtendedCoroutine ActionAfterFrame(MonoBehaviour onScript, Action onFinished, bool startNow = false)
 => new ExtendedCoroutine(onScript, EnumeratorUtil.WaitForFrame(), onFinished, startNow);
Beispiel #9
0
 /// <summary>
 /// Helper method for executing something in given seconds.
 /// </summary>
 /// <param name="onScript">The MonoBehaviour script that executes the coroutine.</param>
 /// <param name="seconds">The amount of waiting time.</param>
 /// <param name="onFinished">What should be executed after the coroutine finished.</param>
 /// <param name="startNow">Wheter the coroutine should start now.</param>
 public static ExtendedCoroutine ActionAfterSeconds(MonoBehaviour onScript, float seconds, Action onFinished, bool startNow = false)
 => new ExtendedCoroutine(onScript, EnumeratorUtil.WaitForSeconds(seconds), onFinished, startNow);
Beispiel #10
0
 /// <summary>
 /// Starts the fading out of the element.
 /// </summary>
 public void FadeOut()
 {
     GetPositions(out Vector2 left, out Vector2 mid, out Vector2 right);
     transform.localPosition = mid;
     StartCoroutine(EnumeratorUtil.GoToInSecondsLocalCurve(transform, fadeFromRight ? left : right, loadingScreenManager.FadeOutCurve, loadingScreenManager.FadeOutTime));
 }
Beispiel #11
0
 /// <summary>
 /// Starts the fading in of the element.
 /// </summary>
 public void FadeIn()
 {
     GetPositions(out Vector2 left, out Vector2 mid, out Vector2 right);
     transform.localPosition = fadeFromRight ? right : left;
     StartCoroutine(EnumeratorUtil.GoToInSecondsLocalCurve(transform, mid, loadingScreenManager.FadeInCurve, loadingScreenManager.FadeInTime));
 }
Beispiel #12
0
 public IEnumerator OnHide()
 {
     yield return(EnumeratorUtil.GoToInSecondsLocalCurve(transform, GetStartPos(), hideShowCurve, showInSeconds));
 }