-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Player can grab weapons on the ground
- Loading branch information
Showing
37 changed files
with
528 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
<Root> | ||
<Object class="EngineOptions"> | ||
<Property type="String" name="m_name" flags="NotVisible" value="EngineOptions"/> | ||
<Property type="Uint32" name="m_uid" flags="Debug|Hexadecimal" value="1488493778"/> | ||
<Property type="Uint32" name="m_originalUID" flags="Debug|Hexadecimal" value="0"/> | ||
<Property type="EnumFlagsU32" name="m_objectFlags" flags="Debug|Bitfield" value=""/> | ||
<Property type="Uint32" name="m_uid" flags="" value="1488493778"/> | ||
<Property type="Uint32" name="m_originalUID" flags="" value="0"/> | ||
<Property type="EnumFlagsU32" name="m_objectFlags" flags="" value=""/> | ||
<Property type="String" name="m_gamePath" flags="IsFolder" value="projects/game"/> | ||
<Property type="String" name="m_startWorld" flags="IsFile" value="data/Worlds/Game.world"/> | ||
<Property type="Bool" name="m_showRigidBodies" flags="NotVisible" value="false"/> | ||
<Property type="EnumFlagsU32" name="m_showRigidBodiesMask" flags="Bitfield|Optional" value="Sphere|Box|Capsule|Cylinder"/> | ||
<Property type="EnumFlagsU32" name="m_showRigidBodiesMask" flags="" value="Sphere|Box|Capsule|Cylinder"/> | ||
<Property type="Bool" name="m_mergeStaticBodies" value="true"/> | ||
<Property type="Bool" name="m_useTimeScale" flags="NotVisible" value="false"/> | ||
<Property type="Float" name="m_timeScale" flags="HasRange|Optional" value="1"/> | ||
<Property type="Float" name="m_timeScale" flags="" value="1"/> | ||
<Property type="Bool" name="m_useMaxDT" flags="NotVisible" value="true"/> | ||
<Property type="Float" name="m_maxDT" flags="HasRange|Optional" value="16.666666"/> | ||
<Property type="Float" name="m_maxDT" flags="" value="16.666666"/> | ||
<Property type="Bool" name="m_useFixedDT" flags="NotVisible" value="false"/> | ||
<Property type="Float" name="m_fixedDT" flags="HasRange|Optional" value="16.666666"/> | ||
<Property type="Float" name="m_fixedDT" flags="" value="16.666666"/> | ||
<Property type="Bool" name="m_animationJobs" value="true"/> | ||
</Object> | ||
</Root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#pragma once | ||
#include "Behaviour/Item/ItemBehaviour.h" | ||
|
||
class CharacterBehaviour; | ||
|
||
class WeaponBehaviour final : public ItemBehaviour | ||
{ | ||
public: | ||
VG_CLASS_DECL(WeaponBehaviour, ItemBehaviour); | ||
|
||
WeaponBehaviour(const vg::core::string & _name, vg::core::IObject * _parent); | ||
~WeaponBehaviour(); | ||
|
||
void OnPlay() final override; | ||
void Update(const Context & _context) override; | ||
void SetOwner(vg::core::IGameObject * _object) final override; | ||
}; |
57 changes: 57 additions & 0 deletions
57
projects/game/src/Behaviour/Item/Weapon/WeaponBehaviour.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#include "WeaponBehaviour.h" | ||
#include "editor/Editor_Consts.h" | ||
#include "Game.h" | ||
#include "Behaviour/Character/Player/PlayerBehaviour.h" | ||
#include "engine/IAttachToNodeComponent.h" | ||
|
||
using namespace vg::core; | ||
using namespace vg::engine; | ||
|
||
VG_REGISTER_COMPONENT_CLASS(WeaponBehaviour, "Weapon", "Game", "A weapon the player can pick", vg::editor::style::icon::Script, 0); | ||
|
||
//-------------------------------------------------------------------------------------- | ||
WeaponBehaviour::WeaponBehaviour(const string & _name, IObject * _parent) : | ||
super(_name, _parent, ItemType::Weapon) | ||
{ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
WeaponBehaviour::~WeaponBehaviour() | ||
{ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
bool WeaponBehaviour::registerProperties(IClassDesc & _desc) | ||
{ | ||
super::registerProperties(_desc); | ||
|
||
return true; | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
void WeaponBehaviour::OnPlay() | ||
{ | ||
super::OnPlay(); | ||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
void WeaponBehaviour::Update(const Context & _context) | ||
{ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------------------------------- | ||
void WeaponBehaviour::SetOwner(vg::core::IGameObject * _object) | ||
{ | ||
super::SetOwner(_object); | ||
|
||
if (auto * attachToNode = GetGameObject()->GetComponentT<vg::engine::IAttachToNodeComponent>()) | ||
{ | ||
attachToNode->SetUseTarget(true); | ||
attachToNode->SetTarget(_object); | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.