Exemplo n.º 1
0
            public static void LateUpdate()
            {
                if (playerController == null)
                {
                    return;
                }

                if (PlayerDeath.Value != DeathType.None && playerController["health"] == 0)
                {
                    if (MapUIContainer.AnyUIActive())
                    {
                        debounce = 1f;
                    }
                    else if (debounce > 0f)
                    {
                        debounce -= Time.unscaledDeltaTime;
                    }

                    if (!wasDead && PlayerDeathReset.Value)
                    {
                        foreach (var controller in agentControllers.Where(n => n != null))
                        {
                            Status.ResetAgentStats(controller);
                        }
                    }

                    wasDead = true;
                    PlayerActor player = Map.Instance.Player;
                    player.Controller.enabled = debounce > 0f;

                    if (player.ChaControl.enabled)
                    {
                        player.ChaControl.enabled = false;
                    }

                    if (player.Animation.enabled)
                    {
                        player.Animation.enabled = false;
                    }

                    if (player.Locomotor.enabled)
                    {
                        player.Locomotor.enabled = false;
                    }

                    if (player.ChaControl.visibleAll)
                    {
                        player.ChaControl.visibleAll = false;
                    }

                    Cursor.lockState = CursorLockMode.None;
                    Cursor.visible   = true;
                }
                else if (wasDead)
                {
                    wasDead = false;

                    Map.Instance.Player.EnableEntity();
                }
            }
Exemplo n.º 2
0
            static public void OnGUI()
            {
                if (PlayerDeath.Value == DeathType.None ||
                    playerController == null ||
                    playerController["health"] > 0 ||
                    !MapUIContainer.IsInstance() ||
                    MapUIContainer.AnyUIActive())
                {
                    return;
                }

                if (labelStyle == null)
                {
                    labelStyle = new GUIStyle(GUI.skin.label)
                    {
                        fontSize  = 14,
                        fontStyle = FontStyle.Bold,
                        alignment = TextAnchor.MiddleCenter
                    };

                    subLabelStyle = new GUIStyle(GUI.skin.label)
                    {
                        fontSize  = 12,
                        alignment = TextAnchor.MiddleCenter
                    };
                }

                rect = GUI.Window(
                    WindowIDDead.Value,
                    rect,
                    Draw,
                    "",
                    GUI.skin.box
                    );
            }