Exemplo n.º 1
0
    public void Chat(string text)
    {
        text = text.Remove(text.Length - 1);

        if (text != "")
        {
            RoomTurn.Request($"chat {text}");
            m_inputField.text = "";

            var chats = ChatText.text.Split('\n').ToList();
            chats.Add($"{Host.Character.name}: {text}");
            if (chats.Count > 8)
            {
                ChatText.text = String.Join("\n", chats.Skip(1));
            }
            else if (ChatText.text == "")
            {
                ChatText.text = chats[1];
            }
            else
            {
                ChatText.text = String.Join("\n", chats);
            }
        }
    }
Exemplo n.º 2
0
 public void Attack(Character target, float amount)
 {
     if (amount > 0)
     {
         Actor.Action(target.Actor, () =>
         {
             RoomTurn.Request($"Character Attack {target.ID} {amount}");
             target.HP.Value -= amount;
         });
     }
 }
Exemplo n.º 3
0
    private static void OnNext(ActionType type)
    {
        Character.ActionManager.Action(type);
        Debug.Log($"action {(int)type}");
        var bytes = System.Text.Encoding.ASCII.GetBytes($"action {(int)type}");

        Debug.Log(bytes.Length);
        var message = System.Text.Encoding.ASCII.GetString(bytes);

        Debug.Log(message);
        RoomTurn.Request($"action {((int)type).ToString()}");
    }
Exemplo n.º 4
0
    private static void OnNext(Command command)
    {
        Vector3 from = Character.transform.position;
        Vector3 to   = command.Point;

        if (command.Target == null)
        {
            RoomTurn.Request($"command {from.x} {from.z} {to.x} {to.z}");
        }
        else
        {
            var target = command.Target.GetComponent <Character>();
            if (target != null)
            {
                RoomTurn.Request($"command {from.x} {from.z} {to.x} {to.z} {target.ID}");
            }
        }

        Character.CommandAction(command);
    }