Main Page · Modules · All Classes · Class Hierarchy
MAAbyssWalkingTalk.cpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #include <behaviors/walk/MAAbyssWalkingTalk.hpp>
23 #include "core/MARandomness.hpp"
24 #include "MATurnAway.hpp"
25 
26 #include <MCLog.hpp>
27 
28 MAAbyssWalkingTalk::MAAbyssWalkingTalk() : MABehavior(MCGetClassName(this))
29 {
30 }
31 
32 
34 {
36 }
37 
38 
40 {
41  // There is a "canyon" before us...
42  MA_RANDOM_POINT_1(CanyonDetected, 1, 3);
43 
44  if (CanyonDetected == 1)
45  PlaySound("canyon1");
46  if (CanyonDetected == 2)
47  PlaySound("canyon2");
48  if (CanyonDetected == 3)
49  {
50  PlaySound("gorgeous2");
51  PlaySound("canyon3");
52  }
53  // ...and we fear to fall.
54  MA_RANDOM_POINT_1(Falling, 1, 3);
55 
56  if (Falling == 1)
57  PlaySound("falling1");
58  if (Falling == 2)
59  PlaySound("falling2");
60  if (Falling == 3)
61  PlaySound("falling3");
62 }
63 
64 
66 {
68 }
virtual MABehavior::StimulusLevelType GetCurrentStimulus() override
Get the current behavior stimulus.
#define MA_RANDOM_POINT_1(_variable_name, _min, _max)
Set a random point with one value.
Behavior base class.
Definition: MABehavior.hpp:157
int PlaySound(const std::string &name)
Play a sound and register the playback.
Definition: MABehavior.cpp:823
virtual void FinishingActions() override
Perform actions when the behavior is being finished.
virtual void ActivatingActions() override
Perform actions when the behavior is being activated.
#define MABEHAVIOR_CREATE(_behavior, _master,...)
Create behaviors with custom constructor safely.
Definition: MABehavior.hpp:43
std::string MCGetClassName(T *instance=nullptr, const std::string &name_suffix="")
Get a class name.
Definition: MCDefs.hpp:627
MABehavior * GetMaster()
Get the master behavior.
Definition: MABehavior.cpp:486
Turn away from an abyss or an object.
Definition: MATurnAway.hpp:34