Colobot
crash_sphere.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
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 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 #pragma once
21 
22 #include "common/logger.h"
23 
24 #include "math/sphere.h"
25 #include "math/vector.h"
26 
27 #include "sound/sound_type.h"
28 
34 {
35  CrashSphere(const Math::Vector& pos = Math::Vector(),
36  float radius = 0.0f,
37  SoundType _sound = SOUND_NONE,
38  float _hardness = 0.45f)
39  : sphere(pos, radius)
40  , sound(_sound)
41  , hardness(_hardness)
42  {
43  if (sound == SOUND_CLICK)
44  {
45  GetLogger()->Warn("Crash sphere using SOUND_CLICK, using SOUND_NONE instead.\n"); // TODO: Make sure v3 model files don't use this ~krzys_h
46  sound = SOUND_NONE;
47  }
48  }
49 
57  float hardness;
58 };
float hardness
"Hardness" of the sphere
Definition: crash_sphere.h:57
Sphere used to detect object collisions.
Definition: crash_sphere.h:33
Definition: sound_type.h:37
CLogger * GetLogger()
Global function to get Logger instance.
Definition: logger.h:135
Vector struct and related functions.
SoundType
Enum representing sound file.
Definition: sound_type.h:34
Class for logging information to file or console.
SoundType sound
Sound to be played on collision.
Definition: crash_sphere.h:55
3D (3x1) vector
Definition: vector.h:53
Defines the SoundType enum.
Math::Sphere sphere
Definition: crash_sphere.h:53
Definition: sound_type.h:36
void Warn(const char *str,...)
Definition: logger.cpp:105
Definition: sphere.h:27