📄 node20.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!--Converted with LaTeX2HTML 2002-2-1 (1.71)original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>Inherit Behavior</TITLE><META NAME="description" CONTENT="Inherit Behavior"><META NAME="keywords" CONTENT="howtorobocop"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="howtorobocop.css"><LINK REL="next" HREF="node21.html"><LINK REL="previous" HREF="node19.html"><LINK REL="up" HREF="node19.html"><LINK REL="next" HREF="node21.html"></HEAD><BODY ><DIV CLASS="navigation"><!--Navigation Panel--><A NAME="tex2html338" HREF="node21.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html334" HREF="node19.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html328" HREF="node19.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html336" HREF="node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="/usr/share/latex2html/icons/contents.png"></A> <BR><B> Next:</B> <A NAME="tex2html339" HREF="node21.html">Constructor (defining slots)</A><B> Up:</B> <A NAME="tex2html335" HREF="node19.html">Implementing a behavior</A><B> Previous:</B> <A NAME="tex2html329" HREF="node19.html">Implementing a behavior</A> <B> <A NAME="tex2html337" HREF="node1.html">Contents</A></B> <BR><BR></DIV><!--End of Navigation Panel--><H3><A NAME="SECTION00651100000000000000">Inherit Behavior</A></H3><P>The first thing to do when creating a new behavior is to create a class that inherits from the <TT>Behavior</TT> class. It defines a couple of pure virtual methods that each behavior should implement (more on these later):<P><BR><IMG WIDTH="567" HEIGHT="258" ALIGN="BOTTOM" BORDER="0" SRC="img11.png" ALT="\begin{program}\begin{verbatim}class MyBehavior : public Behavior{virtual ......ring const &id,std::string const &playerClass);};\end{verbatim}\end{program}"><BR><P>You can do this by hand, but you can also use the utility script <TT>createbehavior.pl</TT> to do this for you:<P><BR><IMG WIDTH="567" HEIGHT="88" ALIGN="BOTTOM" BORDER="0" SRC="img12.png" ALT="\begin{program}\begin{verbatim}$ cd util/$ ./createbehavior.pl[Enter the behaviors name (e.g. MyBehavior)]\end{verbatim}\end{program}"><BR><P>This creates a directory with your behavior's name in the Behavior directory and fills it with a header file with the necesary method declarations and code files with basic implementations for these methods.<P><BR><HR><ADDRESS>Bram2007-11-18</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -