Esempio n. 1
0
        /// <summary>
        /// Shoot bullet.
        /// </summary>
        /// <param name="angle">in degree. 0 = 3 hour. 90 = 6 hour and so on.</param>
        /// <param name="range">how far this robot wants to shot</param>
        public ShootAnswerCommand Shoot(double angle, double range)
        {
            ShootAnswerCommand answer = new ShootAnswerCommand();

            addRobotTask(ShootAsync(answer, angle, range));
            return(answer);
        }
Esempio n. 2
0
        /// <summary>
        /// Shoot bullet. And sent it to server asynchronously.
        /// </summary>
        /// <param name="destination">Where to fill answer data.</param>
        /// <param name="angle">in degree. 0 = 3 hour. 90 = 6 hour and so on.</param>
        /// <param name="range">how far this robot wants to shot</param>
        private async Task <ShootAnswerCommand> ShootAsync(ShootAnswerCommand destination, double angle, double range)
        {
            await sendCommandAsync(new ShootCommand(range, angle));

            ShootAnswerCommand answer = await receiveCommandAsync <ShootAnswerCommand>();

            destination.FillData(answer);
            return(answer);
        }