JNR
aiMobState_Crawl.cpp
1 /*
2 
3 Jump'n'Run Engine
4 http://www.atanaslaskov.com/jnr/
5 
6 BSD LICENSE
7 Copyright (c) 2007-2013, Atanas Laskov
8 All rights reserved.
9 
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions are met:
12 1. Redistributions of source code must retain the above copyright notice,
13 this list of conditions and the following disclaimer.
14 2. Redistributions in binary form must reproduce the above copyright notice,
15 this list of conditions and the following disclaimer in the documentation
16 and/or other materials provided with the distribution.
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL ATANAS LASKOV BE LIABLE FOR ANY
21 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 */
29 
30 #include "stdafx.h"
31 #include "ai.h"
32 
33 aiMobState_Crawl::aiMobState_Crawl(void)
34 {
35  _dDir = +1;
36 }
37 
38 aiMobState_Crawl::~aiMobState_Crawl(void)
39 {
40 }
41 
42 void aiMobState_Crawl::load(laFileParser *fp)
43 {
44 }
45 
46 void aiMobState_Crawl::perceive_active( std::string strID_Old )
47 {
48  laMonster* pMonster = (laMonster*) self();
49  laPlayer* pPlayer = (laPlayer*) player();
50 
51  pMonster->move_v( laPoint3(1,0) );
52 }
53 
54 void aiMobState_Crawl::perceive_inactive( std::string strID_New )
55 {
56 }
57 
58 void aiMobState_Crawl::perceive_InTerritory(unsigned state)
59 {
60 }
61 
62 void aiMobState_Crawl::perceive_InRange(unsigned state)
63 {
64 }
65 
66 void aiMobState_Crawl::perceive_Touched(unsigned state)
67 {
68 }
69 
70 void aiMobState_Crawl::perceive_UnderAttack(unsigned state)
71 {
72 }
73 
74 void aiMobState_Crawl::perceive(unsigned state, M_BOOL global, unsigned id, aiPerceptData data)
75 {
76  aiMobState::perceive(state, global, id, data);
77 
78  laMonster* pMonster = (laMonster*) self();
79  laPlayer* pPlayer = (laPlayer*) player();
80 
81  laPivot *pMobPivot = pMonster->getPivot();
82  laPoint3 vTentacle(_dDir, 0, 0);
83 
84  vTentacle = pMobPivot->projectVector(vTentacle);
85 
86  /*if( vTentacle.lenght() < 0.1 )
87  {
88  pMonster->getPivot()-> bSimulateGravitation = M_TRUE;
89  pMonster->move_v( laPoint3(_dDir,0) );
90  }
91  else*/
92  {
93  pMonster->getPivot()-> bSimulateGravitation = M_FALSE;
94  pMonster->move_v( laPoint3(0,1) );
95  }
96 
97 
98 }
Playable Character.
Definition: laPlayer.h:46
Adds capabilities and percepts specific to monster creatures.
Definition: laMonster.h:45
Dynamic Object Pivot.
Definition: laPivot.h:44
File Parser.
Definition: laFileParser.h:41