Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/world_entities/weapons/test_bullet.cc @ 4758

Last change on this file since 4758 was 4758, checked in by bensch, 19 years ago

orxonox/trunk: moved the weapons to world_entities/weapons

File size: 2.3 KB
RevLine 
[3708]1
2
[4593]3/*
[3708]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
[4593]15   co-programmer:
[3708]16*/
17
18
[3709]19#include "test_bullet.h"
[3708]20
21#include "world_entity.h"
22#include "weapon.h"
23#include "null_parent.h"
24#include "model.h"
25#include "vector.h"
26
27using namespace std;
28
29
30/**
31   \brief standard constructor
32*/
[3710]33TestBullet::TestBullet (Weapon* weapon) : Projectile(weapon)
[3755]34{
[4322]35  this->setClassID(CL_TEST_BULLET, "TestBullet");
[4597]36
[4593]37  float modelSize = .5;
[4604]38  this->model = (Model*)ResourceManager::getInstance()->load("models/orx-rocket.obj", OBJ, RP_LEVEL, (void*) &modelSize);
[3755]39}
[3708]40
41
42/**
43   \brief standard deconstructor
44*/
[4593]45TestBullet::~TestBullet ()
[3708]46{
[4593]47  /*
48     do not delete the test projectModel, since it is pnode
49     and will be cleaned out by world
[3708]50  */
51  //delete this->projectileModel;
52}
53
54
55
56/**
57   \brief signal tick, time dependent things will be handled here
58   \param time since last tick
59*/
[4593]60void TestBullet::tick (float time)
[3708]61{
[4464]62  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
63  Vector v = this->velocity * (time);
[3708]64  this->shiftCoor(v);
65
66  this->currentLifeTime += time;
67  if( this->ttl < this->currentLifeTime)
68    {
69      PRINTF(5)("FINALIZE==========================\n");
70      PRINTF(5)("current life time is: %f/%f\n", this->currentLifeTime, this->ttl);
71      PRINTF(5)("FINALIZE===========================\n");
72      this->finalize();
73      this->currentLifeTime = 0.0f;
74    }
75}
76
77/**
78   \brief the projectile gets hit by another entity
79   \param the other entity
80   \param place where it is hit
81*/
[4593]82void TestBullet::hit (WorldEntity* entity, Vector* place)
[3708]83{}
84
85
86/**
87   \brief the function gets called, when the projectile is destroyed
88*/
[4593]89void TestBullet::destroy ()
[3708]90{}
91
92
[4593]93void TestBullet::draw ()
[3708]94{
95  glMatrixMode(GL_MODELVIEW);
96  glPushMatrix();
97
[4593]98  float matrix[4][4];
[3708]99  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
100  this->getAbsDir().matrix (matrix);
[4593]101  glMultMatrixf((float*)matrix);
[3755]102  glScalef(2.0, 2.0, 2.0);
[3708]103  this->model->draw();
104
105  glPopMatrix();
106}
107
Note: See TracBrowser for help on using the repository browser.