Exemplo n.º 1
0
 /// <summary>
 /// Handles the on move request from the Twitch chat room
 /// </summary>
 /// <param name="twitchChat">Twitch Chat object</param>
 /// <param name="commandsArgs">The arguments received</param>
 public void OnMove(TwitchChat twitchChat, CommandsArgs commandsArgs)
 {
     if (!commandsArgs.nick.Equals(m_Nick))
     {
         return;
     }
     if (commandsArgs.IsCommand(m_MoveCommand))
     {
         TwitchChat_OnMoveCommand(twitchChat, commandsArgs);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Handles the on reset request from the Twitch chat room
 /// </summary>
 /// <param name="twitchChat">Twitch Chat object</param>
 /// <param name="commandsArgs">The arguments recieved</param>
 public void OnReset(TwitchChat twitchChat, CommandsArgs commandsArgs)
 {
     if (!commandsArgs.nick.Equals(m_Nick))
     {
         return;
     }
     if (commandsArgs.IsCommand(m_ResetCommand))
     {
         TwitchChat_OnResetCommand(commandsArgs);
     }
 }
Exemplo n.º 3
0
        void TwitchChat_OnZCommand(TwitchChat twitchChat, CommandsArgs commandsArgs)
        {
            float value;

            if (float.TryParse(commandsArgs.argument, out value))
            {
                AddForceFromCommand(float.Parse(commandsArgs.argument),
                                    (val) => new Vector3(0.0f, 0.0f, val),
                                    (val) => Mathf.Clamp(val.z, -m_MaxSpeed.z, m_MaxSpeed.z));
            }
            else
            {
                twitchChat.SendChatMessageFormat("@{0} {1} requires 1 argument and it must be a number you used ({2})", commandsArgs.nick, commandsArgs.command, commandsArgs.argument);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Handles the on move in one direction request from the Twitch chat room
 /// </summary>
 /// <param name="twitchChat">Twitch Chat object</param>
 /// <param name="commandsArgs">The arguments received</param>
 public void OnMoveUniDirection(TwitchChat twitchChat, CommandsArgs commandsArgs)
 {
     if (!commandsArgs.nick.Equals(m_Nick))
     {
         return;
     }
     if (commandsArgs.IsCommand(m_XCommand))
     {
         TwitchChat_OnXCommand(twitchChat, commandsArgs);
     }
     else if (commandsArgs.IsCommand(m_YCommand))
     {
         TwitchChat_OnYCommand(twitchChat, commandsArgs);
     }
     else if (commandsArgs.IsCommand(m_ZCommand))
     {
         TwitchChat_OnZCommand(twitchChat, commandsArgs);
     }
 }
Exemplo n.º 5
0
        void TwitchChat_OnMoveCommand(TwitchChat twitchChat, CommandsArgs commandsArgs)
        {
            int requiredArgsCount = 3;

            if (commandsArgs.nArgument.Length == requiredArgsCount)
            {
                float rmx;
                float rmy;
                float rmz;

                float.TryParse(commandsArgs.nArgument[MX], out rmx);
                float.TryParse(commandsArgs.nArgument[MY], out rmy);
                float.TryParse(commandsArgs.nArgument[MZ], out rmz);

                MovePlayer(rmx, rmy, rmz);
            }
            else
            {
                twitchChat.SendChatMessageFormat("@{0} {1} requires {2} arguments", commandsArgs.nick, commandsArgs.command, requiredArgsCount);
            }
        }
Exemplo n.º 6
0
 void CommandsBehaviour_OnCommandsReceived(TwitchChat twitchChat, CommandsArgs args)
 {
     Spawn(args);
 }