在Unity中玩转表达式树:解锁游戏逻辑的动态魔法
html { overflow-x: initial !important }:root { --bg-color: #ffffff; --text-color: #333333; --select-text-bg-color: #B5D6FC; --select-text-font-color: auto; --monospace: "Lucida Console",Consolas,"Courier",monospace; --title-bar-height: 20px }.mac-os-11 { --title-bar-height: 28px }html { font-size: 14px; background-color: var(--bg-color); color: var(--text-color); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased }body { margin: 0; padding: 0; height: auto; inset: 0px; font-size: 1rem; line-height: 1.42857; overflow-x: hidden; tab-size: 4 }iframe { margin: auto }a.url { word-break: break-all }a:active, a:hover { outline: 0 }.in-text-selection, ::selection { text-shadow: none; background: var(--select-text-bg-color); color: var(--select-text-font-color) }#write { margin: 0 auto; height: auto; width: inherit; word-break: normal; overflow-wrap: break-word; position: relative; white-space: normal; overflow-x: visible; padding-top: 36px }#write.first-line-indent p { text-indent: 2em }#write.first-line-indent li p, #write.first-line-indent p * { text-indent: 0 }#write.first-line-indent li { margin-left: 2em }.for-image #write { padding-left: 8px; padding-right: 8px }body.typora-export { padding-left: 30px; padding-right: 30px }.typora-export .footnote-line, .typora-export li, .typora-export p { white-space: pre-wrap }.typora-export .task-list-item input { pointer-events: none }@media screen and (max-width: 500px) { body.typora-export { padding-left: 0; padding-right: 0 } #write { padding-left: 20px; padding-right: 20px } .CodeMirror-sizer { margin-left: 0 !important } .CodeMirror-gutters { display: none !important } }#write li>figure:last-child { margin-bottom: 0.5rem }#write ol, #write ul { position: relative }img { max-width: 100%; vertical-align: middle; image-orientation: from-image }button, input, select, textarea { color: inherit }input, input { line-height: normal; padding: 0 }*, ::after, ::before { box-sizing: border-box }#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p, #write pre { width: inherit }#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p { position: relative }p { line-height: inherit }h1, h2, h3, h4, h5, h6 { break-after: avoid-page; break-inside: avoid; orphans: 4 }p { orphans: 4 }h1 { font-size: 2rem }h2 { font-size: 1.8rem }h3 { font-size: 1.6rem }h4 { font-size: 1.4rem }h5 { font-size: 1.2rem }h6 { font-size: 1rem }.md-math-block, .md-rawblock, h1, h2, h3, h4, h5, h6, p { margin-top: 1rem; margin-bottom: 1rem }.hidden { display: none }.md-blockmeta { color: rgba(204, 204, 204, 1); font-weight: 700; font-style: italic }a { cursor: pointer }sup.md-footnote { padding: 2px 4px; background-color: rgba(238, 238, 238, 0.7); color: rgba(85, 85, 85, 1); border-radius: 4px; cursor: pointer }sup.md-footnote a, sup.md-footnote a:hover { color: inherit; text-transform: inherit; text-decoration: inherit }#write input { cursor: pointer; width: inherit; height: inherit }figure { overflow-x: auto; margin: 1.2em 0; max-width: calc(100% + 16px); padding: 0 }figure>table { margin: 0 }tr { break-inside: avoid; break-after: auto }thead { display: table-header-group }table { border-collapse: collapse; border-spacing: 0; width: 100%; overflow: auto; break-inside: auto; text-align: left }table.md-table td { min-width: 32px }.CodeMirror-gutters { border-right: 0; background-color: inherit }.CodeMirror-linenumber { user-select: none }.CodeMirror { text-align: left }.CodeMirror-placeholder { opacity: 0.3 }.CodeMirror pre { padding: 0 4px }.CodeMirror-lines { padding: 0 }div.hr:focus { cursor: none }#write pre { white-space: pre-wrap }#write.fences-no-line-wrapping pre { white-space: pre }#write pre.ty-contain-cm { white-space: normal }.CodeMirror-gutters { margin-right: 4px }.md-fences { font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; overflow: visible; white-space: pre; position: relative !important }.md-fences-adv-panel { width: 100%; margin-top: 10px; text-align: center; padding-top: 0; padding-bottom: 8px; overflow-x: auto }#write .md-fences.mock-cm { white-space: pre-wrap }.md-fences.md-fences-with-lineno { padding-left: 0 }#write.fences-no-line-wrapping .md-fences.mock-cm { white-space: pre; overflow-x: auto }.md-fences.mock-cm.md-fences-with-lineno { padding-left: 8px }.CodeMirror-line, twitterwidget { break-inside: avoid }.footnotes { opacity: 0.8; font-size: 0.9rem; margin-top: 1em; margin-bottom: 1em }.footnotes+.footnotes { margin-top: 0 }.md-reset { margin: 0; padding: 0; border: 0; outline: 0; vertical-align: top; background: left top; text-decoration: none; text-shadow: none; float: none; position: static; width: auto; height: auto; white-space: nowrap; cursor: inherit; -webkit-tap-highlight-color: transparent; line-height: normal; font-weight: 400; text-align: left; box-sizing: content-box; direction: ltr }li div { padding-top: 0 }blockquote { margin: 1rem 0 }li .mathjax-block, li p { margin: 0.5rem 0 }li blockquote { margin: 1rem 0 }li { margin: 0; position: relative }blockquote>:last-child { margin-bottom: 0 }blockquote>:first-child, li>:first-child { margin-top: 0 }.footnotes-area { color: rgba(136, 136, 136, 1); margin-top: 0.714rem; padding-bottom: 0.143rem; white-space: normal }#write .footnote-line { white-space: pre-wrap }@media print { body, html { border: 1px solid rgba(0, 0, 0, 0); height: 99%; break-after: avoid; break-before: avoid; font-variant-ligatures: no-common-ligatures } #write { margin-top: 0; padding-top: 0; border-color: rgba(0, 0, 0, 0) !important } .typora-export * { -webkit-print-color-adjust: exact } .typora-export #write { break-after: avoid } .typora-export #write::after { height: 0 } .is-mac table { break-inside: avoid } .typora-export-show-outline .typora-export-sidebar { display: none } }.footnote-line { margin-top: 0.714em; font-size: 0.7em }a img, img a { cursor: pointer }pre.md-meta-block { font-size: 0.8rem; min-height: 0.8rem; white-space: pre-wrap; background: rgba(204, 204, 204, 1); display: block; overflow-x: hidden }p>.md-image:only-child:not(.md-img-error) img, p>img:only-child { display: block; margin: auto }#write.first-line-indent p>.md-image:only-child:not(.md-img-error) img { left: -2em; position: relative }p>.md-image:only-child { display: inline-block; width: 100% }#write .MathJax_Display { margin: 0.8em 0 0 }.md-math-block { width: 100% }.md-math-block:not(:empty)::after { display: none }.MathJax_ref { fill: currentColor }:active, :focus, :active, :focus { outline: 0; box-shadow: none }.md-task-list-item { position: relative; list-style-type: none }.task-list-item.md-task-list-item { padding-left: 0 }.md-task-list-item>input { position: absolute; top: 0; left: 0; margin-left: -1.2em; margin-top: calc(1em - 10px); border: none }.math { font-size: 1rem }.md-toc { min-height: 3.58rem; position: relative; font-size: 0.9rem; border-radius: 10px }.md-toc-content { position: relative; margin-left: 0 }.md-toc-content::after, .md-toc::after { display: none }.md-toc-item { display: block; color: rgba(65, 131, 196, 1) }.md-toc-item a { text-decoration: none }.md-toc-inner:hover { text-decoration: underline }.md-toc-inner { display: inline-block; cursor: pointer }.md-toc-h1 .md-toc-inner { margin-left: 0; font-weight: 700 }.md-toc-h2 .md-toc-inner { margin-left: 2em }.md-toc-h3 .md-toc-inner { margin-left: 4em }.md-toc-h4 .md-toc-inner { margin-left: 6em }.md-toc-h5 .md-toc-inner { margin-left: 8em }.md-toc-h6 .md-toc-inner { margin-left: 10em }@media screen and (max-width: 48em) { .md-toc-h3 .md-toc-inner { margin-left: 3.5em } .md-toc-h4 .md-toc-inner { margin-left: 5em } .md-toc-h5 .md-toc-inner { margin-left: 6.5em } .md-toc-h6 .md-toc-inner { margin-left: 8em } }a.md-toc-inner { font-size: inherit; font-style: inherit; font-weight: inherit; line-height: inherit }.footnote-line a:not(.reversefootnote) { color: inherit }.md-attr { display: none }.md-fn-count::after { content: "." }code, pre, samp, tt { font-family: var(--monospace) }kbd { margin: 0 0.1em; padding: 0.1em 0.6em; font-size: 0.8em; color: rgba(36, 39, 41, 1); background: rgba(255, 255, 255, 1); border: 1px solid rgba(173, 179, 185, 1); border-radius: 3px; box-shadow: 0 1px rgba(12, 13, 14, 0.2), inset 0 0 2px rgba(255, 255, 255, 1); white-space: nowrap; vertical-align: middle }.md-comment { color: rgba(162, 127, 3, 1); opacity: 0.6; font-family: var(--monospace) }code { text-align: left; vertical-align: initial }a.md-print-anchor { white-space: pre !important; border-style: none !important; display: inline-block !important; position: absolute !important; width: 1px !important; right: 0 !important; outline: 0 !important; background: left top !important; text-decoration: initial !important; text-shadow: initial !important }.os-windows.monocolor-emoji .md-emoji { font-family: "Segoe UI Symbol", sans-serif }.md-diagram-panel>svg { max-width: 100% } svg, svg { max-width: 100%; height: auto } .node text { font-size: 1rem }table tr th { border-bottom: 0 }video { max-width: 100%; display: block; margin: 0 auto }iframe { max-width: 100%; width: 100%; border: none }.highlight td, .highlight tr { border: 0 }mark { background: rgba(255, 255, 0, 1); color: rgba(0, 0, 0, 1) }.md-html-inline .md-plain, .md-html-inline strong, mark .md-inline-math, mark strong { color: inherit }.md-expand mark .md-meta { opacity: 0.3 !important }mark .md-meta { color: rgba(0, 0, 0, 1) }@media print { .typora-export h1, .typora-export h2, .typora-export h3, .typora-export h4, .typora-export h5, .typora-export h6 { break-inside: avoid } }.md-diagram-panel .messageText { stroke: none !important }.md-diagram-panel .start-state { fill: var(--node-fill) }.md-diagram-panel .edgeLabel rect { opacity: 1 !important }.md-fences.md-fences-math { font-size: 1em }.md-fences-advanced:not(.md-focus) { padding: 0; white-space: nowrap; border: 0 }.md-fences-advanced:not(.md-focus) { }.typora-export-show-outline .typora-export-content { max-width: 1440px; margin: auto; display: flex; flex-direction: row }.typora-export-sidebar { width: 300px; font-size: 0.8rem; margin-top: 80px; margin-right: 18px }.typora-export-show-outline #write { --webkit-flex: 2; flex: 2 1 0 }.typora-export-sidebar .outline-content { position: fixed; top: 0; max-height: 100%; padding-bottom: 30px; padding-top: 60px; width: 300px }@media screen and (max-width: 1024px) { .typora-export-sidebar, .typora-export-sidebar .outline-content { width: 240px } }@media screen and (max-width: 800px) { .typora-export-sidebar { display: none } }.outline-content li, .outline-content ul { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; list-style: none }.outline-content ul { margin-top: 0; margin-bottom: 0 }.outline-content strong { font-weight: 400 }.outline-expander { width: 1rem; height: 1.42857rem; position: relative; display: table-cell; vertical-align: middle; cursor: pointer; padding-left: 4px }.outline-expander::before { content: ""; position: relative; font-family: Ionicons; display: inline-block; font-size: 8px; vertical-align: middle }.outline-item { padding-top: 3px; padding-bottom: 3px; cursor: pointer }.outline-expander:hover::before { content: "" }.outline-h1>.outline-item { padding-left: 0 }.outline-h2>.outline-item { padding-left: 1em }.outline-h3>.outline-item { padding-left: 2em }.outline-h4>.outline-item { padding-left: 3em }.outline-h5>.outline-item { padding-left: 4em }.outline-h6>.outline-item { padding-left: 5em }.outline-label { cursor: pointer; display: table-cell; vertical-align: middle; text-decoration: none; color: inherit }.outline-label:hover { text-decoration: underline }.outline-item:hover { border-color: rgba(245, 245, 245, 1); background-color: var(--item-hover-bg-color) }.outline-item:hover { margin-left: -28px; margin-right: -28px; border-left: 28px solid rgba(0, 0, 0, 0); border-right: 28px solid rgba(0, 0, 0, 0) }.outline-item-single .outline-expander::before, .outline-item-single .outline-expander:hover::before { display: none }.outline-item-open>.outline-item>.outline-expander::before { content: "" }.outline-children { display: none }.info-panel-tab-wrapper { display: none }.outline-item-open>.outline-children { display: block }.typora-export .outline-item { padding-top: 1px; padding-bottom: 1px }.typora-export .outline-item:hover { margin-right: -8px; border-right: 8px solid rgba(0, 0, 0, 0) }.typora-export .outline-expander::before { content: "+"; font-family: inherit; top: -1px }.typora-export .outline-expander:hover::before, .typora-export .outline-item-open>.outline-item>.outline-expander::before { content: "−" }.typora-export-collapse-outline .outline-children { display: none }.typora-export-collapse-outline .outline-item-open>.outline-children, .typora-export-no-collapse-outline .outline-children { display: block }.typora-export-no-collapse-outline .outline-expander::before { content: "" !important }.typora-export-show-outline .outline-item-active>.outline-item .outline-label { font-weight: 700 }.md-inline-math-container mjx-container { zoom: 0.95 }.CodeMirror { height: auto }.CodeMirror.cm-s-inner { }.CodeMirror-scroll { z-index: 3 }.CodeMirror-gutter-filler, .CodeMirror-scrollbar-filler { background-color: rgba(255, 255, 255, 1) }.CodeMirror-gutters { border-right: 1px solid rgba(221, 221, 221, 1); white-space: nowrap }.CodeMirror-linenumber { padding: 0 3px 0 5px; text-align: right; color: rgba(153, 153, 153, 1) }.cm-s-inner .cm-keyword { color: rgba(119, 0, 136, 1) }.cm-s-inner .cm-atom, .cm-s-inner.cm-atom { color: rgba(34, 17, 153, 1) }.cm-s-inner .cm-number { color: rgba(17, 102, 68, 1) }.cm-s-inner .cm-def { color: rgba(0, 0, 255, 1) }.cm-s-inner .cm-variable { color: rgba(0, 0, 0, 1) }.cm-s-inner .cm-variable-2 { color: rgba(0, 85, 170, 1) }.cm-s-inner .cm-variable-3 { color: rgba(0, 136, 85, 1) }.cm-s-inner .cm-string { color: rgba(170, 17, 17, 1) }.cm-s-inner .cm-property { color: rgba(0, 0, 0, 1) }.cm-s-inner .cm-operator { color: rgba(152, 26, 26, 1) }.cm-s-inner .cm-comment, .cm-s-inner.cm-comment { color: rgba(170, 85, 0, 1) }.cm-s-inner .cm-string-2 { color: rgba(255, 85, 0, 1) }.cm-s-inner .cm-meta { color: rgba(85, 85, 85, 1) }.cm-s-inner .cm-qualifier { color: rgba(85, 85, 85, 1) }.cm-s-inner .cm-builtin { color: rgba(51, 0, 170, 1) }.cm-s-inner .cm-bracket { color: rgba(153, 153, 119, 1) }.cm-s-inner .cm-tag { color: rgba(17, 119, 0, 1) }.cm-s-inner .cm-attribute { color: rgba(0, 0, 204, 1) }.cm-s-inner .cm-header, .cm-s-inner.cm-header { color: rgba(0, 0, 255, 1) }.cm-s-inner .cm-quote, .cm-s-inner.cm-quote { color: rgba(0, 153, 0, 1) }.cm-s-inner .cm-hr, .cm-s-inner.cm-hr { color: rgba(153, 153, 153, 1) }.cm-s-inner .cm-link, .cm-s-inner.cm-link { color: rgba(0, 0, 204, 1) }.cm-negative { color: rgba(221, 68, 68, 1) }.cm-positive { color: rgba(34, 153, 34, 1) }.cm-header, .cm-strong { font-weight: 700 }.cm-del { text-decoration: line-through }.cm-em { font-style: italic }.cm-link { text-decoration: underline }.cm-error { color: rgba(255, 0, 0, 1) }.cm-invalidchar { color: rgba(255, 0, 0, 1) }.cm-constant { color: rgba(38, 139, 210, 1) }.cm-defined { color: rgba(181, 137, 0, 1) }div.CodeMirror span.CodeMirror-matchingbracket { color: rgba(0, 255, 0, 1) }div.CodeMirror span.CodeMirror-nonmatchingbracket { color: rgba(255, 34, 34, 1) }.cm-s-inner .CodeMirror-activeline-background { }.CodeMirror { position: relative; overflow: hidden }.CodeMirror-scroll { height: 100%; outline: 0; position: relative; box-sizing: content-box }.CodeMirror-sizer { position: relative }.CodeMirror-gutter-filler, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-vscrollbar { position: absolute; z-index: 6; display: none; outline: 0 }.CodeMirror-vscrollbar { right: 0; top: 0; overflow: hidden }.CodeMirror-hscrollbar { bottom: 0; left: 0 }.CodeMirror-scrollbar-filler { right: 0; bottom: 0 }.CodeMirror-gutter-filler { left: 0; bottom: 0 }.CodeMirror-gutters { position: absolute; left: 0; top: 0; padding-bottom: 10px; z-index: 3; overflow-y: hidden }.CodeMirror-gutter { white-space: normal; height: 100%; box-sizing: content-box; padding-bottom: 30px; margin-bottom: -32px; display: inline-block }.CodeMirror-gutter-wrapper { position: absolute; z-index: 4; background: left top !important; border: none !important }.CodeMirror-gutter-background { position: absolute; top: 0; bottom: 0; z-index: 4 }.CodeMirror-gutter-elt { position: absolute; cursor: default; z-index: 4 }.CodeMirror-lines { cursor: text }.CodeMirror pre { border-radius: 0; border-width: 0; background: left top; font-family: inherit; font-size: inherit; margin: 0; white-space: pre; overflow-wrap: normal; color: inherit; z-index: 2; position: relative; overflow: visible }.CodeMirror-wrap pre { overflow-wrap: break-word; white-space: pre-wrap; word-break: normal }.CodeMirror-code pre { border-right: 30px solid rgba(0, 0, 0, 0); width: fit-content }.CodeMirror-wrap .CodeMirror-code pre { border-right: none; width: auto }.CodeMirror-linebackground { position: absolute; inset: 0px; z-index: 0 }.CodeMirror-linewidget { position: relative; z-index: 2; overflow: auto }.CodeMirror-wrap .CodeMirror-scroll { overflow-x: hidden }.CodeMirror-measure { position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden }.CodeMirror-measure pre { position: static }.CodeMirror div.CodeMirror-cursor { position: absolute; visibility: hidden; border-right: none; width: 0 }.CodeMirror div.CodeMirror-cursor { visibility: hidden }.CodeMirror-focused div.CodeMirror-cursor { visibility: inherit }.cm-searching { background: rgba(255, 255, 0, 0.4) }span.cm-underlined { text-decoration: underline }span.cm-strikethrough { text-decoration: line-through }.cm-tw-syntaxerror { color: rgba(255, 255, 255, 1); background-color: rgba(153, 0, 0, 1) }.cm-tw-deleted { text-decoration: line-through }.cm-tw-header5 { font-weight: 700 }.cm-tw-listitem:first-child { padding-left: 10px }.cm-tw-box { border-style: solid; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-width: 0 !important }.cm-tw-underline { text-decoration: underline }@media print { .CodeMirror div.CodeMirror-cursor { visibility: hidden } }:root { --text-align: justify; --use-dynamic-effect: 1; --h1-hover-effect: 1; --h2-after-effect: 1; --h3-6-hover-effect: 1; --p-hover-effect: 1; --img-hover-effect: 1; --blockquote-hover-effect: 1; --alert-hover-effect: 1; --strong-hover-effect: 1; --em-hover-effect: 1; --u-hover-effect: 1; --mark-hover-effect: 1; --del-hover-effect: 1; --code-hover-effect: 1; --fence-hover-effect: 1; --list-marker-effect: 1; --list-ol-text-style: normal; --hr-hover-effect: 1; --table-hover-effect: 1 }html { font-size: 16px; max-width: 1080px; margin: 0 auto; padding: 0 20px }html, body { font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", sans-serif; text-align: var(--text-align); overflow-x: hidden; color: rgba(40, 44, 52, 1); -webkit-font-smoothing: antialiased }content #write { background-color: rgba(254, 254, 254, 1); max-width: 90%; margin: 0 auto; padding-bottom: 7.5rem }content #write p { word-spacing: 0.1rem; line-height: 1.9rem; margin: 3px }content #write ol li { padding-left: 0.5rem }content #write>h1:first-child { font-weight: normal }content #write>h5.md-focus:before { top: 2px }::-moz-selection { background-color: rgba(222, 242, 232, 1) }::selection { background-color: rgba(222, 242, 232, 1) }#write h1, #write h2, #write h3 { font-style: normal }#write h1, #write h2 { text-align: center; margin-top: 2rem; margin-bottom: 1rem }#write h1 { font-size: 2.4rem; position: relative; overflow: hidden; transition: transform 0.4s ease }#write h1:before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(90deg, rgba(152, 251, 152, 0), rgba(232, 244, 238, 1), rgba(152, 251, 152, 0)); transition: transform 0.4s ease; transform: scaleX(0); transform-origin: center; z-index: -1; display: calc(var(--h1-hover-effect) * var(--use-dynamic-effect)) }#write h1:hover { transform: scale(calc(1 + 0.1 * var(--h1-hover-effect) * var(--use-dynamic-effect))) }#write h1:hover:before { transform: scaleX(calc(var(--h1-hover-effect) * var(--use-dynamic-effect))) }#write h2 { font-size: 2rem; position: relative; padding-bottom: 0.5rem; font-weight: bold }#write h2:after { content: ""; display: block; width: 30rem; height: 2.5px; margin: 0.5rem auto 0; background: linear-gradient(90deg, rgba(106, 158, 69, 0), rgba(62, 161, 116, 1), rgba(106, 158, 69, 0)); border-radius: 10px; transform: scaleX(0); transition: transform 0.4s ease, background 0.4s ease }#write h2:hover:after { transform: scaleX(calc(1 * var(--h2-after-effect) * var(--use-dynamic-effect))) }#write h3 { font-size: 1.8rem }#write h4 { font-size: 1.5rem }#write h5 { font-size: 1.3rem }#write h6 { font-size: 1.2rem }#write h3, #write h4, #write h5, #write h6 { position: relative; margin-top: 1.5rem; margin-bottom: 0.5rem; transition: transform 0.3s ease }#write h3:hover, #write h4:hover, #write h5:hover, #write h6:hover { transform: scale(calc(1 + 0.01 * var(--h3-6-hover-effect) * var(--use-dynamic-effect))) }img { border-radius: 10px; max-width: 100%; display: block; margin: 1em auto; transition: transform 0.15s ease, border-radius 0.15s ease }img:hover { transform: scale(calc(1 + 0.01 * var(--img-hover-effect) * var(--use-dynamic-effect))); border-radius: calc(10px - 10px * var(--img-hover-effect) * var(--use-dynamic-effect)) }p { font-size: 1rem; transition: all 0.25s ease }p:not(:has(img)):hover { background-color: rgba(123, 181, 147, calc(0.1 * var(--p-hover-effect) * var(--use-dynamic-effect))); padding-left: calc(0.5rem * var(--p-hover-effect) * var(--use-dynamic-effect)); padding-right: calc(0.5rem * var(--p-hover-effect) * var(--use-dynamic-effect)); border-radius: calc(10px * var(--p-hover-effect) * var(--use-dynamic-effect)) }p.md-toc-content:hover { padding-left: 20px }ul, ol { padding-left: 1.2rem }ul:first-child, ol:first-child { margin-top: 0 }ul:last-child, ol:last-child { margin-bottom: 0 }@keyframes bounce { 0%, 100% { transform: scale(1) } 50% { transform: scale(calc(1 + 0.3 * var(--list-marker-effect) * var(--use-dynamic-effect))) } }ul .md-list-item::marker { list-style-type: disc; font-size: 27px !important; color: rgba(8, 119, 37, 1); transition: transform 0.3s }ul .md-list-item:hover::marker { animation: 0.6s ease-in-out bounce }ul ul .md-list-item::marker { list-style-type: circle; font-size: 27px; color: rgba(8, 109, 33, 1); font-weight: bold; transition: transform 0.3s }ul ul .md-list-item:hover::marker { animation: 0.6s ease-in-out bounce }ul ul ul .md-list-item::marker { list-style-type: square; font-size: 27px; color: rgba(87, 160, 19, 1); transition: transform 0.3s }ul ul ul .md-list-item:hover::marker { animation: 0.6s ease-in-out bounce }ol .md-list-item::marker { font-family: "Times New Roman", Times, serif; font-size: 20px; font-style: italic }ol .md-list-item:hover::marker { font-style: var(--list-ol-text-style); font-weight: calc(500 + 100 * var(--list-marker-effect) * var(--use-dynamic-effect)); font-size: calc(20px + 3px * var(--list-marker-effect) * var(--use-dynamic-effect)); color: rgb(0, calc(100 * var(--list-marker-effect) * var(--use-dynamic-effect)), 0) }blockquote { padding: 0.5rem 1rem; border-left: 8px solid rgba(47, 132, 94, 1); background-color: rgba(232, 244, 235, 1); border-radius: 7px; transition: box-shadow 0.3s ease, border-radius 0.3s ease, border-left 0.3s ease }blockquote p { margin: 0.1rem 0 }blockquote:hover { border-left: calc(8px + 1px * var(--blockquote-hover-effect) * var(--use-dynamic-effect)) solid #2f845e; box-shadow: calc(0px + 1px * var(--blockquote-hover-effect) * var(--use-dynamic-effect)) calc(1px + 1px * var(--blockquote-hover-effect) * var(--use-dynamic-effect)) calc(3px + 3px * var(--blockquote-hover-effect) * var(--use-dynamic-effect)) rgba(0, 0, 0, calc(0.15 * var(--blockquote-hover-effect) * var(--use-dynamic-effect))); border-radius: calc(7px + 8px * var(--blockquote-hover-effect) * var(--use-dynamic-effect)) }blockquote table thead, blockquote .md-table-fig .md-table thead { background-color: rgba(59, 148, 87, 1); color: rgba(59, 59, 59, 0.31) }blockquote td { background-color: rgba(250, 250, 250, 1) }.md-alert.md-alert-tip { padding: 0.5rem 1rem; border-left: 8px solid rgba(31, 136, 61, 1); background-color: rgba(232, 244, 235, 1); border-radius: 7px; transition: box-shadow 0.3s ease, border-radius 0.3s ease, border-left 0.3s ease }.md-alert.md-alert-tip:hover { border-left: calc(8px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) solid #1F883D; box-shadow: calc(0px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) calc(1px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) calc(3px + 3px * var(--alert-hover-effect) * var(--use-dynamic-effect)) rgba(0, 0, 0, calc(0.15 * var(--alert-hover-effect) * var(--use-dynamic-effect))); border-radius: calc(7px + 8px * var(--alert-hover-effect) * var(--use-dynamic-effect)) }.md-alert.md-alert-tip table thead, .md-alert.md-alert-tip .md-table-fig .md-table thead { background-color: rgba(59, 148, 87, 1); color: rgba(250, 251, 250, 1) }.md-alert.md-alert-caution { padding: 0.5rem 1rem; border-left: 8px solid rgba(207, 34, 46, 1); background-color: rgba(245, 236, 236, 1); border-radius: 7px; transition: box-shadow 0.3s ease, border-radius 0.3s ease, border-left 0.3s ease }.md-alert.md-alert-caution:hover { border-left: calc(8px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) solid #CF222E; box-shadow: calc(0px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) calc(1px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) calc(3px + 3px * var(--alert-hover-effect) * var(--use-dynamic-effect)) rgba(0, 0, 0, calc(0.15 * var(--alert-hover-effect) * var(--use-dynamic-effect))); border-radius: calc(7px + 8px * var(--alert-hover-effect) * var(--use-dynamic-effect)) }.md-alert.md-alert-caution p:hover { background-color: rgba(207, 34, 45, 0.04) }.md-alert.md-alert-caution ::selection { background-color: rgba(207, 34, 45, 0.09) }.md-alert.md-alert-caution strong, .md-alert.md-alert-caution em, .md-alert.md-alert-caution code, .md-alert.md-alert-caution a { color: rgba(207, 34, 46, 1) }.md-alert.md-alert-caution table thead, .md-alert.md-alert-caution .md-table-fig .md-table thead { background-color: rgba(216, 60, 70, 1); color: rgba(250, 251, 250, 1) }.md-alert.md-alert-caution ul .md-list-item::marker,.md-alert.md-alert-caution ul ul .md-list-item::marker,.md-alert.md-alert-caution ul ul .md-list-item::marker,.md-alert.md-alert-caution ol .md-list-item:hover::marker { color: rgba(207, 34, 46, 1) }.md-alert.md-alert-warning { padding: 0.5rem 1rem; border-left: 8px solid rgba(154, 103, 0, 1); background-color: rgba(244, 241, 233, 1); border-radius: 7px; transition: box-shadow 0.3s ease, border-radius 0.3s ease, border-left 0.3s ease }.md-alert.md-alert-warning:hover { border-left: calc(8px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) solid #9A6700; box-shadow: calc(0px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) calc(1px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) calc(3px + 3px * var(--alert-hover-effect) * var(--use-dynamic-effect)) rgba(0, 0, 0, calc(0.15 * var(--alert-hover-effect) * var(--use-dynamic-effect))); border-radius: calc(7px + 8px * var(--alert-hover-effect) * var(--use-dynamic-effect)) }.md-alert.md-alert-warning p:hover { background-color: rgba(154, 103, 0, 0.04) }.md-alert.md-alert-warning ::selection { background-color: rgba(154, 103, 0, 0.09) }.md-alert.md-alert-warning strong, .md-alert.md-alert-warning em, .md-alert.md-alert-warning code, .md-alert.md-alert-warning a { color: rgba(154, 103, 0, 1) }.md-alert.md-alert-warning table thead, .md-alert.md-alert-warning .md-table-fig .md-table thead { background-color: rgba(183, 131, 28, 1); color: rgba(250, 251, 250, 1) }.md-alert.md-alert-warning ul .md-list-item::marker,.md-alert.md-alert-warning ul ul .md-list-item::marker,.md-alert.md-alert-warning ul ul .md-list-item::marker,.md-alert.md-alert-warning ol .md-list-item:hover::marker { color: rgba(154, 103, 0, 1) }.md-alert.md-alert-important { padding: 0.5rem 1rem; border-left: 8px solid rgba(130, 80, 223, 1); background-color: rgba(234, 230, 242, 1); border-radius: 7px; transition: box-shadow 0.3s ease, border-radius 0.3s ease, border-left 0.3s ease }.md-alert.md-alert-important:hover { border-left: calc(8px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) solid #8250DF; box-shadow: calc(0px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) calc(1px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) calc(3px + 3px * var(--alert-hover-effect) * var(--use-dynamic-effect)) rgba(0, 0, 0, calc(0.15 * var(--alert-hover-effect) * var(--use-dynamic-effect))); border-radius: calc(7px + 8px * var(--alert-hover-effect) * var(--use-dynamic-effect)) }.md-alert.md-alert-important p:hover { background-color: rgba(130, 80, 223, 0.04) }.md-alert.md-alert-important ::selection { background-color: rgba(130, 80, 223, 0.09) }.md-alert.md-alert-important strong, .md-alert.md-alert-important em, .md-alert.md-alert-important code, .md-alert.md-alert-important a { color: rgba(130, 80, 223, 1) }.md-alert.md-alert-important table thead, .md-alert.md-alert-important .md-table-fig .md-table thead { background-color: rgba(149, 102, 238, 1); color: rgba(250, 251, 250, 1) }.md-alert.md-alert-important ul .md-list-item::marker,.md-alert.md-alert-important ul ul .md-list-item::marker,.md-alert.md-alert-important ul ul .md-list-item::marker,.md-alert.md-alert-important ol .md-list-item:hover::marker { color: rgba(130, 80, 223, 1) }.md-alert.md-alert-note { padding: 0.5rem 1rem; border-left: 8px solid rgba(9, 105, 218, 1); background-color: rgba(229, 235, 241, 1); border-radius: 7px; transition: box-shadow 0.3s ease, border-radius 0.3s ease, border-left 0.3s ease }.md-alert.md-alert-note:hover { border-left: calc(8px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) solid #0969DA; box-shadow: calc(0px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) calc(1px + 1px * var(--alert-hover-effect) * var(--use-dynamic-effect)) calc(3px + 3px * var(--alert-hover-effect) * var(--use-dynamic-effect)) rgba(0, 0, 0, calc(0.15 * var(--alert-hover-effect) * var(--use-dynamic-effect))); border-radius: calc(7px + 8px * var(--alert-hover-effect) * var(--use-dynamic-effect)) }.md-alert.md-alert-note p:hover { background-color: rgba(9, 105, 218, 0.04) }.md-alert.md-alert-note ::selection { background-color: rgba(9, 105, 218, 0.09) }.md-alert.md-alert-note strong, .md-alert.md-alert-note em, .md-alert.md-alert-note code, .md-alert.md-alert-note a { color: rgba(9, 105, 218, 1) }.md-alert.md-alert-note table thead, .md-alert.md-alert-note .md-table-fig .md-table thead { background-color: rgba(53, 129, 217, 1); color: rgba(250, 251, 250, 1) }.md-alert.md-alert-note ul .md-list-item::marker,.md-alert.md-alert-note ul ul .md-list-item::marker,.md-alert.md-alert-note ul ul .md-list-item::marker,.md-alert.md-alert-note ol .md-list-item:hover::marker { color: rgba(9, 105, 218, 1) }.md-alert p { margin: 0.1rem 0 }blockquote code, .md-alert.md-alert-tip code, .md-alert.md-alert-caution code, .md-alert.md-alert-warning code, .md-alert.md-alert-important code, .md-alert.md-alert-note code { background-color: rgba(103, 103, 103, 0.09) }.md-alert.md-alert-tip .md-fences::before, .md-alert.md-alert-caution .md-fences::before, .md-alert.md-alert-warning .md-fences::before, .md-alert.md-alert-important .md-fences::before, .md-alert.md-alert-note .md-fences::before { background: rgba(252, 98, 93, 1); box-shadow: 20px 0 rgba(253, 188, 64, 1), 40px 0 rgba(53, 205, 75, 1) }blockquote td, .md-alert.md-alert-tip td, .md-alert.md-alert-caution td, .md-alert.md-alert-warning td, .md-alert.md-alert-important td, .md-alert.md-alert-note td { background-color: rgba(250, 250, 250, 1) }.md-alert-text-container { font-size: 20px }hr { position: relative; margin-top: 2rem; margin-bottom: 2rem; border-top: 2px solid rgba(0, 0, 0, 0); border-right: none; border-bottom: none; border-left: none; background-image: linear-gradient(90deg, rgba(94, 166, 124, 1), rgba(47, 132, 94, 1), rgba(94, 166, 124, 1)); height: 1.5px; overflow: visible; color: rgba(171, 178, 191, 1); opacity: 0.8; border-radius: 5px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15); animation: 0.5s ease-in-out dashanimation; transition: transform 0.3s ease, background-position 0.3s ease, height 0.3s ease; background-size: 200% 100%; background-position: left top }hr:hover { background-position: calc(100% * var(--hr-hover-effect) * var(--use-dynamic-effect)), 0; transform: scale(calc(1 + 0.02 * var(--hr-hover-effect) * var(--use-dynamic-effect))); height: calc(1.5px + 1px * var(--hr-hover-effect) * var(--use-dynamic-effect)) }@keyframes dashAnimation { 0% { width: calc(100% - 100% * var(--hr-hover-effect) * var(--use-dynamic-effect)); opacity: calc(1 - 1 * var(--hr-hover-effect) * var(--use-dynamic-effect)) } 100% { width: 100%; opacity: 1 } }table, .md-table-fig .md-table { border: 1px solid rgba(221, 221, 221, 1); border-radius: 10px; border-collapse: separate; overflow: hidden }table th, table td, .md-table-fig .md-table th, .md-table-fig .md-table td { padding: 10px 16px; border-top: 1px solid rgba(221, 221, 221, 1); border-left: 1px solid rgba(221, 221, 221, 1); transition: font-size 0.3s ease }table th:hover, table td:hover, .md-table-fig .md-table th:hover, .md-table-fig .md-table td:hover { font-size: calc(100% + 10% * var(--table-hover-effect) * var(--use-dynamic-effect)) }table th:first-child, table td:first-child, .md-table-fig .md-table th:first-child, .md-table-fig .md-table td:first-child { border-left: 0 }table thead, .md-table-fig .md-table thead { background-color: rgba(239, 245, 242, 1); color: rgba(6, 98, 30, 1) }table caption+thead tr:first-child th, table caption+thead tr:first-child td, table colgroup+thead tr:first-child th, table colgroup+thead tr:first-child td, table thead+tbody tr:first-child th, table thead+tbody tr:first-child td, table thead:first-child tr:first-child th, table thead:first-child tr:first-child td, .md-table-fig .md-table caption+thead tr:first-child th, .md-table-fig .md-table caption+thead tr:first-child td, .md-table-fig .md-table colgroup+thead tr:first-child th, .md-table-fig .md-table colgroup+thead tr:first-child td, .md-table-fig .md-table thead+tbody tr:first-child th, .md-table-fig .md-table thead+tbody tr:first-child td, .md-table-fig .md-table thead:first-child tr:first-child th, .md-table-fig .md-table thead:first-child tr:first-child td { border-top: 0 }table tbody+tbody, .md-table-fig .md-table tbody+tbody { border-top: 2px solid rgba(232, 244, 238, 1) }.md-table-fig .md-table-edit { background-color: rgba(255, 255, 255, 1) }.md-table-fig .md-table-edit .btn-default:hover { background-color: rgba(232, 244, 238, 1) }.md-table-fig .md-table-edit .md-table-resize-popover { -webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.12); border: none; padding: 0; background-color: rgba(0, 0, 0, 0) }.md-table-fig .md-table-edit .md-table-resize-popover .arrow { top: -10px }.md-table-fig .md-table-edit .md-table-resize-popover .arrow::after { border-bottom-color: rgba(221, 221, 221, 1) }.md-table-fig .md-table-edit .md-table-resize-popover .md-reset { border-radius: 10px; background-color: rgba(255, 255, 255, 1) }.md-table-fig .md-table-edit .md-table-resize-popover .md-reset input { color: rgba(40, 44, 52, 1) !important }.md-table-fig .md-table-edit .md-table-resize-popover .md-reset input#md-grid-width, .md-table-fig .md-table-edit .md-table-resize-popover .md-reset input#md-grid-height { text-align: center }.md-table-fig .md-table-edit .md-table-resize-popover .popover-title { border-top: 1px solid rgba(238, 238, 238, 1) }#write pre.md-meta-block { background: rgba(234, 243, 236, 1); color: rgba(63, 138, 95, 1); border: 0; border-radius: 6px; line-height: 1.3rem; padding: 0.5rem 1.5rem; margin-top: -1rem; margin-bottom: 2rem }.md-toc { margin-bottom: 1.25rem }.md-task-list-item>input::before { content: ""; position: absolute; top: -1.5px; left: -3.5px; border-radius: 50%; width: 20px; height: 20px; border: 1px solid rgba(115, 115, 115, 1); background: rgba(255, 255, 255, 1); -webkit-transition: background-color 200ms ease-in-out; transition: background-color 200ms ease-in-out }.md-task-list-item>input::after { content: ""; position: absolute; top: 5px; left: 1px; width: 0.6rem; height: 0.3rem; border-top: 0; border-right: 0; border-bottom: 2px solid rgba(255, 255, 255, 1); border-left: 2px solid rgba(255, 255, 255, 1); -webkit-transform: rotate(-45deg); transform: rotate(-45deg); opacity: 0; -webkit-transition: opacity 200ms ease-in-out; transition: opacity 200ms ease-in-out }.md-task-list-item>input:checked::before { background-color: rgba(57, 155, 111, 1); border: none }.md-task-list-item>input:checked::after { opacity: 1 }.md-task-list-item.task-list-done { text-decoration: line-through; color: rgba(153, 153, 153, 1) }.footnotes { font-size: 1rem }.mathjax-block:active, .mathjax-block:focus, .md-htmlblock:active, .md-htmlblock:focus { -webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.12) }.mathjax-block:hover .md-rawblock-container, .mathjax-block:hover .md-rawblock-tooltip, .md-htmlblock:hover .md-rawblock-container, .md-htmlblock:hover .md-rawblock-tooltip { background-color: rgba(245, 246, 247, 1); -webkit-animation: showRawBlockTooltip 0s linear; animation: 0s linear showrawblocktooltip }.mathjax-block:hover .md-rawblock-container, .md-htmlblock:hover .md-rawblock-container { border-radius: 6px 0 6px 6px }.mathjax-block .md-rawblock-control, .md-htmlblock .md-rawblock-control { background-color: rgba(245, 246, 247, 1) }.mathjax-block .md-rawblock-tooltip, .md-htmlblock .md-rawblock-tooltip { background-color: rgba(245, 246, 247, 1); -webkit-animation: showRawBlockTooltip 0s linear; animation: 0s linear showrawblocktooltip; border-radius: 4px 4px 0 0 }.mathjax-block .md-mathblock-panel .code-tooltip { -webkit-box-shadow: none; box-shadow: none }.mathjax-block .md-mathblock-panel .md-rawblock-before { padding-top: 6px; border-top-left-radius: 6px }.mathjax-block .md-mathblock-panel .md-rawblock-after { padding-bottom: 6px }.mathjax-block .md-mathblock-panel .md-rawblock-input .cm-s-inner { color: rgba(40, 44, 52, 1) }.mathjax-block .md-mathblock-panel .md-rawblock-input .cm-s-inner .CodeMirror-lines { color: rgba(40, 44, 52, 1) }.mathjax-block .md-mathblock-panel .md-rawblock-input .cm-s-inner .CodeMirror-gutters { background-color: rgba(245, 246, 247, 1) }.mathjax-block .md-mathblock-panel .md-rawblock-input .cm-s-inner .CodeMirror-selected, .mathjax-block .md-mathblock-panel .md-rawblock-input .cm-s-inner .CodeMirror-selectedtext { background-color: rgba(186, 198, 233, 1) !important }.mathjax-block .md-math-container { padding-top: 10px; padding-bottom: 10px }.md-htmlblock .md-htmlblock-panel { border-radius: 10px 0 10px 10px; padding-left: 6px; padding-right: 6px }.md-htmlblock .md-htmlblock-panel .md-rawblock-input { padding-top: 14px; padding-bottom: 10px }.md-htmlblock .md-htmlblock-panel .md-rawblock-input .cm-s-inner .CodeMirror-selected, .md-htmlblock .md-htmlblock-panel .md-rawblock-input .cm-s-inner .CodeMirror-selectedtext { background-color: rgba(222, 242, 232, 1) !important }strong { font-weight: bold; color: rgba(6, 98, 30, 1); font-size: 1.05rem; transition: font-size 0.3s ease, padding 0.3s ease; display: inline-block; margin: 0 2px }strong:hover { font-size: calc(1.05rem + 0.05rem * var(--strong-hover-effect) * var(--use-dynamic-effect)); padding: calc(0px + 3px * var(--strong-hover-effect) * var(--use-dynamic-effect)) }em { background-color: inherit; color: rgba(0, 0, 0, 1); transition: all 0.3s ease; padding-left: 1px; padding-right: 1px }em:hover { color: rgba(0, 100, 0, 1); font-weight: calc(500 + 100 * var(--em-hover-effect) * var(--use-dynamic-effect)); padding-left: calc(1px + 2px * var(--em-hover-effect) * var(--use-dynamic-effect)); padding-right: calc(1px + 2px * var(--em-hover-effect) * var(--use-dynamic-effect)) }u { background-color: inherit; color: inherit; text-decoration: none; border-bottom: 2px solid rgba(9, 156, 70, 1); padding-bottom: 2.5px; transition: all 0.3s ease }u:hover { border-top: ; border-right: ; border-bottom: 2px solid rgba(9, 156, 70, 1); border-left: ; padding: 2.5px; margin: calc(0px + 4px * var(--u-hover-effect) * var(--use-dynamic-effect)); border-radius: calc(0px + 7px * var(--u-hover-effect) * var(--use-dynamic-effect)) }h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { font-size: inherit }code { background-color: rgba(221, 235, 213, 0.5); color: rgba(53, 157, 9, 1); font-family: "Fira Code", Consolas, "Lucida Console", "Courier", monospace, "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1rem; margin: 0 2px; padding: 3px 3px 1px; border-radius: 7px; transition: all 0.3s ease; z-index: -1 }code:hover { background-color: rgba(221, 235, 213, calc(0.5 + 0.5 * var(--code-hover-effect) * var(--use-dynamic-effect))); font-weight: calc(550 + 150 * var(--code-hover-effect) * var(--use-dynamic-effect)); padding: 3px 3px calc(1px + 2px * var(--code-hover-effect) * var(--use-dynamic-effect)) }del { color: rgba(50, 100, 50, 0.5); text-decoration: rgba(76, 175, 80, 0.7) line-through; text-decoration-thickness: 1.5px; font-style: italic; opacity: 0.8; transition: color 0.3s ease, opacity 0.3s ease }del:hover { color: rgba(50, 100, 50, calc(0.5 + 0.5 * var(--del-hover-effect) * var(--use-dynamic-effect))); opacity: calc(0.8 + 0.2 * var(--del-hover-effect) * var(--use-dynamic-effect)); text-decoration-color: rgba(76, 175, 80, calc(0.7 + 0.3 * var(--del-hover-effect) * var(--use-dynamic-effect))) }mark { font-weight: 500; background-color: rgba(174, 230, 195, 1); color: inherit; margin: 0 2px; padding: 3px 3px 2.5px; border-radius: 0; transition: all 0.3s ease }mark:hover { border-radius: calc(0px + 7px * var(--mark-hover-effect) * var(--use-dynamic-effect)); background-color: rgba(174, 230, 195, calc(1 - 0.5 * var(--mark-hover-effect) * var(--use-dynamic-effect))); padding: 3px 3px calc(2.5px + 1.5px * var(--mark-hover-effect) * var(--use-dynamic-effect)) }a { background-color: inherit; color: rgba(12, 143, 148, 1); text-decoration: none; transition: color 0.3s ease }a:hover { text-decoration: underline; color: rgba(2, 80, 42, 1) }a img { border: none }.md-fences { font-family: "Fira Code", Consolas, "Lucida Console", "Courier", monospace, "Helvetica Neue", Helvetica, Arial, sans-serif; color: rgba(47, 79, 79, 1); background-color: rgba(255, 255, 255, 1); padding: 32px 17px 17px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); transition: transform 0.3s ease, box-shadow 0.3s ease; position: relative }.md-fences::before { background: rgba(1, 94, 25, 1); border-radius: 50%; box-shadow: 20px 0 rgba(6, 143, 40, 1), 40px 0 rgba(116, 219, 38, 1); content: " "; height: 12px; width: 12px; position: absolute; left: 13px; top: 12px; transition: all 0.3s ease }@keyframes bounce-code { 0%, 100% { width: 100%; height: 100%; transform: translate(0, 0) } 50% { transform: translate(calc(-3px * var(--fence-hover-effect) * var(--use-dynamic-effect)), calc(-3px * var(--fence-hover-effect) * var(--use-dynamic-effect))) } }.md-fences:hover { animation: 0.5s ease-in-out bounce-code; box-shadow: 0 calc(1px + 1px * var(--fence-hover-effect) * var(--use-dynamic-effect)) calc(3px + 1px * var(--fence-hover-effect) * var(--use-dynamic-effect)) rgba(0, 0, 0, calc(0.15 + 0.05 * var(--fence-hover-effect) * var(--use-dynamic-effect))) }.md-fences:hover::before { background: rgba(252, 98, 93, 1); box-shadow: 20px 0 rgba(253, 188, 64, 1), 40px 0 rgba(53, 205, 75, 1) }.code-tooltip { border-radius: 7px }.cm-s-inner .CodeMirror-linenumber { margin-left: 7px; margin-right: 3px; color: rgba(47, 132, 94, 1) }.cm-s-inner .cm-keyword { color: rgba(34, 47, 167, 1); font-weight: bold }.cm-s-inner .cm-operator { color: rgba(0, 100, 0, 1) }.cm-s-inner .cm-variable { color: rgba(35, 157, 55, 1); font-weight: bold }.cm-s-inner .cm-variable-2 { color: rgba(16, 137, 121, 1) }.cm-s-inner .cm-variable-3 { color: rgba(24, 61, 162, 1); font-weight: bold; font-style: italic }.cm-s-inner .cm-builtin { color: rgba(0, 100, 0, 1); font-style: italic }.cm-s-inner .cm-atom { color: rgba(59, 143, 143, 1) }.cm-s-inner .cm-number { color: rgba(62, 25, 207, 1) }.cm-s-inner .cm-def { color: rgba(16, 98, 62, 1); font-weight: bold }.cm-s-inner .cm-string { color: rgba(2, 100, 191, 1); font-style: italic }.cm-s-inner .cm-string-2 { color: rgba(107, 142, 35, 1) }.cm-s-inner .cm-comment { color: rgba(106, 115, 125, 1); font-style: italic }.cm-s-inner .cm-tag { color: rgba(4, 44, 153, 1) }.cm-s-inner .cm-attribute { color: rgba(43, 52, 227, 1) }.cm-s-inner .cm-property { color: rgba(46, 139, 87, 1) }.cm-s-inner .cm-qualifier { color: rgba(46, 139, 87, 1) }.cm-s-inner .cm-meta { color: rgba(9, 159, 139, 1); font-weight: bold; font-style: italic }.cm-s-inner .cm-link { color: rgba(21, 101, 192, 1); text-decoration: underline }.cm-s-inner .cm-error { color: rgba(211, 47, 47, 1); background-color: rgba(255, 221, 221, 1) }.cm-s-inner .cm-boolean { color: rgba(34, 139, 34, 1); font-weight: bold }.cm-s-inner .cm-type { color: rgba(21, 101, 192, 1); font-weight: bold }.cm-s-inner .cm-header { color: rgba(46, 139, 87, 1); font-weight: bold }.cm-s-inner .cm-quote { color: rgba(53, 3, 168, 1); font-style: italic }::-webkit-scrollbar { width: 8px }::-webkit-scrollbar-track { background: rgba(250, 250, 250, 1) }::-webkit-scrollbar-thumb { background: linear-gradient(45deg, rgba(74, 173, 35, 1), rgba(27, 91, 62, 1)) !important; border-radius: 5px }#typora-quick-open { background-color: rgba(255, 255, 255, 1); color: rgba(40, 44, 52, 1) }#typora-quick-open .typora-quick-open-item.active { background-color: rgba(186, 198, 233, 1) !important }#typora-quick-open .ty-quick-open-category-title { border-top: 1px solid rgba(238, 238, 238, 1) !important }#common-dialog .modal-dialog .modal-content { -webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.12); background-color: rgba(245, 246, 247, 1); border: none; border-radius: 6px }#common-dialog .modal-dialog .modal-content .modal-footer .btn-default:hover { background-color: rgba(186, 198, 233, 1) !important }.ty-preferences { font-family: "Fira Code", Consolas, "Lucida Console", "Courier", monospace, "Helvetica Neue", Helvetica, Arial, sans-serif; color: rgba(40, 44, 52, 1) }.ty-preferences .window-header h2 { font-size: 1.6rem }.ty-preferences .sidebar { font-size: 1.4rem }.ty-preferences .sidebar .nav-group-item.active, .ty-preferences .sidebar .nav-group-item:active { color: rgba(239, 239, 239, 1); background-color: rgba(47, 132, 94, 1) }.html-for-mac #typora-sidebar { -webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.12) }#md-notification { background-color: rgba(255, 255, 255, 1) !important }#md-notification #ty-surpress-mode-warning-close-btn:hover { background-color: rgba(186, 198, 233, 1) !important }#megamenu-menu-sidebar { color: rgba(40, 44, 52, 1); font-size: 1rem }#megamenu-menu-sidebar #megamenu-menu-list { border-top-color: rgba(47, 53, 58, 1); background-color: rgba(47, 53, 58, 1) }#megamenu-menu-sidebar #megamenu-menu-list li a { color: rgba(227, 222, 222, 1) !important }#megamenu-menu-sidebar #megamenu-menu-list li a.active, #megamenu-menu-sidebar #megamenu-menu-list li a:hover { background-color: rgba(62, 66, 73, 1) !important }#megamenu-menu-sidebar #megamenu-menu-list li a#m-saved { background-color: rgba(0, 0, 0, 0) !important }.megamenu-opened .megamenu-menu { left: 0 }#megamenu-content { color: rgba(0, 0, 0, 1) }#typora-sidebar .info-panel-tab-wrapper .info-panel-tab .info-panel-tab-border { background-color: rgba(47, 132, 94, 1); border-radius: 4px }#typora-sidebar .sidebar-osx-tab .sidebar-tabs { border-bottom-color: rgba(0, 0, 0, 0) }#typora-sidebar #sidebar-content .file-list-item { border-bottom: 1px solid rgba(238, 238, 238, 1) }#typora-sidebar #sidebar-content .file-list-item.active { background-color: rgba(66, 185, 131, 0.1); border-left: 4px solid rgba(47, 132, 94, 1) }#typora-sidebar #sidebar-content .ty-sidebar-search-panel { border-bottom: 1px solid rgba(238, 238, 238, 1) }#typora-sidebar #sidebar-content .ty-sidebar-search-panel .searchpanel-search-option-btn { background-color: rgba(255, 255, 255, 1) }#typora-sidebar #sidebar-content .sidebar-content-content .file-tree-node:not(.file-node-root):hover>.file-node-background { border-left: 4px solid rgba(47, 132, 94, 1); background-color: rgba(66, 185, 131, 0.1) }#typora-sidebar #sidebar-content .sidebar-content-content .file-tree-node.active>.file-node-background { border-color: rgba(47, 132, 94, 1); background-color: rgba(66, 185, 131, 0.1) }#typora-sidebar #sidebar-content .sidebar-content-content #file-library-list-children .file-library-file-node:hover { border-left: 4px solid rgba(47, 132, 94, 1); background-color: rgba(66, 185, 131, 0.1) }#typora-sidebar #sidebar-content #outline-content .no-collapse-outline .outline-item { line-height: 1.375rem; font-size: 1rem }#typora-sidebar #sidebar-content #outline-content .outline-expander:before { color: inherit; font-size: 14px; top: auto; content: ""; font-family: FontAwesome }#typora-sidebar #sidebar-content #outline-content .outline-expander:hover:before, #typora-sidebar #sidebar-content #outline-content .outline-item-open>.outline-item>.outline-expander:before { content: "" }#typora-sidebar #sidebar-content #outline-content .outline-item:hover { background-color: rgba(232, 244, 238, 1) !important }#typora-sidebar #ty-sidebar-footer { border-top: 1px solid rgba(238, 238, 238, 1) }#typora-sidebar #ty-sidebar-footer .sidebar-footer-item:hover { background-color: rgba(202, 235, 219, 1) !important }#typora-sidebar #ty-sidebar-footer #sidebar-files-menu { -webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.12) }.dropdown-menu>.show+.menuitem-group-label.show { border-top: 1px solid rgba(238, 238, 238, 1) !important }.dropdown-menu li a { color: rgba(40, 44, 52, 1) !important }.dropdown-menu li a:hover { background-color: rgba(232, 244, 238, 1) !important }.dropdown-menu .divider { border-color: rgba(255, 255, 255, 1) }#sidebar-files-menu, #toc-dropmenu, .auto-suggest-container { background-color: rgba(255, 255, 255, 1); -webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.16), 0 2px 10px rgba(0, 0, 0, 0.12); border: none }#toc-dropmenu .outline-item:hover { background-color: rgba(202, 235, 219, 1) !important }.auto-suggest-container { padding-top: 4px; padding-bottom: 4px }.auto-suggest-container li.active, .auto-suggest-container li:hover { background-color: rgba(212, 238, 225, 1) !important }#typora-source { font-family: "Fira Code", Consolas, "Lucida Console", "Courier", monospace, "Helvetica Neue", Helvetica, Arial, sans-serif; color: rgba(106, 106, 106, 1) }#typora-source .cm-s-typora-default .cm-header, #typora-source .cm-s-typora-default .cm-property, #typora-source .CodeMirror.cm-s-typora-default div.CodeMirror-cursor { color: rgba(66, 139, 202, 1) }#typora-source .cm-s-typora-default .cm-atom, #typora-source .cm-s-typora-default .cm-number { color: rgba(119, 119, 119, 1) }#typora-source .CodeMirror-selectedtext { background-color: rgba(0, 0, 0, 0) !important }.typora-node .file-list-item-parent-loc, .typora-node .file-list-item-time, .typora-node .file-list-item-summary { font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", sans-serif }在Unity中玩转表达式树:解锁游戏逻辑的动态魔法
在Unity 2021 LTS版本中,结合Burst Compiler可以将表达式树编译后的委托性能提升至接近原生C++代码水平,特别适合高频调用的游戏系统(如物理伤害计算、AI决策等)
参考:git-amend
Expression
一、为什么要学习表达式树?
传统Unity开发面临三大痛点:
[*]逻辑固化 - 编译后无法修改行为逻辑
[*]组件强耦合 - GameObject之间依赖关系复杂
[*]动态性不足 - 难以实现运行时逻辑热替换
表达式树(Expression Trees)技术通过将代码转换为可操作的数据结构,完美解决了这些问题。它允许我们:
[*]运行时动态构建逻辑运行时动态构建逻辑
[*]实现组件间的弱耦合通信实现组件间的弱耦合通信
[*]支持可视化配置游戏行为支持可视化配置游戏行为
二、核心应用场景
[*]动态技能系统
[*]数据驱动AI
[*]通过JSON配置行为树
[*]运行时解析并生成表达式
[*]实现无需重新编译的AI逻辑更新
[*]MOD支持系统
[*]玩家自定义逻辑脚本
[*]安全沙箱运行表达式
[*]实时加载玩家创作内容
三、实战演示
一、 属性获取器
传统模式缺陷:
xxxxxxxxxx
public int GetPlayerStat(Player p, string statName)
{ switch(statName) { case "Health": return p.Health; case "Mana": return p.Mana; // 每新增一个属性需要修改此处 }}
表达式树:
xxxxxxxxxx
using System;
using System.Linq.Expressions;using UnityEngine;public class ExpressionTreeDemo : MonoBehaviour { void Start() { Player player = new () { Health = 100 }; Func<Player, int> healthProperty = CreatePropertyGetter<Player, int>("Health"); Debug.Log($"Player Health: {healthProperty(player)}"); } public int GetPlayerStat(Player player, string statName) { Func<Player, int> propertyGetter = CreatePropertyGetter<Player, int>(statName); return propertyGetter(player); } public Func<T, TProperty> CreatePropertyGetter<T, TProperty>(string propertyName) { ParameterExpression param = Expression.Parameter(typeof(T), "x"); MemberExpression property = Expression.Property(param, propertyName); Expression<Func<T, TProperty>> lambda = Expression.Lambda<Func<T, TProperty>>(property, param); return lambda.Compile(); }}
应用场景:获取对象属性 技术要点:
[*]属性访问表达式属性访问表达式:Expression.Property
二、条件触发系统
xxxxxxxxxx
public class ConditionTrigger : MonoBehaviour
{ public string ConditionExpression = "Player.Health.CurrentHP < 0.3"; public GameObject ContextObject; private Func<GameObject, bool> _compiledCondition; private static Dictionary<string, Func<GameObject, bool>> _cache = new(); void Start() { if (!_cache.TryGetValue(ConditionExpression, out _compiledCondition)) { var elements = ConditionExpression.Split('.'); var rootObj = Expression.Parameter(typeof(GameObject), "context"); Expression accessChain = rootObj; foreach (var element in elements.Skip(1)) { accessChain = Expression.PropertyOrField(accessChain, element); } var conditionExpr = BuildComparison(accessChain, "<", Expression.Constant(0.3f)); _compiledCondition = Expression.Lambda<Func<GameObject, bool>>(conditionExpr, rootObj).Compile(); _cache = _compiledCondition; } } void Update() { if (_compiledCondition(ContextObject)) { Debug.Log("触发条件!"); } } private Expression BuildComparison(Expression left, string operatorStr, Expression right) { return operatorStr switch { "<" => Expression.LessThan(left, right), ">" => Expression.GreaterThan(left, right), "==" => Expression.Equal(left, right), "!=" => Expression.NotEqual(left, right), "<=" => Expression.LessThanOrEqual(left, right), ">=" => Expression.GreaterThanOrEqual(left, right), _ => throw new NotSupportedException($"不支持的运算符: {operatorStr}") }; }}
应用场景:动态游戏事件触发 优势对比:
传统方式表达式树方案硬编码条件判断支持运行时修改条件逻辑需要预定义所有情况可通过配置文件动态加载三、行为链组合
xxxxxxxxxx
using System;
using System.Collections.Generic;using System.Linq;using System.Linq.Expressions;using UnityEngine;// 使用示例public class ComboExample : MonoBehaviour{ private ComboSystem _comboSystem; void Start() { _comboSystem = new ComboSystem(); // 添加连招动作 _comboSystem.ActionExpressions.Add(GetComboExpression(typeof(AttackAnimation), nameof(AttackAnimation.Play), Expression.Constant("SwordSwing"))); _comboSystem.ActionExpressions.Add(GetComboExpression(typeof(EffectsManager), nameof(EffectsManager.Spawn), Expression.Constant("SwordHit"))); _comboSystem.ActionExpressions.Add(GetComboExpression(typeof(AttackAnimation), nameof(AttackAnimation.Play), Expression.Constant("SwordSwing2"))); _comboSystem.ActionExpressions.Add(GetComboExpression(typeof(DamageCalculator), nameof(DamageCalculator.Apply), Expression.Constant(new Vector3(0, 1, 0)), Expression.Constant(100f))); // 执行连招 _comboSystem.ExecuteCombo(); } Expression<Action> GetComboExpression(Type type, string methodName, params Expression[] args) { return Expression.Lambda<Action>(Expression.Call(type, methodName, null, args)); }}public class ComboSystem{ // 存储动作表达式的列表 public List<Expression<Action>> ActionExpressions = new(); // 执行连招 public void ExecuteCombo() { // 构建复合表达式 var comboBlock = Expression.Block( ActionExpressions.Select(exp => exp.Body) ); // 创建最终的表达式 //Compile() 方法将 Lambda 表达式编译为可执行的委托。 //Invoke() 方法调用该委托,从而执行块中的所有表达式。 var finalExpr = Expression.Lambda<Action>(comboBlock); finalExpr.Compile().Invoke(); // 执行连招 }}// 示例动作类public class AttackAnimation{ public static void Play(string animationName) { Debug.Log($"播放动画: {animationName}"); }}public class EffectsManager{ public static void Spawn(string effectName) { Debug.Log($"生成特效: {effectName}"); }}public class DamageCalculator{ public static void Apply(Vector3 position, float damage) { Debug.Log($"应用伤害: {damage} 到位置: {position}"); }}//生成特效: SwordHit//播放动画: SwordSwing2//应用伤害: 100 到位置: (0.00, 1.00, 0.00)
Expression.Block:
Expression.Block 是一个非常强大的功能,它允许我们将多个表达式组合成一个块(block),并在执行时按顺序执行这些表达式。
四、运行时状态机
xxxxxxxxxx
using System;
using System.Linq.Expressions;using System.Reflection;using UnityEngine;using Object = UnityEngine.Object;public class EnemyStateMachine : MonoBehaviour { //定义状态机委托,以Enemy和Hero为参数,返回一个以Enemy和Hero为参数的空方法 //它会根据英雄的状态(如生命值和距离)返回一个相应的行为函数。 Func<Enemy, Hero, Action<Enemy, Hero>> stateEvaluator; //存储当前行为函数 Action<Enemy, Hero> behavior; Enemy enemy; Hero hero; void Start() { enemy = FindObjectOfType<Enemy>(); hero = FindObjectOfType<Hero>(); stateEvaluator = CreateDynamicStateMachine(); } void Update() { //获取当前行为 behavior = stateEvaluator(enemy, hero); //执行当前行为 behavior(enemy, hero); Debug.Log("Enemy Aggression Level:", enemy.AggressionLevel); } public Func<Enemy, Hero, Action<Enemy, Hero>> CreateDynamicStateMachine() { //定义参数表达式 ParameterExpression enemyParam = Expression.Parameter(typeof(Enemy), "enemy"); ParameterExpression heroParam = Expression.Parameter(typeof(Hero), "hero"); //定义一个二元表达式 BinaryExpression heroLowHealth = Expression.LessThan( Expression.Property(heroParam, "Health"), Expression.Constant(30) ); BinaryExpression heroNear = Expression.LessThan( Expression.Property(heroParam, "Distance"), Expression.Constant(10f) ); Debug.Log($"HeroLowHealth{heroLowHealth}"); Debug.Log($"HeroNear{heroNear}"); var attack = CreateActionExpression("Attack").Compile(); var taunt = CreateActionExpression("Taunt").Compile(); var patrol = CreateActionExpression("Patrol").Compile(); //条件表达式,如果heroNear为真则执行taunt,否则执行patrol ConditionalExpression tauntOrPatrol = Expression.Condition(heroNear, Expression.Constant(taunt), Expression.Constant(patrol)); ConditionalExpression finalCondition = Expression.Condition(heroLowHealth, Expression.Constant(attack), tauntOrPatrol); // var lambda = Expression.Lambda<Func<Enemy, Hero, Action<Enemy, Hero>>>(finalCondition, enemyParam, heroParam); return lambda.Compile(); } Expression<Action<Enemy, Hero>> CreateActionExpression(string methodName) { ParameterExpression enemyParam = Expression.Parameter(typeof(Enemy), "enemy"); ParameterExpression heroParam = Expression.Parameter(typeof(Hero), "hero"); MethodInfo method = typeof(Enemy).GetMethod(methodName, new[] { typeof(Hero) }); MethodCallExpression call = Expression.Call(enemyParam, method, heroParam); return Expression.Lambda<Action<Enemy, Hero>>(call, enemyParam, heroParam); }}
CreateDynamicStateMachine
[*]参数定义:定义了两个参数 enemyParam 和 heroParam,用于表示敌人和英雄。
[*]条件表达式:
[*]heroLowHealth: 检查英雄的生命值是否低于 30。
[*]heroNear: 检查英雄与敌人的距离是否小于 10。
[*]行为选择:
[*]使用 CreateActionExpression 方法创建 Attack、Taunt 和 Patrol 行为的表达式。
[*]使用 Expression.Condition 创建条件表达式,根据条件选择行为。
[*]返回 Lambda 表达式:最终返回一个 Lambda 表达式,接受 Enemy 和 Hero 作为参数,并返回相应的行为函数。
CreateActionExpression
[*]参数定义:定义 enemyParam 和 heroParam。
[*]获取方法信息:使用反射获取 Enemy 类中与 methodName 相对应的方法。
[*]创建方法调用表达式:使用 Expression.Call 创建方法调用表达式,并返回一个 Lambda 表达式。
页:
[1]