Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/SuperOrxoBros_HS18/src/modules/weapons/projectiles/GravityBombField.h @ 12177

Last change on this file since 12177 was 12177, checked in by siramesh, 5 years ago

Super Orxo Bros Final (Sidharth Ramesh, Nisa Balta, Jeff Ren)

File size: 3.6 KB
Line 
1/*
2 * GravityBombField.h
3 *
4 *  Created on: Apr 2, 2015
5 *      Author: meggiman
6 */
7
8#ifndef GRAVITYBOMBFIELD_H_
9#define GRAVITYBOMBFIELD_H_
10
11#include "graphics/ParticleSpawner.h"
12#include "interfaces/RadarViewable.h"
13#include "objects/ForceField.h"
14#include "BasicProjectile.h"
15#include "worldentities/MovableEntity.h"
16#include "core/CoreIncludes.h"
17#include "GravityBomb.h"
18#include "graphics/ParticleSpawner.h"
19#include "tools/ParticleInterface.h"
20#include <stdlib.h>
21#include <time.h>
22#include <math.h>
23#include "graphics/Backlight.h"
24#include "sound/WorldSound.h"
25
26namespace orxonox {
27
28/**
29 * @class   GravityBombField
30 *
31 * @brief   This class is used by GravityBomb to place the ForceField and Visual effect to the environment.
32 *          The field has a maximum lifetime and gets smaller and stronger the more time passes. In the end, the field explodes and damages all pawns nearby.
33 *
34 * @author  Manuel Eggimann
35 * @date    23.05.2015
36 */
37class GravityBombField: public ForceField, public RadarViewable {
38public:
39    GravityBombField(Context* context);
40    virtual ~GravityBombField();
41    virtual void tick(float dt) override;
42    virtual void destroy();
43
44    /**
45     * @fn  void GravityBombField::setShooter(Pawn* shooter)
46     *
47     * @brief   This function is used to determine save the pawn who created the field and is used inside the GravityBomb class.
48     *
49     * @author  Manuel Eggimann
50     * @date    23.05.2015
51     *
52     * @param [in,out] shooter the Pawn that created the field.
53     */
54    void setShooter(Pawn* shooter)
55    { this->shooter_ = shooter; }
56
57    Pawn* getShooter()
58    { return this->shooter_; }
59
60private:
61    //Set these constants inside GravityBombField.cc to alter the behaviour of the field.
62   
63    static const float FORCE_FIELD_LIFETIME;    ///< The lifetime of the ForceField in seconds. After lifetime seconds, has already exploded and the particle effects will start to vanish.
64    static const float FORCE_SPHERE_START_RADIUS;   ///< The initial sphere radius of the Force Field. The forcefield gets smaller by time.
65    static const float FORCE_SPHERE_START_STRENGTH; ///< The initial Force the Field exerts on every object with non-zero mass.
66    static const float FORCE_FIELD_EXPLOSION_DAMMAGE;   ///< The maximum dammage a pawn gets nearby an exploding field. The farer away from explosion center the smaller the dammage.
67    static const float EXPLOSION_DURATION;  ///< Determines how fast the shockwave of the Explosion expands. It takes GravityBombField::EXPLOSION_DURATION seconds for the field to expand from 0 radius to GravityBombField::EXPLOSION_RADIUS.
68    static const float EXPLOSION_RADIUS;    ///< How far does the shockwave reach. All pawns which outside of a sphere witch this radius rest unharmed by the explosion.
69    static const float PEAK_ANGULAR_VELOCITY;   ///< The model of the bomb in the center of the Field does rotate faster and faster as time passes until it reaches PEAK_ANGULAR_VELOCITY at the fields end of life.
70    static const float PEAK_EXPLOSION_FORCE;    ///< The peak force the explosion exerts on the pawns nearby.
71    static const float CENTRE_MODEL_END_SIZE;   ///< Size of the 3d-model of the bomb in the fields centre.
72
73    float forceSphereRadius_;
74    float forceStrength_;
75    float lifetime_;
76    float modelScaling_;
77    Vector3 rotationVector_;
78    bool fieldExploded_;
79    ParticleEmitter * particleSphere_;
80    ParticleEmitter * explosionCross_;
81    std::vector<Pawn*> victimsAlreadyDamaged_;
82    MovableEntity * bombModel_;
83    Pawn* shooter_;
84    Backlight* centreLight_;
85    WorldSound* explosionSound_;
86};
87
88}
89#endif /* GRAVITYBOMBFIELD_H_ */
90
Note: See TracBrowser for help on using the repository browser.