Exemple #1
0
    IEnumerator GetDeathNote()
    {
        var request = UnityEngine.Networking.UnityWebRequest.Get(Application.streamingAssetsPath + "/JSON/DeathNotes.json");

        yield return(request.SendWebRequest());

        string json = request.downloadHandler.text;

        List <DeathNote> allDeathNotes = JsonConvert.DeserializeObject <List <DeathNote> >(json);
        //List<DeathNote> allDeathNotes = JsonConvert.DeserializeObject<List<DeathNote>>(Resources.Load<TextAsset>("JSON/DeathNotes").ToString()); LEGACY
        DeathNote desiredDeathNotes = new DeathNote(0, new string[0]);

        for (int i = 0; i < allDeathNotes.Count; i++)
        {
            if (allDeathNotes[i].seconds > secondsSinceLastDeath)
            {
                desiredDeathNotes = allDeathNotes[i - 1];
                break;
            }
        }

        string deathNoteToReturn = desiredDeathNotes.description[UnityEngine.Random.Range(0, desiredDeathNotes.description.Length)];

        deathNote = deathNoteToReturn;
    }
 public void Put(int id, [FromBody] DeathNote value)
 {
     context.Notes.Update(new Note {
         Id          = value.IdNote,
         Date        = value.Date,
         Description = value.Description,
         PersonId    = value.IdPerson
     });
 }
 public void Post([FromBody] DeathNote value)
 {
     context.Notes.Add(new Note {
         Date        = value.Date,
         Description = value.Description,
         Person      = new Person {
             Name    = value.Name,
             Image   = value.Image,
             Surname = value.Surname,
         }
     });
     context.SaveChanges();
 }
    public IEnumerator Death(DeathNote note, GameObject obj = null)
    {
        switch (note)
        {
        case DeathNote.LastAttack:
            StartCoroutine(PrintMessage(new AOS_Message {
                Text = obj.name + " 님이 " + name + " 님을 일반 공격으로 처치하셨습니다.", Type = MessageType.KillDeath
            }));
            characterScore.Death++;
            yield return(Respawn());

            break;

        case DeathNote.LastMagic:
            StartCoroutine(PrintMessage(new AOS_Message {
                Text = obj.name + " 님이 " + name + " 님을 주문으로 처치하셨습니다.", Type = MessageType.KillDeath
            }));
            characterScore.Death++;
            break;

        case DeathNote.Fallen:
            if (obj != null)
            {
                Debug.Assert(true, "추락사의 경우 처치한 플레이어가 존재할 수 없으며, 해당 매개 인자를 생략해도 됩니다.");
            }
            StartCoroutine(PrintMessage(new AOS_Message {
                Text = name + " 님이 필드를 벗어나 사망하셨습니다.", Type = MessageType.KillDeath
            }));
            characterScore.Death++;
            yield return(Respawn());

            break;

        case DeathNote.Count:
            Debug.LogError("사망 원인으로 옳지 않은 매개 변수가 전달되었습니다.");
            Debug.LogError("사망 원인으로 DeathNote.Count를 사용 할 수 없습니다.");
            break;
        }
        yield return(null);
    }