dirt-racer/docs/html/enemy__car_8hpp_source.html
2024-05-27 13:55:10 +02:00

142 lines
19 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Rally Rush: src/enemy_car.hpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Rally Rush
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.7 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle"><div class="title">enemy_car.hpp</div></div>
</div><!--header-->
<div class="contents">
<a href="enemy__car_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span><span class="preprocessor">#ifndef ENEMY_CAR_HPP</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno"> 2</span><span class="preprocessor">#define ENEMY_CAR_HPP</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno"> 3</span> </div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno"> 4</span><span class="preprocessor">#include &quot;<a class="code" href="car__physics_8hpp.html">car_physics.hpp</a>&quot;</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno"> 5</span><span class="preprocessor">#include &quot;<a class="code" href="car__player_8hpp.html">car_player.hpp</a>&quot;</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno"> 6</span><span class="preprocessor">#include &quot;godot_cpp/classes/navigation_agent3d.hpp&quot;</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno"> 7</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno"> 8</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespacegodot.html">godot</a> {</div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html"> 10</a></span><span class="keyword">class </span><a class="code hl_class" href="classgodot_1_1EnemyCar.html">EnemyCar</a> : <span class="keyword">public</span> <a class="code hl_class" href="classgodot_1_1CarPhysics.html">CarPhysics</a> {</div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html#a4291eb9882de5ac6e0bdd9be6c73a1a6"> 11</a></span> <a class="code hl_function" href="classgodot_1_1EnemyCar.html#a4291eb9882de5ac6e0bdd9be6c73a1a6">GDCLASS</a>(<a class="code hl_class" href="classgodot_1_1EnemyCar.html">EnemyCar</a>, <a class="code hl_class" href="classgodot_1_1CarPhysics.html">CarPhysics</a>);</div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno"> 13</span> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgodot_1_1EnemyCar.html#a194ea73522ba22cca972fde4f6d1e46c">_bind_methods</a>();</div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"> 14</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"> 16</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgodot_1_1EnemyCar.html#ad34f23e213cfc742d498906aabfb58ca">_enter_tree</a>() <span class="keyword">override</span>;</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"> 18</span> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgodot_1_1EnemyCar.html#aa746dea04ad942c35a1ec2e5799c9fe5">_process</a>(<span class="keywordtype">double</span> delta_time) <span class="keyword">override</span>;</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"> 20</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgodot_1_1EnemyCar.html#acd6f3c6792ca36a168f9be7007a2191b">damage</a>();</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgodot_1_1EnemyCar.html#af705a5dc10dc15cc811da244b763b63a">start_fleeing</a>();</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgodot_1_1EnemyCar.html#ababbc5a5d8e7dcff48ccfa648e79d361">stop_fleeing</a>();</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno"> 25</span><span class="keyword">protected</span>:</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"> 27</span> <span class="keywordtype">void</span> <a class="code hl_function" href="classgodot_1_1EnemyCar.html#a609f1f0f7da5cf8489495cb2b24f5677">recalculate_navigation</a>();</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno"> 28</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html#ae0cd81c291f4f2fde194a00050c2b08c"> 30</a></span> <span class="keywordtype">int</span> <a class="code hl_variable" href="classgodot_1_1EnemyCar.html#ae0cd81c291f4f2fde194a00050c2b08c">next_recalc</a>{0};</div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html#a8febc75d9897b032d19991c153e24bad"> 32</a></span> <span class="keywordtype">int</span> <a class="code hl_variable" href="classgodot_1_1EnemyCar.html#a8febc75d9897b032d19991c153e24bad">recalc_frame_interval</a>{60};</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html#a5919af73ab4db7be96162a5c7d8e68ca"> 34</a></span> <span class="keywordtype">float</span> <a class="code hl_variable" href="classgodot_1_1EnemyCar.html#a5919af73ab4db7be96162a5c7d8e68ca">turn_target_speed</a>{3.f};</div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html#a04213c97827cbbc308ed8427c02c5fcb"> 36</a></span> <span class="keywordtype">float</span> <a class="code hl_variable" href="classgodot_1_1EnemyCar.html#a04213c97827cbbc308ed8427c02c5fcb">max_speed</a>{45.f};</div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html#a8995b45e72753e3c2e4a013d3179d8df"> 38</a></span> <span class="keywordtype">float</span> <a class="code hl_variable" href="classgodot_1_1EnemyCar.html#a8995b45e72753e3c2e4a013d3179d8df">brake_distance</a>{7.f};</div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html#a9ab3cce28d16de5cff8990be19d64e30"> 40</a></span> <span class="keywordtype">float</span> <a class="code hl_variable" href="classgodot_1_1EnemyCar.html#a9ab3cce28d16de5cff8990be19d64e30">steering_speed</a>{1.5f};</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html#ae2907a439673e4bcdfc061755c92c6fa"> 42</a></span> <span class="keywordtype">bool</span> <a class="code hl_variable" href="classgodot_1_1EnemyCar.html#ae2907a439673e4bcdfc061755c92c6fa">flee</a>{<span class="keyword">false</span>};</div>
<div class="line"><a id="l00044" name="l00044"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html#a6394ac893a7802d987b80b82e28c37fc"> 44</a></span> NavigationAgent3D *<a class="code hl_variable" href="classgodot_1_1EnemyCar.html#a6394ac893a7802d987b80b82e28c37fc">agent</a>{<span class="keyword">nullptr</span>};</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno"><a class="line" href="classgodot_1_1EnemyCar.html#af887aaa9e94400d4727b732535514d8e"> 46</a></span> <a class="code hl_class" href="classgodot_1_1CarPlayer.html">CarPlayer</a> *<a class="code hl_variable" href="classgodot_1_1EnemyCar.html#af887aaa9e94400d4727b732535514d8e">player</a>{<span class="keyword">nullptr</span>};</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"> 47</span>};</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno"> 48</span>}</div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"> 49</span> </div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno"> 50</span><span class="preprocessor">#endif </span><span class="comment">// !ENEMY_CAR_HPP</span></div>
<div class="ttc" id="acar__physics_8hpp_html"><div class="ttname"><a href="car__physics_8hpp.html">car_physics.hpp</a></div></div>
<div class="ttc" id="acar__player_8hpp_html"><div class="ttname"><a href="car__player_8hpp.html">car_player.hpp</a></div></div>
<div class="ttc" id="aclassgodot_1_1CarPhysics_html"><div class="ttname"><a href="classgodot_1_1CarPhysics.html">godot::CarPhysics</a></div><div class="ttdoc">Subclass Sandbox for car physics. Uses _integrate_forces and local_velocity to abstract the behaviour...</div><div class="ttdef"><b>Definition</b> car_physics.hpp:13</div></div>
<div class="ttc" id="aclassgodot_1_1CarPlayer_html"><div class="ttname"><a href="classgodot_1_1CarPlayer.html">godot::CarPlayer</a></div><div class="ttdoc">Sandboxed subclass of CarPhysics.</div><div class="ttdef"><b>Definition</b> car_player.hpp:18</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html"><div class="ttname"><a href="classgodot_1_1EnemyCar.html">godot::EnemyCar</a></div><div class="ttdoc">The enemy car, inherits CarPhysics subclass sandbox and uses a NavigationAgent3D to direct it.</div><div class="ttdef"><b>Definition</b> enemy_car.hpp:10</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_a04213c97827cbbc308ed8427c02c5fcb"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#a04213c97827cbbc308ed8427c02c5fcb">godot::EnemyCar::max_speed</a></div><div class="ttdeci">float max_speed</div><div class="ttdoc">Max speed when driving straight ahead.</div><div class="ttdef"><b>Definition</b> enemy_car.hpp:36</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_a194ea73522ba22cca972fde4f6d1e46c"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#a194ea73522ba22cca972fde4f6d1e46c">godot::EnemyCar::_bind_methods</a></div><div class="ttdeci">static void _bind_methods()</div><div class="ttdoc">Register damage function.</div><div class="ttdef"><b>Definition</b> enemy_car.cpp:9</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_a4291eb9882de5ac6e0bdd9be6c73a1a6"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#a4291eb9882de5ac6e0bdd9be6c73a1a6">godot::EnemyCar::GDCLASS</a></div><div class="ttdeci">GDCLASS(EnemyCar, CarPhysics)</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_a5919af73ab4db7be96162a5c7d8e68ca"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#a5919af73ab4db7be96162a5c7d8e68ca">godot::EnemyCar::turn_target_speed</a></div><div class="ttdeci">float turn_target_speed</div><div class="ttdoc">Desired speed when approaching a corner.</div><div class="ttdef"><b>Definition</b> enemy_car.hpp:34</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_a609f1f0f7da5cf8489495cb2b24f5677"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#a609f1f0f7da5cf8489495cb2b24f5677">godot::EnemyCar::recalculate_navigation</a></div><div class="ttdeci">void recalculate_navigation()</div><div class="ttdoc">Calculate a new path to the player.</div><div class="ttdef"><b>Definition</b> enemy_car.cpp:51</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_a6394ac893a7802d987b80b82e28c37fc"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#a6394ac893a7802d987b80b82e28c37fc">godot::EnemyCar::agent</a></div><div class="ttdeci">NavigationAgent3D * agent</div><div class="ttdoc">Navigation agent child node.</div><div class="ttdef"><b>Definition</b> enemy_car.hpp:44</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_a8995b45e72753e3c2e4a013d3179d8df"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#a8995b45e72753e3c2e4a013d3179d8df">godot::EnemyCar::brake_distance</a></div><div class="ttdeci">float brake_distance</div><div class="ttdoc">Distance from corners at which to start braking.</div><div class="ttdef"><b>Definition</b> enemy_car.hpp:38</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_a8febc75d9897b032d19991c153e24bad"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#a8febc75d9897b032d19991c153e24bad">godot::EnemyCar::recalc_frame_interval</a></div><div class="ttdeci">int recalc_frame_interval</div><div class="ttdoc">Interval in frames between calls to recalculate_navigation.</div><div class="ttdef"><b>Definition</b> enemy_car.hpp:32</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_a9ab3cce28d16de5cff8990be19d64e30"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#a9ab3cce28d16de5cff8990be19d64e30">godot::EnemyCar::steering_speed</a></div><div class="ttdeci">float steering_speed</div><div class="ttdoc">Speed at which to steer.</div><div class="ttdef"><b>Definition</b> enemy_car.hpp:40</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_aa746dea04ad942c35a1ec2e5799c9fe5"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#aa746dea04ad942c35a1ec2e5799c9fe5">godot::EnemyCar::_process</a></div><div class="ttdeci">virtual void _process(double delta_time) override</div><div class="ttdoc">Update current navigation and acceleration. Recalculate path every recalc_frame_interval frames....</div><div class="ttdef"><b>Definition</b> enemy_car.cpp:25</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_ababbc5a5d8e7dcff48ccfa648e79d361"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#ababbc5a5d8e7dcff48ccfa648e79d361">godot::EnemyCar::stop_fleeing</a></div><div class="ttdeci">void stop_fleeing()</div><div class="ttdoc">Called from RallyRushGameMode shield pickup end observer. Stop fleeing from the player.</div><div class="ttdef"><b>Definition</b> enemy_car.cpp:47</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_acd6f3c6792ca36a168f9be7007a2191b"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#acd6f3c6792ca36a168f9be7007a2191b">godot::EnemyCar::damage</a></div><div class="ttdeci">void damage()</div><div class="ttdoc">Destroy this object.</div><div class="ttdef"><b>Definition</b> enemy_car.cpp:39</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_ad34f23e213cfc742d498906aabfb58ca"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#ad34f23e213cfc742d498906aabfb58ca">godot::EnemyCar::_enter_tree</a></div><div class="ttdeci">virtual void _enter_tree() override</div><div class="ttdoc">Call parent _enter_tree and fetch object references for later use.</div><div class="ttdef"><b>Definition</b> enemy_car.cpp:14</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_ae0cd81c291f4f2fde194a00050c2b08c"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#ae0cd81c291f4f2fde194a00050c2b08c">godot::EnemyCar::next_recalc</a></div><div class="ttdeci">int next_recalc</div><div class="ttdoc">Frame timer to next recalculate_navigation call.</div><div class="ttdef"><b>Definition</b> enemy_car.hpp:30</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_ae2907a439673e4bcdfc061755c92c6fa"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#ae2907a439673e4bcdfc061755c92c6fa">godot::EnemyCar::flee</a></div><div class="ttdeci">bool flee</div><div class="ttdoc">If true, invert goal direction and drive away from the player.</div><div class="ttdef"><b>Definition</b> enemy_car.hpp:42</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_af705a5dc10dc15cc811da244b763b63a"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#af705a5dc10dc15cc811da244b763b63a">godot::EnemyCar::start_fleeing</a></div><div class="ttdeci">void start_fleeing()</div><div class="ttdoc">Called from RallyRushGameMode shield pickup observer. Start fleeing from the player.</div><div class="ttdef"><b>Definition</b> enemy_car.cpp:43</div></div>
<div class="ttc" id="aclassgodot_1_1EnemyCar_html_af887aaa9e94400d4727b732535514d8e"><div class="ttname"><a href="classgodot_1_1EnemyCar.html#af887aaa9e94400d4727b732535514d8e">godot::EnemyCar::player</a></div><div class="ttdeci">CarPlayer * player</div><div class="ttdoc">Reference to the player car.</div><div class="ttdef"><b>Definition</b> enemy_car.hpp:46</div></div>
<div class="ttc" id="anamespacegodot_html"><div class="ttname"><a href="namespacegodot.html">godot</a></div><div class="ttdef"><b>Definition</b> beacon_powerup.cpp:6</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7
</small></address>
</body>
</html>