Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
motion.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program 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 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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.
14  * See the 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, see http://gnu.org/licenses
18  */
19 
20 // motion.h
21 
22 #pragma once
23 
24 
25 #include "common/event.h"
26 #include "common/global.h"
27 
28 #include "object/object.h"
29 
30 
31 namespace Gfx {
32 class CEngine;
33 class CParticle;
34 class CTerrain;
35 class CWater;
36 class CCamera;
37 }
38 
39 class CApplication;
40 class CBrain;
41 class CPhysics;
42 class CObject;
43 class CRobotMain;
44 class CSoundInterface;
45 class CLevelParserLine;
46 
47 
48 class CMotion
49 {
50 public:
51  CMotion(CObject* object);
52  virtual ~CMotion();
53 
54  void SetPhysics(CPhysics* physics);
55  void SetBrain(CBrain* brain);
56 
57  virtual void DeleteObject(bool bAll=false);
58  virtual bool Create(Math::Vector pos, float angle, ObjectType type, float power);
59  virtual bool EventProcess(const Event &event);
60  virtual Error SetAction(int action, float time=0.2f);
61  virtual int GetAction();
62 
63  virtual bool SetParam(int rank, float value);
64  virtual float GetParam(int rank);
65 
66  virtual bool Write(CLevelParserLine* line);
67  virtual bool Read(CLevelParserLine* line);
68 
69  virtual void SetLinVibration(Math::Vector dir);
70  virtual Math::Vector GetLinVibration();
71  virtual void SetCirVibration(Math::Vector dir);
72  virtual Math::Vector GetCirVibration();
73  virtual void SetInclinaison(Math::Vector dir);
74  virtual Math::Vector GetInclinaison();
75 
76 protected:
77  CApplication* m_app;
78  Gfx::CEngine* m_engine;
79  Gfx::CParticle* m_particle;
80  Gfx::CTerrain* m_terrain;
81  Gfx::CWater* m_water;
82  Gfx::CCamera* m_camera;
83  CObject* m_object;
84  CBrain* m_brain;
85  CPhysics* m_physics;
86  CRobotMain* m_main;
87  CSoundInterface* m_sound;
88 
89  int m_actionType;
90  float m_actionTime;
91  float m_progress;
92 
93  Math::Vector m_linVibration; // linear vibration
94  Math::Vector m_cirVibration; // circular vibration
95  Math::Vector m_inclinaison; // tilt
96 };
97 
Some common, global definitions.
Definition: physics.h:98
Definition: parserline.h:33
Definition: robotmain.h:172
Particle engine.
Definition: particle.h:268
ObjectType
Type of game object.
Definition: object.h:51
Main application.
Definition: app.h:187
Camera moving in 3D scene.
Definition: camera.h:133
Terrain loader/generator and manager.
Definition: terrain.h:222
Namespace for (new) graphics code.
Definition: app.h:49
Definition: motion.h:48
CObject - base class for all game objects.
The graphics engine.
Definition: engine.h:684
Event types, structs and event queue.
Error
Type of error or info message.
Definition: global.h:32
Water manager/renderer.
Definition: water.h:118
3D (3x1) vector
Definition: vector.h:52
Event sent by system, interface or game.
Definition: event.h:678
Definition: object.h:357
Sound plugin interface.
Definition: sound.h:151
Definition: brain.h:87