Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10690 in orxonox.OLD


Ignore:
Timestamp:
Jun 13, 2007, 7:54:24 PM (17 years ago)
Author:
retolu
Message:

implementing gunFire and its Nodes(XML)

Location:
branches/adm/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/adm/src/world_entities/npcs/adm_turret.cc

    r10689 r10690  
    243243
    244244        this->weapon = new BspWeapon();
     245        this->weapon->loadParams(root);
    245246        this->weapon->setParent( this->cannons );
    246247        this->weapon->toList( getOMListNumber() );
  • branches/adm/src/world_entities/weapons/bsp_weapon.cc

    r10689 r10690  
    6767                        .describe("Damage that the weapon inflicts");
    6868                LoadParam(root, "FireRate", this, BspWeapon, setFireRate)
    69                         .describe("how fast it shoots");
     69                        .describe("how fast it shoots");
    7070                LoadParam(root, "AlwaysHits", this, BspWeapon, setAlwaysHits)
    71                         .describe("No, if the weapon should hit with a probability");
    72         }
    73 }
    74 
    75        
     71                        .describe("No, if the weapon should hit with a probability");
     72
     73                LOAD_PARAM_START_CYCLE(root, element);
     74                {
     75                        LoadParam_CYCLE(element, "addPoint", this, BspWeapon, addPoint)
     76                        .describe("Adds a new Point for Gunfire");
     77                }
     78                LOAD_PARAM_END_CYCLE(element);
     79        }
     80}
     81
     82void BspWeapon::addPoint(float x, float y, float z)
     83{
     84        if (element == 1 ){
     85                gunFire1->setRelCoor(Vector(x,y,z));
     86                element++;
     87        }
     88        if (element == 2 ){
     89                gunFire2->setRelCoor(Vector(x,y,z));
     90        }
     91}
    7692
    7793void BspWeapon::tick( float dt )
     
    101117        fireRate = 0.5;
    102118        alwaysHits = true;
     119        element=1;
    103120
    104121        this->registerObject(this, BspWeapon::_objectList);
     
    110127void BspWeapon::shoot()
    111128{
     129        gunFire.explode(gunFire1,Vector(2,2,2));
     130        gunFire.explode(gunFire2,Vector(2,2,2));
    112131        std::list<WorldEntity*>::iterator entityIterator;
    113132        // for all bsp managers check all entities
  • branches/adm/src/world_entities/weapons/bsp_weapon.h

    r10689 r10690  
    99#include "world_entity.h"
    1010#include "aiming_system.h"
     11#include "effects/explosion.h"
    1112
    1213class BspWeapon : public WorldEntity
     
    3637                bool alwaysHits;
    3738                void setAlwaysHits( bool r ){ this->alwaysHits = r; }
     39                void addPoint(float x, float y, float z);
     40                PNode* gunFire1;
     41                PNode* gunFire2;
    3842
    3943                float bRate;
    4044                bool bFire;
     45                int element;
     46
     47                Explosion gunFire;
    4148
    4249                AimingSystem* aimingSystem;
Note: See TracChangeset for help on using the changeset viewer.