Exemplo n.º 1
0
        /// <summary>Передвигает монстра на один шаг к целевым координатам</summary>
        public void MakeStepToTargetLocation()
        {
            if (DungeonLevel.GetCellLocationFromGlobalLocation(Location.Point) == DungeonLevel.GetCellLocationFromGlobalLocation(m_target_location) &&
                m_action_status != DungeoMonsterActionStatus.Fighting)
            {
                StopThinking();
                StartThinking();
            }

            DungeonCreatureMoveDirection move_direction = DungeonCreatureMoveDirection.Right;
            double length_y = Math.Abs(Location.Y - m_target_location.Y);
            double length_x = Math.Abs(Location.X - m_target_location.X);
            bool   is_move  = false;

            if (length_y > length_x)
            {
                if (Location.Y > m_target_location.Y)
                {
                    move_direction = DungeonCreatureMoveDirection.Up;
                    is_move        = true;
                }
                else if (Location.Y < m_target_location.Y)
                {
                    move_direction = DungeonCreatureMoveDirection.Down;
                    is_move        = true;
                }
                else if (Location.X > m_target_location.X)
                {
                    move_direction = DungeonCreatureMoveDirection.Left;
                    is_move        = true;
                }
                else if (Location.X < m_target_location.X)
                {
                    move_direction = DungeonCreatureMoveDirection.Right;
                    is_move        = true;
                }
            }
            else
            {
                if (Location.X > m_target_location.X)
                {
                    move_direction = DungeonCreatureMoveDirection.Left;
                    is_move        = true;
                }
                else if (Location.X < m_target_location.X)
                {
                    move_direction = DungeonCreatureMoveDirection.Right;
                    is_move        = true;
                }
                else if (Location.Y > m_target_location.Y)
                {
                    move_direction = DungeonCreatureMoveDirection.Up;
                    is_move        = true;
                }
                else if (Location.Y < m_target_location.Y)
                {
                    move_direction = DungeonCreatureMoveDirection.Down;
                    is_move        = true;
                }
            }
            if (is_move)
            {
                if (Math.Abs(length_y - length_x) < GetStatValueWithEffectValue(DungeonStats.Speed) * 2) // если движение по диагонали
                {
                    Move(move_direction, true);
                }
                else
                {
                    Move(move_direction);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>Возвращает изображение шлема в заданном направлении</summary>
 /// <param name="direction">Направление, в которое направлено существо</param>
 /// <returns>Изображение</returns>
 public Bitmap GetImageOnDirection(DungeonCreatureMoveDirection direction)
 {
     return(MainForm.ImagesHelmets[m_quality_id, m_style_id, (int)direction]);
 }
Exemplo n.º 3
0
 /// <summary>Возвращает изображение меча в заданном направлении по текущему кадру анимации</summary>
 /// <param name="direction">Направление, в которое направлен меч</param>
 /// <returns>Изображение</returns>
 public Bitmap GetImageOnDirection(DungeonCreatureMoveDirection direction)
 {
     return(MainForm.ImagesSwordsGif[m_quality_id, (int)direction].GetFrame(TotalFrame));
 }