Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/chris/src/world_entity.cc @ 2105

Last change on this file since 2105 was 2104, checked in by chris, 20 years ago

orxonox/branches/chris: This code compiles and links but is still missing the SDL libraries.

File size: 3.1 KB
Line 
1
2
3/*
4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer: Christian Meyer
16*/
17
18#include <iostream>
19
20#include "world_entity.h"
21#include "stdincl.h"
22#include "collision.h"
23
24using namespace std;
25
26
27/**
28   \brief
29   \param v:
30   \return
31*/
32
33/**
34   \brief Constructor
35
36   This Constructor initializises the all WorldEntities. Everything, that is a part of the game-world is a child of WorldEntity. This class implements empty functions for all sort of operation a WorldEntity has to or can implement.
37This is some sort of standard interface to all WorldEntities...
38*/
39WorldEntity::WorldEntity (bool isFree) : bFree(isFree)
40{
41        collisioncluster = NULL;
42        owner = NULL;
43}
44
45WorldEntity::~WorldEntity () {}
46
47Location* WorldEntity::get_location ()
48{
49        return &loc;
50}
51
52Placement* WorldEntity::get_placement ()
53{
54        return &place;
55}
56
57bool WorldEntity::isFree ()
58{
59  return bFree;
60}
61
62void WorldEntity::set_collision (CollisionCluster* newhull)
63{
64        if( newhull == NULL) return;
65        if( collisioncluster != NULL) delete collisioncluster;
66        collisioncluster = newhull;
67}
68
69/**
70   \brief this method is called every tick
71   \param time: the time since start of the world
72
73   This function is called before every repaint of the world, to update every time dependent variable of the entity. If the entity moves, it has to calculate the new position every tick here in this function. Do not use this for animations.
74*/
75void WorldEntity::tick(float time) 
76{}
77
78/**
79   \brief the entity is painted to the screen with this function
80
81   This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn.
82*/
83void WorldEntity::draw() 
84{
85  cout << "WorldEntity::draw()" << endl;
86}
87
88/* virtual void WorldEntity::actionEvent(Event* event); */
89/**
90   \brief this function is called, when two entities collide
91   \param we: the world entity, with whom it collides
92   \param loc: place where the collision happens
93*/
94void WorldEntity::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {}
95
96/**
97   \brief this function is called, when the ship is hit by a waepon
98   \param weapon: the laser/rocket/shoot that hits.
99   \param loc: place where it is hit
100
101   calculate the damage depending
102*/
103void WorldEntity::hit(WorldEntity* weapon, Vector loc) {}
104
105/**
106   \brief this function is called, if the entity is to be destroied
107   
108   This can be called, if eg. something realy bad happens :)
109*/
110void WorldEntity::destroy() {}
111
112void WorldEntity::init( Location* spawnloc, WorldEntity* spawnowner)
113{
114        loc = *spawnloc;
115        owner = spawnowner;
116}
117
118void WorldEntity::init( Placement* spawnplc, WorldEntity* spawnowner)
119{
120        place = *spawnplc;
121        owner = spawnowner;
122}
123
124void WorldEntity::post_spawn ()
125{
126}
127
128void WorldEntity::command (Command* cmd)
129{
130}
131
132void WorldEntity::get_lookat (Location* locbuf)
133{
134}
135
136void WorldEntity::left_world ()
137{
138}
Note: See TracBrowser for help on using the repository browser.