示例#1
0
    public static string GetDeathText(PlayerController.Cause cause)
    {
        LoadAsset("deaths");
        List <string> possibleTexts = new List <string>();
        string        result        = _jsonNodeData[0].Value;

        if (result == null)
        {
            throw new NotImplementedException();
        }

        string selectedPage = "";

        if (cause.Instigator is Trap)
        {
            selectedPage = "Trap";
        }

        foreach (JSONNode node in _jsonNodeData[selectedPage].AsArray)
        {
            if (node["index"].AsInt == cause.Instigator.Index - 1)
            {
                possibleTexts.Add(node["text"]);
            }
        }

        return(possibleTexts[Random.Range(0, possibleTexts.Count)]);
    }
示例#2
0
    public void SetInactive(PlayerController.Cause cause)
    {
        HealthBar.gameObject.SetActive(false);
        HungerBar.gameObject.SetActive(false);
        ThirstBar.gameObject.SetActive(false);
        Active = false;

        if (cause == null)
        {
            return;
        }
    }