Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/contentcreation/pps/FabianLandau/mover/environments/mover_station.cc

Last change on this file was 4855, checked in by landauf, 17 years ago
File size: 4.2 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2007 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Fabian 'x3n' Landau
13   co-programmer:
14*/
15
16#include "util/loading/load_param.h"
17#include "util/loading/factory.h"
18#include "mover_station.h"
19#include "debug.h"
20
21ObjectListDefinition(MoverStation);
22CREATE_FACTORY(MoverStation);
23
24
25MoverStation::MoverStation(const TiXmlElement* root)
26{
27    PRINTF(0)("MoverStation %p erzeugt\n", this);
28    this->rank = 0;
29    this->relTargetCoor = Vector(0, 0, 0);
30    this->relTargetDir = Vector(0, 0, 0);
31    this->delay = 0;
32    this->movingTime = 0;
33    this->stayOpenTime = 0;
34    this->bAccelerate = false;
35    this->bDecelerate = false;
36    this->jumpToRank = 0;
37    this->bJumpToRank = false;
38    this->moveToRank = 0;
39    this->bMoveToRank = false;
40    this->bIsOpen = false;
41    this->bIsClosed = false;;
42
43    if (root != NULL)
44        this->loadParams(root);
45}
46
47MoverStation::~MoverStation()
48{
49}
50
51void MoverStation::loadParams(const TiXmlElement* root)
52{
53    WorldEntity::loadParams(root);
54
55    LoadParam(root, "rank", this, MoverStation, setRank)
56        .describe("The rank of the station in the stationlist of the mover.")
57        .defaultValues(0);
58    LoadParam(root, "rel-target-coor", this, MoverStation, setRelTargetCoor)
59        .describe("The relative coordinates of the stations target.")
60        .defaultValues(0, 0, 0);
61    LoadParam(root, "rel-target-dir", this, MoverStation, setRelTargetDir)
62        .describe("The relative direction of the stations target in all axes (roll/pitch/yaw).")
63        .defaultValues(0, 0, 0);
64    LoadParam(root, "delay", this, MoverStation, setDelay)
65        .describe("The amount of time the mover waits, before he starts moving.")
66        .defaultValues(0);
67    LoadParam(root, "moving-time", this, MoverStation, setMovingTime)
68        .describe("The amount of time the mover needs to move.")
69        .defaultValues(0);
70    LoadParam(root, "stay-open-time", this, MoverStation, setStayOpenTime)
71        .describe("The amount of time the mover waits when he reached the target.")
72        .defaultValues(0);
73    LoadParam(root, "bAccelerate", this, MoverStation, setAccelerate)
74        .describe("If true, the mover starts slowly and increases his speed.");
75    LoadParam(root, "bDecelerate", this, MoverStation, setDecelerate)
76        .describe("If true, the mover starts fast and decreases his speed.");
77    LoadParam(root, "jump-to-rank", this, MoverStation, setJumpToRank)
78        .describe("The rank of the station the mover should jump to, after reaching the target.")
79        .defaultValues(0);
80    LoadParam(root, "move-to-rank", this, MoverStation, setMoveToRank)
81        .describe("The rank of the station the mover should move to (instead of rel-target-coor).")
82        .defaultValues(0);
83    LoadParam(root, "bOpen", this, MoverStation, setOpen)
84        .describe("If true, the mover changes to state 'open' after reaching this station.");
85    LoadParam(root, "bClosed", this, MoverStation, setClosed)
86        .describe("If true, the mover changes to state 'closed' after reaching this station.");
87    LoadParam(root, "opening-sound", this, MoverStation, setOpeningSoundFile)
88        .describe("Sets the file of the opening sound source");
89    LoadParam(root, "opened-sound", this, MoverStation, setOpenedSoundFile)
90        .describe("Sets the file of the opened sound source");
91    LoadParam(root, "moving-sound", this, MoverStation, setMovingSoundFile)
92        .describe("Sets the file of the moving sound source");
93    LoadParam(root, "closing-sound", this, MoverStation, setClosingSoundFile)
94        .describe("Sets the file of the closing sound source");
95    LoadParam(root, "closed-sound", this, MoverStation, setClosedSoundFile)
96        .describe("Sets the file of the closed sound source");
97       
98    if (this->bMoveToRank)
99    {
100        this->relTargetCoor = Vector(0, 0, 0);
101        this->relTargetDir = Vector(0, 0, 0);
102    }
103}
Note: See TracBrowser for help on using the repository browser.