Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
motion.h
1 // * This file is part of the COLOBOT source code
2 // * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
3 // *
4 // * This program is free software: you can redistribute it and/or modify
5 // * it under the terms of the GNU General Public License as published by
6 // * the Free Software Foundation, either version 3 of the License, or
7 // * (at your option) any later version.
8 // *
9 // * This program is distributed in the hope that it will be useful,
10 // * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // * GNU General Public License for more details.
13 // *
14 // * You should have received a copy of the GNU General Public License
15 // * along with this program. If not, see http://www.gnu.org/licenses/.
16 
17 // motion.h
18 
19 #pragma once
20 
21 
22 #include "common/event.h"
23 #include "common/global.h"
24 
25 #include "object/object.h"
26 
27 
28 namespace Gfx {
29 class CEngine;
30 class CParticle;
31 class CTerrain;
32 class CWater;
33 class CCamera;
34 }
35 
36 class CApplication;
37 class CBrain;
38 class CPhysics;
39 class CObject;
40 class CRobotMain;
41 class CSoundInterface;
42 
43 
44 class CMotion
45 {
46 public:
47  CMotion(CObject* object);
48  virtual ~CMotion();
49 
50  void SetPhysics(CPhysics* physics);
51  void SetBrain(CBrain* brain);
52 
53  virtual void DeleteObject(bool bAll=false);
54  virtual bool Create(Math::Vector pos, float angle, ObjectType type, float power);
55  virtual bool EventProcess(const Event &event);
56  virtual Error SetAction(int action, float time=0.2f);
57  virtual int GetAction();
58 
59  virtual bool SetParam(int rank, float value);
60  virtual float GetParam(int rank);
61 
62  virtual bool Write(char *line);
63  virtual bool Read(char *line);
64 
65  virtual void SetLinVibration(Math::Vector dir);
66  virtual Math::Vector GetLinVibration();
67  virtual void SetCirVibration(Math::Vector dir);
68  virtual Math::Vector GetCirVibration();
69  virtual void SetInclinaison(Math::Vector dir);
70  virtual Math::Vector GetInclinaison();
71 
72 protected:
73  CApplication* m_app;
74  Gfx::CEngine* m_engine;
75  Gfx::CParticle* m_particle;
76  Gfx::CTerrain* m_terrain;
77  Gfx::CWater* m_water;
78  Gfx::CCamera* m_camera;
79  CObject* m_object;
80  CBrain* m_brain;
81  CPhysics* m_physics;
82  CRobotMain* m_main;
83  CSoundInterface* m_sound;
84 
85  int m_actionType;
86  float m_actionTime;
87  float m_progress;
88 
89  Math::Vector m_linVibration; // linear vibration
90  Math::Vector m_cirVibration; // circular vibration
91  Math::Vector m_inclinaison; // tilt
92 };
93 
Some common, global definitions.
Definition: physics.h:95
Definition: robotmain.h:196
Particle engine.
Definition: particle.h:266
ObjectType
Type of game object.
Definition: object.h:46
Main application.
Definition: app.h:201
Camera moving in 3D scene.
Definition: camera.h:130
Terrain loader/generator and manager.
Definition: terrain.h:220
Definition: motion.h:44
CObject - base class for all game objects.
The graphics engine.
Definition: engine.h:682
Event types, structs and event queue.
Error
Type of error or info message.
Definition: global.h:29
Water manager/renderer.
Definition: water.h:116
3D (3x1) vector
Definition: vector.h:49
Event sent by system, interface or game.
Definition: event.h:686
Definition: object.h:352
Sound plugin interface.
Definition: sound.h:149
Definition: brain.h:78