Esempio 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);
            }
        }
    }
Esempio 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;
         });
     }
 }
Esempio 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()}");
    }
Esempio n. 4
0
 public void Move(SocketRoomThrowDice dice)
 {
     Debug.Log("t:" + dice.t + " d1:" + dice.d1 + " d2:" + dice.d2);
     if(dice.t == 1) {
         Turn = RoomTurn.Player1;
         Player1PositionNext = Player1Position + dice.d1 + dice.d2;
     } else if(dice.t == 2) {
         Turn = RoomTurn.Player2;
         Player2PositionNext = Player2Position + dice.d1 + dice.d2;
     }
     State = RoomSceneState.Move;
     InvokeRepeating("Move1", 0.5f, 0.35f);
 }
Esempio n. 5
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);
    }