Example #1
0
        /// <summary>
        /// 显示cursor
        /// </summary>
        /// <param name="cells"></param>
        /// <param name="type"></param>
        public void ShowRangeCursors(IEnumerable <CellData> cells, MapCursor.CursorType type)
        {
            if (type == MapCursor.CursorType.Mouse)
            {
                return;
            }

            foreach (CellData cell in cells)
            {
                MapCursor cursor = CreateMapObject(runtimeCursorPrefab, cell.position) as MapCursor;
                if (cursor != null)
                {
                    //cursor.name = string.Format(
                    //    "{0} Cursor {1}",
                    //    type.ToString(),
                    //    cell.position.ToString());
                    cursor.cursorType = type;
                    if (type == MapCursor.CursorType.Move)
                    {
                        //m_MapMoveCursors.Add(cursor);
                        cell.hasMoveCursor = true;
                    }
                    else if (type == MapCursor.CursorType.Attack)
                    {
                        //m_MapAttackCursors.Add(cursor);
                        cell.hasAttackCursor = true;
                    }

                    m_Cursors.Add(cursor);
                }
            }
        }
Example #2
0
        /// <summary>
        /// 生成Cursors
        /// </summary>
        /// <param name="cells"></param>
        /// <param name="atk"></param>
        public void CreateTestCursors(IEnumerable <CellData> cells, bool atk)
        {
            if (cells != null)
            {
                MapCursor.CursorType type = atk ? MapCursor.CursorType.Attack : MapCursor.CursorType.Move;
                m_Map.ShowRangeCursors(cells, type);

                //Color color = Color.clear;
                //if (atk)
                //{
                //    color = Color.red;
                //    color.a = 0.5f;
                //}

                //foreach (var cell in cells)
                //{
                //    CreateTestCursor(cell, color);
                //}
            }
        }