コード例 #1
0
        /// <summary>
        /// Sets info about discovered TaskField
        /// </summary>
        /// <param name="location"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <param name="field"></param>
        /// <param name="TaskFieldList"></param>
        public void SetInfoAboutDiscoveredTaskField(GameObjects.Location location, int dx, int dy,
                                                    GameObjects.Field field, List <GameObjects.TaskField> TaskFieldList)
        {
            //basic information
            GameObjects.TaskField responseField = new GameObjects.TaskField(location.X + dx, location.Y + dy, DateTime.Now)
            {
                TimeStamp       = DateTime.Now,
                DistanceToPiece = (field as GameObjects.TaskField).DistanceToPiece
            };

            //anoter Player on the field
            if (field.HasPlayer())
            {
                responseField.PlayerId = (long)field.Player.ID;
                responseField.Player   = field.Player;
            }
            else
            {
                responseField.PlayerId = -1;
                responseField.Player   = null;
            }

            //piece on the field
            GameObjects.Piece piece = (field as GameObjects.TaskField).Piece;
            if (piece != null)
            {
                responseField.Piece = piece;
            }
            else
            {
                responseField.Piece = null;
            }

            TaskFieldList.Add(responseField);
        }
コード例 #2
0
        /// <summary>
        /// Sets info about discovered GoalField
        /// </summary>
        /// <param name="location"></param>
        /// <param name="dx"></param>
        /// <param name="dy"></param>
        /// <param name="field"></param>
        /// <param name="GoalFieldList"></param>
        public void SetInfoAboutDiscoveredGoalField(GameObjects.Location location, int dx, int dy,
                                                    GameObjects.Field field, List <GameObjects.GoalField> GoalFieldList)
        {
            GameObjects.GoalField responseField = new GameObjects.GoalField(location.X + dx, location.Y + dy, DateTime.Now, (field as GameObjects.GoalField).Team, GoalFieldType.unknown)
            {
                TimeStamp = DateTime.Now
            };

            if (field.HasPlayer())
            {
                responseField.PlayerId = (long)field.Player.ID;
                responseField.Player   = field.Player;
            }
            else
            {
                responseField.PlayerId = -1;
                responseField.Player   = null;
            }

            GoalFieldList.Add(responseField);
        }