⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 robot.html

📁 java的机器人大战
💻 HTML
📖 第 1 页 / 共 3 页
字号:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;当被敌人打中时触发</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#onHitRobot(AIplatform.event.HitRobotEvent)">onHitRobot</A></B>(<A HREF="../../AIplatform/event/HitRobotEvent.html">HitRobotEvent</A>&nbsp;event)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;当撞到其它敌人时触发</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#onHitWall(AIplatform.event.HitWallEvent)">onHitWall</A></B>(<A HREF="../../AIplatform/event/HitWallEvent.html">HitWallEvent</A>&nbsp;event)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;当撞到墙时触发</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#onOvertime(AIplatform.event.OvertimeEvent)">onOvertime</A></B>(<A HREF="../../AIplatform/event/OvertimeEvent.html">OvertimeEvent</A>&nbsp;event)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;当机器人执行操作超时时触发 传入一个超时的事件</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#onRobotDeath(AIplatform.event.RobotDeathEvent)">onRobotDeath</A></B>(<A HREF="../../AIplatform/event/RobotDeathEvent.html">RobotDeathEvent</A>&nbsp;event)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;当某个敌人死时触发Example    //输出敌人死亡 public void onRobotDeath(RobotDeathEvent event){       println(event.getName()+" is dead!")</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#onScannedRobot(AIplatform.event.ScannedRobotEvent)">onScannedRobot</A></B>(<A HREF="../../AIplatform/event/ScannedRobotEvent.html">ScannedRobotEvent</A>&nbsp;event)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;当雷达扫描到敌人时触发 用户可以通过覆盖(Override)此函数,扫描到敌人时获取到有用的敌人的信息Example    //基本的雷达锁定实现 public void onScannedRobot(ScannedRobotEvent e){       double absBearing=Math.atan2(e.getY()-getBody().getY(),e.getX()-getBody().getX());   	double radarTurn=standardAngle(absBearing-getRadar().getHeading());   	getRadar().turn((radarTurn+(radarTurn>0?</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#println(java.lang.String)">println</A></B>(java.lang.String&nbsp;info)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在控制台打印信息</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#setBody(AIplatform.robot.Body)">setBody</A></B>(<A HREF="../../AIplatform/robot/Body.html">Body</A>&nbsp;body)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置新的车身控制器</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#setGun(AIplatform.robot.Gun)">setGun</A></B>(<A HREF="../../AIplatform/robot/Gun.html">Gun</A>&nbsp;gun)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置新的炮管控制器</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#setRadar(AIplatform.robot.Radar)">setRadar</A></B>(<A HREF="../../AIplatform/robot/Radar.html">Radar</A>&nbsp;radar)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;设置新的雷达控制器</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#setRobotPeer(AIplatform.battle.peer.RobotPeer)">setRobotPeer</A></B>(AIplatform.battle.peer.RobotPeer&nbsp;robotPeer)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;创建与系统机器人单元的关联( 同时创建各个控制部件的关联 ) 用户不要调用此方法</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../AIplatform/robot/Robot.html#work()">work</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;执行函数,每个单位时间被调用一次 用户可以覆盖此函数,执行自己定义的动作 注意:此函数没单位时间都会自动被系统调用一次,而且此函数必须在规定时间内返回, 否则会触发超时事件(OvertimeEvent),相应的动作可能得不到实现 Example    //机器人一直以8的速度前进   public void work(){       getBody().move(8);   } </TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="Robot()"><!-- --></A><H3>
Robot</H3>
<PRE>
public <B>Robot</B>()</PRE>
<DL>
<DD>构造函数默认创建了机器人的三个部件的控制器
<P>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="setRobotPeer(AIplatform.battle.peer.RobotPeer)"><!-- --></A><H3>
setRobotPeer</H3>
<PRE>
public final void <B>setRobotPeer</B>(AIplatform.battle.peer.RobotPeer&nbsp;robotPeer)</PRE>
<DL>
<DD>创建与系统机器人单元的关联( 同时创建各个控制部件的关联 ) 用户不要调用此方法
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="work()"><!-- --></A><H3>
work</H3>
<PRE>
public void <B>work</B>()</PRE>
<DL>
<DD>执行函数,每个单位时间被调用一次 用户可以覆盖此函数,执行自己定义的动作 注意:此函数没单位时间都会自动被系统调用一次,而且此函数必须在规定时间内返回, 否则会触发超时事件(OvertimeEvent),相应的动作可能得不到实现 <P>Example <PRE>   //机器人一直以8的速度前进   public void work(){       getBody().move(8);   } </PRE>
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>

<A NAME="onScannedRobot(AIplatform.event.ScannedRobotEvent)"><!-- --></A><H3>
onScannedRobot</H3>
<PRE>
public void <B>onScannedRobot</B>(<A HREF="../../AIplatform/event/ScannedRobotEvent.html">ScannedRobotEvent</A>&nbsp;event)</PRE>
<DL>
<DD>当雷达扫描到敌人时触发 用户可以通过覆盖(Override)此函数,扫描到敌人时获取到有用的敌人的信息<P>Example <PRE>   //基本的雷达锁定实现 public void onScannedRobot(ScannedRobotEvent e){       double absBearing=Math.atan2(e.getY()-getBody().getY(),e.getX()-getBody().getX());   	double radarTurn=standardAngle(absBearing-getRadar().getHeading());   	getRadar().turn((radarTurn+(radarTurn>0?0.1d:-0.1d))*1.5d); } </PRE>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>event</CODE> - 扫描到敌人事件</DL>
</DD>
</DL>
<HR>

<A NAME="onBulletHit(AIplatform.event.BulletHitEvent)"><!-- --></A><H3>
onBulletHit</H3>
<PRE>
public void <B>onBulletHit</B>(<A HREF="../../AIplatform/event/BulletHitEvent.html">BulletHitEvent</A>&nbsp;event)</PRE>
<DL>
<DD>当打中某个敌人时触发
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>event</CODE> - 击中敌人事件</DL>
</DD>
</DL>
<HR>

<A NAME="onHitByBullet(AIplatform.event.HitByBulletEvent)"><!-- --></A><H3>
onHitByBullet</H3>
<PRE>
public void <B>onHitByBullet</B>(<A HREF="../../AIplatform/event/HitByBulletEvent.html">HitByBulletEvent</A>&nbsp;event)</PRE>
<DL>
<DD>当被敌人打中时触发
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>event</CODE> - 被击中事件</DL>
</DD>
</DL>
<HR>

<A NAME="onHitRobot(AIplatform.event.HitRobotEvent)"><!-- --></A><H3>
onHitRobot</H3>
<PRE>
public void <B>onHitRobot</B>(<A HREF="../../AIplatform/event/HitRobotEvent.html">HitRobotEvent</A>&nbsp;event)</PRE>
<DL>
<DD>当撞到其它敌人时触发
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>event</CODE> - 和敌人碰撞到的事件</DL>
</DD>
</DL>
<HR>

<A NAME="onHitWall(AIplatform.event.HitWallEvent)"><!-- --></A><H3>
onHitWall</H3>
<PRE>
public void <B>onHitWall</B>(<A HREF="../../AIplatform/event/HitWallEvent.html">HitWallEvent</A>&nbsp;event)</PRE>
<DL>
<DD>当撞到墙时触发
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>event</CODE> - 撞墙事件</DL>
</DD>
</DL>
<HR>

<A NAME="onRobotDeath(AIplatform.event.RobotDeathEvent)"><!-- --></A><H3>
onRobotDeath</H3>
<PRE>
public void <B>onRobotDeath</B>(<A HREF="../../AIplatform/event/RobotDeathEvent.html">RobotDeathEvent</A>&nbsp;event)</PRE>
<DL>
<DD>当某个敌人死时触发<P>Example <PRE>   //输出敌人死亡 public void onRobotDeath(RobotDeathEvent event){       println(event.getName()+" is dead!"); } </PRE>
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>event</CODE> - 机器人(敌人)死亡事件</DL>
</DD>
</DL>
<HR>

<A NAME="onBegin(AIplatform.event.BeginEvent)"><!-- --></A><H3>
onBegin</H3>
<PRE>
public void <B>onBegin</B>(<A HREF="../../AIplatform/event/BeginEvent.html">BeginEvent</A>&nbsp;event)</PRE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -