Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpUnitMotionFlying.h
- This file was added.
/* Copyright (C) 2019 Wildfire Games. | |||||
* This file is part of 0 A.D. | |||||
* | |||||
* 0 A.D. is free software: you can redistribute it and/or modify | |||||
* it under the terms of the GNU General Public License as published by | |||||
* the Free Software Foundation, either version 2 of the License, or | |||||
* (at your option) any later version. | |||||
* | |||||
* 0 A.D. is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* You should have received a copy of the GNU General Public License | |||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | |||||
*/ | |||||
#ifndef INCLUDED_CCMPUNITMOTIONFLYING | |||||
#define INCLUDED_CCMPUNITMOTIONFLYING | |||||
#include "ICmpUnitMotion.h" | |||||
#include "simulation2/system/Component.h" | |||||
#include "simulation2/components/ICmpGarrisonHolder.h" | |||||
#include "simulation2/components/ICmpHealth.h" | |||||
#include "simulation2/components/ICmpPosition.h" | |||||
#include "simulation2/components/ICmpTerrain.h" | |||||
#include "simulation2/components/ICmpWaterManager.h" | |||||
#include "simulation2/components/ICmpRangeManager.h" | |||||
#include "simulation2/MessageTypes.h" | |||||
#include "ps/CLogger.h" | |||||
class CCmpUnitMotionFlying : public ICmpUnitMotion | |||||
{ | |||||
public: | |||||
DEFAULT_COMPONENT_ALLOCATOR(UnitMotionFlying) | |||||
static void ClassInit(CComponentManager& componentManager); | |||||
static std::string GetSchema(); | |||||
virtual void Serialize(ISerializer& serializer); | |||||
virtual void Deserialize(const CParamNode& paramNode, IDeserializer& deserializer); | |||||
virtual void Init(const CParamNode& paramNode); | |||||
virtual void Deinit(); | |||||
virtual void HandleMessage(const CMessage& msg, bool UNUSED(global)); | |||||
void Move(fixed turnLength); | |||||
virtual void StopMoving(); | |||||
virtual void SetSpeedMultiplier(fixed UNUSED(multiplier)); | |||||
virtual void FaceTowardsPoint(fixed x, fixed z); | |||||
virtual void SetDebugOverlay(bool enabled); | |||||
virtual bool MoveToTargetRange(entity_id_t target, entity_pos_t minRange, entity_pos_t maxRange); | |||||
virtual bool MoveToPointRange(entity_pos_t x, entity_pos_t z, entity_pos_t minRange, entity_pos_t maxRange); | |||||
virtual void MoveToFormationOffset(entity_id_t target, entity_pos_t x, entity_pos_t z); | |||||
virtual pass_class_t GetPassabilityClass() const; | |||||
virtual std::string GetPassabilityClassName() const; | |||||
virtual fixed GetSpeedMultiplier() const; | |||||
virtual fixed GetCurrentSpeed() const; | |||||
virtual fixed GetSpeed() const; | |||||
virtual fixed GetRunMultiplier() const; | |||||
virtual fixed GetWalkSpeed() const; | |||||
virtual bool IsMoveRequested() const; | |||||
virtual entity_pos_t GetUnitClearance() const; | |||||
virtual void SetFacePointAfterMove(bool facePointAfterMove); | |||||
private: | |||||
fixed m_TargetX; | |||||
fixed m_TargetZ; | |||||
fixed m_TargetMinRange; | |||||
fixed m_StationaryDistance; | |||||
fixed m_TargetMaxRange; | |||||
fixed m_Speed; | |||||
fixed m_MaxSpeed; | |||||
fixed m_TurnRate; | |||||
fixed m_BrakingRate; | |||||
fixed m_ClimbRate; | |||||
fixed m_FlyingHeight; | |||||
fixed m_LandingSpeed; | |||||
fixed m_SlowingRate; | |||||
fixed m_OvershootTime; | |||||
fixed m_TakeOffSpeed; | |||||
fixed m_AccelRate; | |||||
fixed m_Pitch; | |||||
fixed m_Roll; | |||||
bool m_HasTarget; | |||||
bool m_ReachedTarget; | |||||
bool m_DiesInWater; | |||||
bool m_Landing; | |||||
bool m_OnGround; | |||||
bool m_WaterDeath; | |||||
std::string m_PassabilityClassName; | |||||
pass_class_t m_PassabilityClass; | |||||
fixed EuclidDistance(fixed x1, fixed z1, fixed x2, fixed z2); | |||||
}; | |||||
REGISTER_COMPONENT_TYPE(UnitMotionFlying) | |||||
#endif // INCLUDED_CCMPUNITMOTIONFLYING |
Wildfire Games · Phabricator